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