Upstream version 5.34.92.0
[platform/framework/web/crosswalk.git] / src / third_party / WebKit / Source / core / page / Chrome.h
1 /*
2  * Copyright (C) 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
3  * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
4  * Copyright (C) 2012, Samsung Electronics. All rights reserved.
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Library General Public
8  * License as published by the Free Software Foundation; either
9  * version 2 of the License, or (at your option) any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14  * Library General Public License for more details.
15  *
16  * You should have received a copy of the GNU Library General Public License
17  * along with this library; see the file COPYING.LIB.  If not, write to
18  * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
19  * Boston, MA 02110-1301, USA.
20  */
21
22 #ifndef Chrome_h
23 #define Chrome_h
24
25 #include "core/loader/NavigationPolicy.h"
26 #include "core/page/FocusDirection.h"
27 #include "platform/Cursor.h"
28 #include "platform/HostWindow.h"
29 #include "wtf/Forward.h"
30
31 namespace WebCore {
32
33 class ChromeClient;
34 class ColorChooser;
35 class ColorChooserClient;
36 class DateTimeChooser;
37 class DateTimeChooserClient;
38 class FileChooser;
39 class FloatRect;
40 class Frame;
41 class HTMLInputElement;
42 class HitTestResult;
43 class IntRect;
44 class Node;
45 class Page;
46 class PopupMenu;
47 class PopupMenuClient;
48 class PopupOpeningObserver;
49 class SearchPopupMenu;
50
51 struct DateTimeChooserParameters;
52 struct ViewportDescription;
53 struct WindowFeatures;
54
55 class Chrome FINAL : public HostWindow {
56 public:
57     virtual ~Chrome();
58
59     static PassOwnPtr<Chrome> create(Page*, ChromeClient*);
60
61     ChromeClient& client() { return *m_client; }
62
63     // HostWindow methods.
64     virtual void invalidateContentsAndRootView(const IntRect&) OVERRIDE;
65     virtual void invalidateContentsForSlowScroll(const IntRect&) OVERRIDE;
66     virtual void scroll(const IntSize&, const IntRect&, const IntRect&) OVERRIDE;
67     virtual IntPoint screenToRootView(const IntPoint&) const OVERRIDE;
68     virtual IntRect rootViewToScreen(const IntRect&) const OVERRIDE;
69     virtual blink::WebScreenInfo screenInfo() const OVERRIDE;
70
71     virtual void scheduleAnimation() OVERRIDE;
72
73     void contentsSizeChanged(Frame*, const IntSize&) const;
74     void layoutUpdated(Frame*) const;
75
76     void setCursor(const Cursor&);
77
78     void setWindowRect(const FloatRect&) const;
79     FloatRect windowRect() const;
80
81     FloatRect pageRect() const;
82
83     void focus() const;
84     void unfocus() const;
85
86     bool canTakeFocus(FocusDirection) const;
87     void takeFocus(FocusDirection) const;
88
89     void focusedNodeChanged(Node*) const;
90
91     void show(NavigationPolicy = NavigationPolicyIgnore) const;
92
93     bool canRunModal() const;
94     bool canRunModalNow() const;
95     void runModal() const;
96
97     void setWindowFeatures(const WindowFeatures&) const;
98
99     bool toolbarsVisible() const;
100     bool statusbarVisible() const;
101     bool scrollbarsVisible() const;
102     bool menubarVisible() const;
103
104     bool canRunBeforeUnloadConfirmPanel();
105     bool runBeforeUnloadConfirmPanel(const String& message, Frame*);
106
107     void closeWindowSoon();
108
109     void runJavaScriptAlert(Frame*, const String&);
110     bool runJavaScriptConfirm(Frame*, const String&);
111     bool runJavaScriptPrompt(Frame*, const String& message, const String& defaultValue, String& result);
112     void setStatusbarText(Frame*, const String&);
113
114     IntRect windowResizerRect() const;
115
116     void mouseDidMoveOverElement(const HitTestResult&, unsigned modifierFlags);
117
118     void setToolTip(const HitTestResult&);
119
120     void print(Frame*);
121
122     PassOwnPtr<ColorChooser> createColorChooser(ColorChooserClient*, const Color& initialColor);
123     PassRefPtr<DateTimeChooser> openDateTimeChooser(DateTimeChooserClient*, const DateTimeChooserParameters&);
124     void openTextDataListChooser(HTMLInputElement&);
125
126     void runOpenPanel(Frame*, PassRefPtr<FileChooser>);
127     void enumerateChosenDirectory(FileChooser*);
128
129     void dispatchViewportPropertiesDidChange(const ViewportDescription&) const;
130
131     bool hasOpenedPopup() const;
132     PassRefPtr<PopupMenu> createPopupMenu(Frame&, PopupMenuClient*) const;
133
134     void registerPopupOpeningObserver(PopupOpeningObserver*);
135     void unregisterPopupOpeningObserver(PopupOpeningObserver*);
136
137 private:
138     Chrome(Page*, ChromeClient*);
139     void notifyPopupOpeningObservers() const;
140
141     Page* m_page;
142     ChromeClient* m_client;
143     Vector<PopupOpeningObserver*> m_popupOpeningObservers;
144 };
145
146 }
147
148 #endif // Chrome_h