initial import
[vuplus_webkit] / Source / WebCore / 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  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Library General Public
7  * License as published by the Free Software Foundation; either
8  * version 2 of the License, or (at your option) any later version.
9  *
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13  * Library General Public License for more details.
14  *
15  * You should have received a copy of the GNU Library General Public License
16  * along with this library; see the file COPYING.LIB.  If not, write to
17  * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18  * Boston, MA 02110-1301, USA.
19  */
20
21 #ifndef Chrome_h
22 #define Chrome_h
23
24 #include "Cursor.h"
25 #include "FocusDirection.h"
26 #include "HostWindow.h"
27 #include <wtf/Forward.h>
28 #include <wtf/RefPtr.h>
29
30 #if PLATFORM(MAC)
31 #ifndef __OBJC__
32 class NSView;
33 #endif
34 #endif
35
36 namespace WebCore {
37
38     class ChromeClient;
39 #if ENABLE(INPUT_COLOR)
40     class ColorChooser;
41 #endif
42     class FileChooser;
43     class FileIconLoader;
44     class FloatRect;
45     class Frame;
46     class Geolocation;
47     class HitTestResult;
48     class IntRect;
49     class NavigationAction;
50     class Node;
51     class Page;
52     class PopupMenu;
53     class PopupMenuClient;
54 #if ENABLE(NOTIFICATIONS)
55     class NotificationPresenter;
56 #endif
57     class SearchPopupMenu;
58
59     struct FrameLoadRequest;
60     struct ViewportArguments;
61     struct WindowFeatures;
62     
63     class Chrome : public HostWindow {
64     public:
65         Chrome(Page*, ChromeClient*);
66         ~Chrome();
67
68         ChromeClient* client() { return m_client; }
69
70         // HostWindow methods.
71
72         virtual void invalidateWindow(const IntRect&, bool);
73         virtual void invalidateContentsAndWindow(const IntRect&, bool);
74         virtual void invalidateContentsForSlowScroll(const IntRect&, bool);
75         virtual void scroll(const IntSize&, const IntRect&, const IntRect&);
76 #if ENABLE(TILED_BACKING_STORE)
77         virtual void delegatedScrollRequested(const IntPoint& scrollPoint);
78 #endif
79         virtual IntPoint screenToWindow(const IntPoint&) const;
80         virtual IntRect windowToScreen(const IntRect&) const;
81         virtual PlatformPageClient platformPageClient() const;
82         virtual void scrollbarsModeDidChange() const;
83         virtual void setCursor(const Cursor&);
84         virtual void setCursorHiddenUntilMouseMoves(bool);
85
86 #if ENABLE(REQUEST_ANIMATION_FRAME)
87         virtual void scheduleAnimation();
88 #endif
89
90         void scrollRectIntoView(const IntRect&) const;
91
92         void contentsSizeChanged(Frame*, const IntSize&) const;
93         void layoutUpdated(Frame*) const;
94
95         void setWindowRect(const FloatRect&) const;
96         FloatRect windowRect() const;
97
98         FloatRect pageRect() const;
99         
100         void focus() const;
101         void unfocus() const;
102
103         bool canTakeFocus(FocusDirection) const;
104         void takeFocus(FocusDirection) const;
105
106         void focusedNodeChanged(Node*) const;
107         void focusedFrameChanged(Frame*) const;
108
109         Page* createWindow(Frame*, const FrameLoadRequest&, const WindowFeatures&, const NavigationAction&) const;
110         void show() const;
111
112         bool canRunModal() const;
113         bool canRunModalNow() const;
114         void runModal() const;
115
116         void setToolbarsVisible(bool) const;
117         bool toolbarsVisible() const;
118         
119         void setStatusbarVisible(bool) const;
120         bool statusbarVisible() const;
121         
122         void setScrollbarsVisible(bool) const;
123         bool scrollbarsVisible() const;
124         
125         void setMenubarVisible(bool) const;
126         bool menubarVisible() const;
127         
128         void setResizable(bool) const;
129
130         bool canRunBeforeUnloadConfirmPanel();
131         bool runBeforeUnloadConfirmPanel(const String& message, Frame* frame);
132
133         void closeWindowSoon();
134
135         void runJavaScriptAlert(Frame*, const String&);
136         bool runJavaScriptConfirm(Frame*, const String&);
137         bool runJavaScriptPrompt(Frame*, const String& message, const String& defaultValue, String& result);
138         void setStatusbarText(Frame*, const String&);
139         bool shouldInterruptJavaScript();
140
141 #if ENABLE(REGISTER_PROTOCOL_HANDLER)
142         void registerProtocolHandler(const String& scheme, const String& baseURL, const String& url, const String& title);
143 #endif
144
145         IntRect windowResizerRect() const;
146
147         void mouseDidMoveOverElement(const HitTestResult&, unsigned modifierFlags);
148
149         void setToolTip(const HitTestResult&);
150
151         void print(Frame*);
152
153         // FIXME: Remove once all ports are using client-based geolocation. https://bugs.webkit.org/show_bug.cgi?id=40373
154         // For client-based geolocation, these two methods have moved to GeolocationClient. https://bugs.webkit.org/show_bug.cgi?id=50061
155         void requestGeolocationPermissionForFrame(Frame*, Geolocation*);
156         void cancelGeolocationPermissionRequestForFrame(Frame*, Geolocation*);
157
158 #if ENABLE(INPUT_COLOR)
159         void openColorChooser(ColorChooser*, const Color&);
160         void cleanupColorChooser();
161         void setSelectedColorInColorChooser(const Color&);
162 #endif
163
164         void runOpenPanel(Frame*, PassRefPtr<FileChooser>);
165         void loadIconForFiles(const Vector<String>&, FileIconLoader*);
166 #if ENABLE(DIRECTORY_UPLOAD)
167         void enumerateChosenDirectory(FileChooser*);
168 #endif
169
170         void dispatchViewportDataDidChange(const ViewportArguments&) const;
171
172         bool requiresFullscreenForVideoPlayback();
173
174 #if PLATFORM(MAC)
175         void focusNSView(NSView*);
176 #endif
177
178 #if ENABLE(NOTIFICATIONS)
179         NotificationPresenter* notificationPresenter() const; 
180 #endif
181
182         bool selectItemWritingDirectionIsNatural();
183         bool selectItemAlignmentFollowsMenuWritingDirection();
184         PassRefPtr<PopupMenu> createPopupMenu(PopupMenuClient*) const;
185         PassRefPtr<SearchPopupMenu> createSearchPopupMenu(PopupMenuClient*) const;
186
187 #if ENABLE(CONTEXT_MENUS)
188         void showContextMenu();
189 #endif
190
191     private:
192         Page* m_page;
193         ChromeClient* m_client;
194     };
195 }
196
197 #endif // Chrome_h