OLD | NEW |
| (Empty) |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef WEBKIT_GLUE_CHROME_CLIENT_IMPL_H_ | |
6 #define WEBKIT_GLUE_CHROME_CLIENT_IMPL_H_ | |
7 | |
8 #include "ChromeClientChromium.h" | |
9 | |
10 class WebViewImpl; | |
11 | |
12 namespace WebCore { | |
13 class HTMLParserQuirks; | |
14 class PopupContainer; | |
15 class SecurityOrigin; | |
16 struct WindowFeatures; | |
17 } | |
18 | |
19 namespace WebKit { | |
20 struct WebCursorInfo; | |
21 struct WebPopupMenuInfo; | |
22 } | |
23 | |
24 // Handles window-level notifications from WebCore on behalf of a WebView. | |
25 class ChromeClientImpl : public WebCore::ChromeClientChromium { | |
26 public: | |
27 explicit ChromeClientImpl(WebViewImpl* webview); | |
28 virtual ~ChromeClientImpl(); | |
29 | |
30 WebViewImpl* webview() const { return webview_; } | |
31 | |
32 virtual void chromeDestroyed(); | |
33 | |
34 virtual void setWindowRect(const WebCore::FloatRect&); | |
35 virtual WebCore::FloatRect windowRect(); | |
36 | |
37 virtual WebCore::FloatRect pageRect(); | |
38 | |
39 virtual float scaleFactor(); | |
40 | |
41 virtual void focus(); | |
42 virtual void unfocus(); | |
43 | |
44 virtual bool canTakeFocus(WebCore::FocusDirection); | |
45 virtual void takeFocus(WebCore::FocusDirection); | |
46 | |
47 virtual WebCore::Page* createWindow(WebCore::Frame*, | |
48 const WebCore::FrameLoadRequest&, | |
49 const WebCore::WindowFeatures&); | |
50 virtual void show(); | |
51 | |
52 virtual bool canRunModal(); | |
53 virtual void runModal(); | |
54 | |
55 virtual void setToolbarsVisible(bool); | |
56 virtual bool toolbarsVisible(); | |
57 | |
58 virtual void setStatusbarVisible(bool); | |
59 virtual bool statusbarVisible(); | |
60 | |
61 virtual void setScrollbarsVisible(bool); | |
62 virtual bool scrollbarsVisible(); | |
63 | |
64 virtual void setMenubarVisible(bool); | |
65 virtual bool menubarVisible(); | |
66 | |
67 virtual void setResizable(bool); | |
68 | |
69 virtual void addMessageToConsole(WebCore::MessageSource source, | |
70 WebCore::MessageType type, | |
71 WebCore::MessageLevel level, | |
72 const WebCore::String& message, | |
73 unsigned int lineNumber, | |
74 const WebCore::String& sourceID); | |
75 | |
76 virtual bool canRunBeforeUnloadConfirmPanel(); | |
77 virtual bool runBeforeUnloadConfirmPanel(const WebCore::String& message, | |
78 WebCore::Frame* frame); | |
79 | |
80 virtual void closeWindowSoon(); | |
81 | |
82 virtual void runJavaScriptAlert(WebCore::Frame*, const WebCore::String&); | |
83 virtual bool runJavaScriptConfirm(WebCore::Frame*, const WebCore::String&); | |
84 virtual bool runJavaScriptPrompt(WebCore::Frame*, | |
85 const WebCore::String& message, | |
86 const WebCore::String& defaultValue, | |
87 WebCore::String& result); | |
88 | |
89 virtual void setStatusbarText(const WebCore::String& message); | |
90 virtual bool shouldInterruptJavaScript(); | |
91 | |
92 // Returns true if anchors should accept keyboard focus with the tab key. | |
93 // This method is used in a convoluted fashion by EventHandler::tabsToLinks. | |
94 // It's a twisted path (self-evident, but more complicated than seems | |
95 // necessary), but the net result is that returning true from here, on a | |
96 // platform other than MAC or QT, lets anchors get keyboard focus. | |
97 virtual bool tabsToLinks() const; | |
98 | |
99 virtual WebCore::IntRect windowResizerRect() const; | |
100 | |
101 virtual void repaint(const WebCore::IntRect&, bool contentChanged, | |
102 bool immediate = false, bool repaintContentOnly = false); | |
103 virtual void scroll(const WebCore::IntSize& scrollDelta, | |
104 const WebCore::IntRect& rectToScroll, | |
105 const WebCore::IntRect& clipRect); | |
106 virtual WebCore::IntPoint screenToWindow(const WebCore::IntPoint&) const; | |
107 virtual WebCore::IntRect windowToScreen(const WebCore::IntRect&) const; | |
108 virtual PlatformPageClient platformPageClient() const { return NULL; } | |
109 virtual void contentsSizeChanged(WebCore::Frame*, | |
110 const WebCore::IntSize&) const; | |
111 virtual void scrollRectIntoView(const WebCore::IntRect&, const WebCore::Scroll
View*) const { } | |
112 | |
113 virtual void scrollbarsModeDidChange() const; | |
114 virtual void mouseDidMoveOverElement(const WebCore::HitTestResult& result, | |
115 unsigned modifierFlags); | |
116 | |
117 virtual void setToolTip(const WebCore::String& tooltip_text, | |
118 WebCore::TextDirection dir); | |
119 | |
120 virtual void print(WebCore::Frame*); | |
121 | |
122 virtual void exceededDatabaseQuota(WebCore::Frame*, | |
123 const WebCore::String& databaseName); | |
124 | |
125 #if ENABLE(OFFLINE_WEB_APPLICATIONS) | |
126 virtual void reachedMaxAppCacheSize(int64_t space_needed); | |
127 #endif | |
128 | |
129 virtual void requestGeolocationPermissionForFrame(WebCore::Frame*, WebCore::Ge
olocation*) { } | |
130 | |
131 virtual void runOpenPanel(WebCore::Frame*, | |
132 PassRefPtr<WebCore::FileChooser>); | |
133 virtual bool setCursor(WebCore::PlatformCursorHandle) { return false; } | |
134 virtual void popupOpened(WebCore::PopupContainer* popup_container, | |
135 const WebCore::IntRect& bounds, | |
136 bool activatable, | |
137 bool handle_externally); | |
138 | |
139 void SetCursor(const WebKit::WebCursorInfo& cursor); | |
140 void SetCursorForPlugin(const WebKit::WebCursorInfo& cursor); | |
141 | |
142 virtual void formStateDidChange(const WebCore::Node*); | |
143 | |
144 virtual PassOwnPtr<WebCore::HTMLParserQuirks> createHTMLParserQuirks() { retur
n 0; } | |
145 | |
146 #if ENABLE(NOTIFICATIONS) | |
147 virtual WebCore::NotificationPresenter* notificationPresenter() const; | |
148 #endif | |
149 | |
150 private: | |
151 void GetPopupMenuInfo(WebCore::PopupContainer* popup_container, | |
152 WebKit::WebPopupMenuInfo* info); | |
153 | |
154 WebViewImpl* webview_; // weak pointer | |
155 bool toolbars_visible_; | |
156 bool statusbar_visible_; | |
157 bool scrollbars_visible_; | |
158 bool menubar_visible_; | |
159 bool resizable_; | |
160 // Set to true if the next SetCursor is to be ignored. | |
161 bool ignore_next_set_cursor_; | |
162 }; | |
163 | |
164 #endif // WEBKIT_GLUE_CHROME_CLIENT_IMPL_H_ | |
OLD | NEW |