Upstream version 10.38.208.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/FocusType.h"
27 #include "platform/Cursor.h"
28 #include "platform/HostWindow.h"
29 #include "wtf/Forward.h"
30
31 namespace blink {
32
33 class ChromeClient;
34 class ColorChooser;
35 class ColorChooserClient;
36 class DateTimeChooser;
37 class DateTimeChooserClient;
38 class FileChooser;
39 class FloatRect;
40 class LocalFrame;
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() OVERRIDE;
67     virtual IntRect rootViewToScreen(const IntRect&) const OVERRIDE;
68     virtual blink::WebScreenInfo screenInfo() const OVERRIDE;
69
70     virtual void scheduleAnimation() OVERRIDE;
71
72     void contentsSizeChanged(LocalFrame*, const IntSize&) const;
73
74     void setCursor(const Cursor&);
75
76     void setWindowRect(const FloatRect&) const;
77     FloatRect windowRect() const;
78
79     FloatRect pageRect() const;
80
81     void focus() const;
82
83     bool canTakeFocus(FocusType) const;
84     void takeFocus(FocusType) const;
85
86     void focusedNodeChanged(Node*) const;
87
88     void show(NavigationPolicy = NavigationPolicyIgnore) const;
89
90     bool canRunModal() const;
91     bool canRunModalNow() const;
92     void runModal() const;
93
94     void setWindowFeatures(const WindowFeatures&) const;
95
96     bool toolbarsVisible() const;
97     bool statusbarVisible() const;
98     bool scrollbarsVisible() const;
99     bool menubarVisible() const;
100
101     bool canRunBeforeUnloadConfirmPanel();
102     bool runBeforeUnloadConfirmPanel(const String& message, LocalFrame*);
103
104     void closeWindowSoon();
105
106     void runJavaScriptAlert(LocalFrame*, const String&);
107     bool runJavaScriptConfirm(LocalFrame*, const String&);
108     bool runJavaScriptPrompt(LocalFrame*, const String& message, const String& defaultValue, String& result);
109     void setStatusbarText(LocalFrame*, const String&);
110
111     IntRect windowResizerRect() const;
112
113     void mouseDidMoveOverElement(const HitTestResult&, unsigned modifierFlags);
114
115     void setToolTip(const HitTestResult&);
116
117     void print(LocalFrame*);
118
119     PassOwnPtr<ColorChooser> createColorChooser(LocalFrame*, ColorChooserClient*, const Color& initialColor);
120     PassRefPtr<DateTimeChooser> openDateTimeChooser(DateTimeChooserClient*, const DateTimeChooserParameters&);
121     void openTextDataListChooser(HTMLInputElement&);
122
123     void runOpenPanel(LocalFrame*, PassRefPtr<FileChooser>);
124     void enumerateChosenDirectory(FileChooser*);
125
126     void dispatchViewportPropertiesDidChange(const ViewportDescription&) const;
127
128     bool hasOpenedPopup() const;
129     PassRefPtr<PopupMenu> createPopupMenu(LocalFrame&, PopupMenuClient*) const;
130
131     void registerPopupOpeningObserver(PopupOpeningObserver*);
132     void unregisterPopupOpeningObserver(PopupOpeningObserver*);
133
134     void willBeDestroyed();
135
136 private:
137     Chrome(Page*, ChromeClient*);
138     void notifyPopupOpeningObservers() const;
139
140     Page* m_page;
141     ChromeClient* m_client;
142     Vector<PopupOpeningObserver*> m_popupOpeningObservers;
143 };
144
145 }
146
147 #endif // Chrome_h