OLD | NEW |
| (Empty) |
1 /* | |
2 * Copyright (C) 2009 Google Inc. All rights reserved. | |
3 * | |
4 * Redistribution and use in source and binary forms, with or without | |
5 * modification, are permitted provided that the following conditions are | |
6 * met: | |
7 * | |
8 * * Redistributions of source code must retain the above copyright | |
9 * notice, this list of conditions and the following disclaimer. | |
10 * * Redistributions in binary form must reproduce the above | |
11 * copyright notice, this list of conditions and the following disclaimer | |
12 * in the documentation and/or other materials provided with the | |
13 * distribution. | |
14 * * Neither the name of Google Inc. nor the names of its | |
15 * contributors may be used to endorse or promote products derived from | |
16 * this software without specific prior written permission. | |
17 * | |
18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | |
19 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | |
20 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | |
21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | |
22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | |
23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | |
24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | |
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | |
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | |
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
29 */ | |
30 | |
31 #ifndef ChromeClientImpl_h | |
32 #define ChromeClientImpl_h | |
33 | |
34 #include "ChromeClientChromium.h" | |
35 | |
36 namespace WebCore { | |
37 class HTMLParserQuirks; | |
38 class PopupContainer; | |
39 class SecurityOrigin; | |
40 struct WindowFeatures; | |
41 } | |
42 | |
43 namespace WebKit { | |
44 class WebViewImpl; | |
45 struct WebCursorInfo; | |
46 struct WebPopupMenuInfo; | |
47 | |
48 // Handles window-level notifications from WebCore on behalf of a WebView. | |
49 class ChromeClientImpl : public WebCore::ChromeClientChromium { | |
50 public: | |
51 explicit ChromeClientImpl(WebViewImpl* webView); | |
52 virtual ~ChromeClientImpl(); | |
53 | |
54 WebViewImpl* webView() const { return m_webView; } | |
55 | |
56 // ChromeClient methods: | |
57 virtual void chromeDestroyed(); | |
58 virtual void setWindowRect(const WebCore::FloatRect&); | |
59 virtual WebCore::FloatRect windowRect(); | |
60 virtual WebCore::FloatRect pageRect(); | |
61 virtual float scaleFactor(); | |
62 virtual void focus(); | |
63 virtual void unfocus(); | |
64 virtual bool canTakeFocus(WebCore::FocusDirection); | |
65 virtual void takeFocus(WebCore::FocusDirection); | |
66 virtual void focusedNodeChanged(WebCore::Node*); | |
67 virtual WebCore::Page* createWindow( | |
68 WebCore::Frame*, const WebCore::FrameLoadRequest&, const WebCore::WindowFeatures&); | |
69 virtual void show(); | |
70 virtual bool canRunModal(); | |
71 virtual void runModal(); | |
72 virtual void setToolbarsVisible(bool); | |
73 virtual bool toolbarsVisible(); | |
74 virtual void setStatusbarVisible(bool); | |
75 virtual bool statusbarVisible(); | |
76 virtual void setScrollbarsVisible(bool); | |
77 virtual bool scrollbarsVisible(); | |
78 virtual void setMenubarVisible(bool); | |
79 virtual bool menubarVisible(); | |
80 virtual void setResizable(bool); | |
81 virtual void addMessageToConsole( | |
82 WebCore::MessageSource, WebCore::MessageType, WebCore::MessageLevel, | |
83 const WebCore::String& message, unsigned lineNumber, | |
84 const WebCore::String& sourceID); | |
85 virtual bool canRunBeforeUnloadConfirmPanel(); | |
86 virtual bool runBeforeUnloadConfirmPanel( | |
87 const WebCore::String& message, WebCore::Frame*); | |
88 virtual void closeWindowSoon(); | |
89 virtual void runJavaScriptAlert(WebCore::Frame*, const WebCore::String&); | |
90 virtual bool runJavaScriptConfirm(WebCore::Frame*, const WebCore::String&); | |
91 virtual bool runJavaScriptPrompt( | |
92 WebCore::Frame*, const WebCore::String& message, | |
93 const WebCore::String& defaultValue, WebCore::String& result); | |
94 virtual void setStatusbarText(const WebCore::String& message); | |
95 virtual bool shouldInterruptJavaScript(); | |
96 virtual bool tabsToLinks() const; | |
97 virtual WebCore::IntRect windowResizerRect() const; | |
98 virtual void repaint( | |
99 const WebCore::IntRect&, bool contentChanged, bool immediate = false, | |
100 bool repaintContentOnly = false); | |
101 virtual void scroll( | |
102 const WebCore::IntSize& scrollDelta, const WebCore::IntRect& rectToScroll, | |
103 const WebCore::IntRect& clipRect); | |
104 virtual WebCore::IntPoint screenToWindow(const WebCore::IntPoint&) const; | |
105 virtual WebCore::IntRect windowToScreen(const WebCore::IntRect&) const; | |
106 virtual PlatformPageClient platformPageClient() const { return 0; } | |
107 virtual void contentsSizeChanged(WebCore::Frame*, const WebCore::IntSize&) const; | |
108 virtual void scrollRectIntoView( | |
109 const WebCore::IntRect&, const WebCore::ScrollView*) const { } | |
110 virtual void scrollbarsModeDidChange() const; | |
111 virtual void mouseDidMoveOverElement( | |
112 const WebCore::HitTestResult& result, unsigned modifierFlags); | |
113 virtual void setToolTip(const WebCore::String& tooltipText, WebCore::TextDirection); | |
114 virtual void print(WebCore::Frame*); | |
115 virtual void exceededDatabaseQuota( | |
116 WebCore::Frame*, const WebCore::String& databaseName); | |
117 #if ENABLE(OFFLINE_WEB_APPLICATIONS) | |
118 virtual void reachedMaxAppCacheSize(int64_t spaceNeeded); | |
119 #endif | |
120 #if ENABLE(NOTIFICATIONS) | |
121 virtual WebCore::NotificationPresenter* notificationPresenter() const; | |
122 #endif | |
123 virtual void requestGeolocationPermissionForFrame( | |
124 WebCore::Frame*, WebCore::Geolocation*) { } | |
125 virtual void runOpenPanel(WebCore::Frame*, PassRefPtr<WebCore::FileChooser>); | |
126 virtual bool setCursor(WebCore::PlatformCursorHandle) { return false; } | |
127 virtual void formStateDidChange(const WebCore::Node*); | |
128 virtual PassOwnPtr<WebCore::HTMLParserQuirks> createHTMLParserQuirks() { return 0; } | |
129 | |
130 // ChromeClientChromium methods: | |
131 virtual void popupOpened(WebCore::PopupContainer* popupContainer, | |
132 const WebCore::IntRect& bounds, | |
133 bool activatable, | |
134 bool handleExternally); | |
135 | |
136 // ChromeClientImpl: | |
137 void setCursor(const WebCursorInfo& cursor); | |
138 void setCursorForPlugin(const WebCursorInfo& cursor); | |
139 | |
140 private: | |
141 void getPopupMenuInfo(WebCore::PopupContainer*, WebPopupMenuInfo*); | |
142 | |
143 WebViewImpl* m_webView; // weak pointer | |
144 bool m_toolbarsVisible; | |
145 bool m_statusbarVisible; | |
146 bool m_scrollbarsVisible; | |
147 bool m_menubarVisible; | |
148 bool m_resizable; | |
149 // Set to true if the next SetCursor is to be ignored. | |
150 bool m_ignoreNextSetCursor; | |
151 }; | |
152 | |
153 } // namespace WebKit | |
154 | |
155 #endif | |
OLD | NEW |