initial import
[vuplus_webkit] / Source / WebKit / wince / WebCoreSupport / ChromeClientWinCE.h
1 /*
2  * Copyright (C) 2010 Patrick Gansterer <paroga@paroga.com>
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 AND ITS CONTRIBUTORS "AS IS" AND ANY
14  * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
15  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
16  * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
17  * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
18  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
19  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
20  * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
21  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
22  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
23  */
24
25 #ifndef ChromeClientWinCE_h
26 #define ChromeClientWinCE_h
27
28 #include "ChromeClient.h"
29
30 class WebView;
31
32 namespace WebKit {
33
34 class ChromeClientWinCE : public WebCore::ChromeClient {
35 public:
36     ChromeClientWinCE(WebView* webView);
37
38     virtual void chromeDestroyed();
39
40     virtual void* webView() const { return 0; }
41     virtual void setWindowRect(const WebCore::FloatRect&);
42     virtual WebCore::FloatRect windowRect();
43
44     virtual WebCore::FloatRect pageRect();
45
46     virtual void focus();
47     virtual void unfocus();
48
49     virtual bool canTakeFocus(WebCore::FocusDirection);
50     virtual void takeFocus(WebCore::FocusDirection);
51
52     virtual void focusedNodeChanged(WebCore::Node*);
53     virtual void focusedFrameChanged(WebCore::Frame*);
54
55     // The Frame pointer provides the ChromeClient with context about which
56     // Frame wants to create the new Page.  Also, the newly created window
57     // should not be shown to the user until the ChromeClient of the newly
58     // created Page has its show method called.
59     virtual WebCore::Page* createWindow(WebCore::Frame*, const WebCore::FrameLoadRequest&, const WebCore::WindowFeatures&, const WebCore::NavigationAction&);
60     virtual void show();
61
62     virtual bool canRunModal();
63     virtual void runModal();
64
65     virtual void setToolbarsVisible(bool);
66     virtual bool toolbarsVisible();
67
68     virtual void setStatusbarVisible(bool);
69     virtual bool statusbarVisible();
70
71     virtual void setScrollbarsVisible(bool);
72     virtual bool scrollbarsVisible();
73
74     virtual void setMenubarVisible(bool);
75     virtual bool menubarVisible();
76
77     virtual void setResizable(bool);
78
79     virtual void addMessageToConsole(WebCore::MessageSource, WebCore::MessageType, WebCore::MessageLevel, const WTF::String& message, unsigned int lineNumber, const WTF::String& sourceID);
80
81     virtual bool canRunBeforeUnloadConfirmPanel();
82     virtual bool runBeforeUnloadConfirmPanel(const WTF::String& message, WebCore::Frame* frame);
83
84     virtual void closeWindowSoon();
85
86     virtual void runJavaScriptAlert(WebCore::Frame*, const WTF::String&);
87     virtual bool runJavaScriptConfirm(WebCore::Frame*, const WTF::String&);
88     virtual bool runJavaScriptPrompt(WebCore::Frame*, const WTF::String& message, const WTF::String& defaultValue, WTF::String& result);
89     virtual void setStatusbarText(const WTF::String&);
90     virtual bool shouldInterruptJavaScript();
91     virtual WebCore::KeyboardUIMode keyboardUIMode();
92
93     virtual WebCore::IntRect windowResizerRect() const;
94
95     // Methods used by HostWindow.
96     virtual void invalidateWindow(const WebCore::IntRect&, bool);
97     virtual void invalidateContentsAndWindow(const WebCore::IntRect&, bool);
98     virtual void invalidateContentsForSlowScroll(const WebCore::IntRect&, bool);
99     virtual void scroll(const WebCore::IntSize&, const WebCore::IntRect&, const WebCore::IntRect&);
100     virtual WebCore::IntPoint screenToWindow(const WebCore::IntPoint&) const;
101     virtual WebCore::IntRect windowToScreen(const WebCore::IntRect&) const;
102     virtual PlatformPageClient platformPageClient() const;
103     virtual void contentsSizeChanged(WebCore::Frame*, const WebCore::IntSize&) const;
104     virtual void scrollRectIntoView(const WebCore::IntRect&) const; // Currently only Mac has a non empty implementation.
105     virtual void scrollbarsModeDidChange() const;
106     virtual void setCursor(const WebCore::Cursor&);
107     virtual void setCursorHiddenUntilMouseMoves(bool);
108     // End methods used by HostWindow.
109
110     virtual void mouseDidMoveOverElement(const WebCore::HitTestResult&, unsigned modifierFlags);
111
112     virtual void setToolTip(const WTF::String&, WebCore::TextDirection);
113
114     virtual void print(WebCore::Frame*);
115
116 #if ENABLE(DATABASE)
117     virtual void exceededDatabaseQuota(WebCore::Frame*, const WTF::String& databaseName);
118 #endif
119
120 #if ENABLE(OFFLINE_WEB_APPLICATIONS)
121     // Callback invoked when the application cache fails to save a cache object
122     // because storing it would grow the database file past its defined maximum
123     // size or past the amount of free space on the device.
124     // The chrome client would need to take some action such as evicting some
125     // old caches.
126     virtual void reachedMaxAppCacheSize(int64_t spaceNeeded);
127
128     // Callback invoked when the application cache origin quota is reached. This
129     // means that the resources attempting to be cached via the manifest are
130     // more than allowed on this origin. This callback allows the chrome client
131     // to take action, such as prompting the user to ask to increase the quota
132     // for this origin.
133     virtual void reachedApplicationCacheOriginQuota(WebCore::SecurityOrigin*, int64_t totalSpaceNeeded);
134 #endif
135
136 #if ENABLE(CONTEXT_MENUS)
137     virtual void showContextMenu() { }
138 #endif
139
140 #if ENABLE(NOTIFICATIONS)
141     virtual WebCore::NotificationPresenter* notificationPresenter() const;
142 #endif
143
144     // This can be either a synchronous or asynchronous call. The ChromeClient can display UI asking the user for permission
145     // to use Geolocation.
146     virtual void requestGeolocationPermissionForFrame(WebCore::Frame*, WebCore::Geolocation*);
147     virtual void cancelGeolocationPermissionRequestForFrame(WebCore::Frame*, WebCore::Geolocation*);
148
149     virtual void runOpenPanel(WebCore::Frame*, PassRefPtr<WebCore::FileChooser>);
150     // Asynchronous request to load an icon for specified filenames.
151     virtual void loadIconForFiles(const Vector<WTF::String>&, WebCore::FileIconLoader*);
152
153     // Notification that the given form element has changed. This function
154     // will be called frequently, so handling should be very fast.
155     virtual void formStateDidChange(const WebCore::Node*);
156
157 #if USE(ACCELERATED_COMPOSITING)
158     // Pass 0 as the GraphicsLayer to detatch the root layer.
159     virtual void attachRootGraphicsLayer(WebCore::Frame*, WebCore::GraphicsLayer*);
160     // Sets a flag to specify that the next time content is drawn to the window,
161     // the changes appear on the screen in synchrony with updates to GraphicsLayers.
162     virtual void setNeedsOneShotDrawingSynchronization();
163     // Sets a flag to specify that the view needs to be updated, so we need
164     // to do an eager layout before the drawing.
165     virtual void scheduleCompositingLayerSync();
166 #endif
167
168     virtual void setLastSetCursorToCurrentCursor();
169
170 #if ENABLE(TOUCH_EVENTS)
171     virtual void needTouchEvents(bool);
172 #endif
173
174     virtual bool selectItemWritingDirectionIsNatural();
175     virtual bool selectItemAlignmentFollowsMenuWritingDirection();
176     virtual PassRefPtr<WebCore::PopupMenu> createPopupMenu(WebCore::PopupMenuClient*) const;
177     virtual PassRefPtr<WebCore::SearchPopupMenu> createSearchPopupMenu(WebCore::PopupMenuClient*) const;
178
179     virtual bool shouldRubberBandInDirection(WebCore::ScrollDirection) const { return true; }
180     virtual void numWheelEventHandlersChanged(unsigned) { }
181
182 private:
183     WebView* m_webView;
184 };
185
186 } // namespace WebKit
187
188 #endif // ChromeClientWinCE_h