1/*
2 * Copyright (C) 2012 Samsung Electronics. All rights reserved.
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
6 * are met:
7 * 1. Redistributions of source code must retain the above copyright
8 *    notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright
10 *    notice, this list of conditions and the following disclaimer in the
11 *    documentation and/or other materials provided with the distribution.
12 *
13 * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
14 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
15 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
17 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
18 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
19 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
20 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
21 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
22 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
23 * THE POSSIBILITY OF SUCH DAMAGE.
24 */
25
26#ifndef ewk_window_features_private_h
27#define ewk_window_features_private_h
28
29#include "EflTypedefs.h"
30#include "ewk_object_private.h"
31#include <WebKit/WKBase.h>
32#include <wtf/RefCounted.h>
33
34class EwkView;
35
36class EwkWindowFeatures : public EwkObject {
37public:
38    EWK_OBJECT_DECLARE(EwkWindowFeatures)
39
40    static PassRefPtr<EwkWindowFeatures> create(WKDictionaryRef windowFeatures, EwkView* viewImpl)
41    {
42        return adoptRef(new EwkWindowFeatures(windowFeatures, viewImpl));
43    }
44
45    const Evas_Coord_Rectangle& geometry() const { return m_geometry; }
46    void setGeometry(const Evas_Coord_Rectangle& geometry) { m_geometry = geometry; }
47
48    bool toolbarVisible() const { return m_toolbarVisible; }
49    void setToolbarVisible(bool toolbarVisible);
50
51    bool statusBarVisible() const { return m_statusBarVisible; }
52    void setStatusBarVisible(bool statusBarVisible);
53
54    bool scrollbarsVisible() const { return m_scrollbarsVisible; }
55    void setScrollbarsVisible(bool scrollbarsVisible) { m_scrollbarsVisible = scrollbarsVisible; }
56
57    bool menuBarVisible() const { return m_menuBarVisible; }
58    void setMenuBarVisible(bool menuBarVisible);
59
60    bool locationBarVisible() const { return m_locationBarVisible; }
61    void setLocationBarVisible(bool locationBarVisible) { m_locationBarVisible = locationBarVisible; }
62
63    bool resizable() const { return m_resizable; }
64    void setResizable(bool resizable);
65
66    bool fullScreen() const { return m_fullScreen; }
67    void setFullScreen(bool fullScreen) { m_fullScreen = fullScreen; }
68
69private:
70    EwkWindowFeatures(WKDictionaryRef windowFeatures, EwkView* viewImpl);
71
72    static bool getWindowFeatureBoolValue(WKDictionaryRef windowFeatures, const char* featureName, bool defaultValue);
73    static double getWindowFeatureDoubleValue(WKDictionaryRef windowFeatures, const char* featureName, double defaultValue);
74
75    EwkView* m_view;
76
77    Evas_Coord_Rectangle m_geometry;
78    bool m_toolbarVisible;
79    bool m_statusBarVisible;
80    bool m_scrollbarsVisible;
81    bool m_menuBarVisible;
82    bool m_locationBarVisible;
83    bool m_resizable;
84    bool m_fullScreen;
85};
86
87#endif // ewk_window_features_private_h
88