OLD | NEW |
1 // Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // WebCore provides hooks for several kinds of functionality, allowing separate | 5 // WebCore provides hooks for several kinds of functionality, allowing separate |
6 // classes termed "delegates" to receive notifications (in the form of direct | 6 // classes termed "delegates" to receive notifications (in the form of direct |
7 // function calls) when certain events are about to occur or have just occurred. | 7 // function calls) when certain events are about to occur or have just occurred. |
8 // In some cases, the delegate implements the needed functionality; in others, | 8 // In some cases, the delegate implements the needed functionality; in others, |
9 // the delegate has some control over the behavior but doesn't actually | 9 // the delegate has some control over the behavior but doesn't actually |
10 // implement it. For example, the UI delegate is responsible for showing a | 10 // implement it. For example, the UI delegate is responsible for showing a |
(...skipping 10 matching lines...) Expand all Loading... |
21 // the needed functionality of the WebKit UIDelegate, ContextMenuDelegate, | 21 // the needed functionality of the WebKit UIDelegate, ContextMenuDelegate, |
22 // PolicyDelegate, FrameLoadDelegate, and EditorDelegate; additional portions | 22 // PolicyDelegate, FrameLoadDelegate, and EditorDelegate; additional portions |
23 // of ChromeClient and FrameLoaderClient not delegated in the WebKit | 23 // of ChromeClient and FrameLoaderClient not delegated in the WebKit |
24 // implementation; and some WebView additions. | 24 // implementation; and some WebView additions. |
25 | 25 |
26 #ifndef WEBKIT_GLUE_WEBVIEW_DELEGATE_H_ | 26 #ifndef WEBKIT_GLUE_WEBVIEW_DELEGATE_H_ |
27 #define WEBKIT_GLUE_WEBVIEW_DELEGATE_H_ | 27 #define WEBKIT_GLUE_WEBVIEW_DELEGATE_H_ |
28 | 28 |
29 #include <vector> | 29 #include <vector> |
30 | 30 |
31 #include "base/gfx/native_widget_types.h" | |
32 #include "webkit/api/public/WebFrame.h" | 31 #include "webkit/api/public/WebFrame.h" |
33 #include "webkit/api/public/WebNavigationPolicy.h" | 32 #include "webkit/api/public/WebNavigationPolicy.h" |
34 #include "webkit/api/public/WebNavigationType.h" | 33 #include "webkit/api/public/WebNavigationType.h" |
35 #include "webkit/api/public/WebTextDirection.h" | 34 #include "webkit/api/public/WebTextDirection.h" |
36 #include "webkit/api/public/WebWidgetClient.h" | 35 #include "webkit/api/public/WebWidgetClient.h" |
37 #include "webkit/glue/context_menu.h" | 36 #include "webkit/glue/context_menu.h" |
38 | 37 |
39 namespace webkit_glue { | 38 namespace webkit_glue { |
40 class WebMediaPlayerDelegate; | 39 class WebMediaPlayerDelegate; |
| 40 struct WebPluginGeometry; |
41 } | 41 } |
42 | 42 |
43 namespace WebCore { | 43 namespace WebCore { |
44 class AccessibilityObject; | 44 class AccessibilityObject; |
45 } | 45 } |
46 | 46 |
47 namespace WebKit { | 47 namespace WebKit { |
48 class WebDataSource; | 48 class WebDataSource; |
49 class WebDragData; | 49 class WebDragData; |
50 class WebForm; | 50 class WebForm; |
51 class WebWorker; | 51 class WebWorker; |
52 class WebWorkerClient; | 52 class WebWorkerClient; |
53 class WebMediaPlayer; | 53 class WebMediaPlayer; |
54 class WebMediaPlayerClient; | 54 class WebMediaPlayerClient; |
55 class WebNode; | 55 class WebNode; |
56 class WebNotificationPresenter; | 56 class WebNotificationPresenter; |
| 57 class WebPlugin; |
57 class WebURLRequest; | 58 class WebURLRequest; |
58 class WebURLResponse; | 59 class WebURLResponse; |
59 class WebWidget; | 60 class WebWidget; |
| 61 struct WebPluginParams; |
60 struct WebPoint; | 62 struct WebPoint; |
61 struct WebPopupMenuInfo; | 63 struct WebPopupMenuInfo; |
62 struct WebRect; | 64 struct WebRect; |
63 struct WebURLError; | 65 struct WebURLError; |
64 } | 66 } |
65 | 67 |
66 class FilePath; | 68 class FilePath; |
67 class SkBitmap; | 69 class SkBitmap; |
68 class WebDevToolsAgentDelegate; | 70 class WebDevToolsAgentDelegate; |
69 class WebMediaPlayerDelegate; | 71 class WebMediaPlayerDelegate; |
70 class WebPluginDelegate; | |
71 class WebView; | 72 class WebView; |
72 struct ContextMenuMediaParams; | 73 struct ContextMenuMediaParams; |
73 struct WebPluginGeometry; | |
74 struct WebPreferences; | 74 struct WebPreferences; |
75 | 75 |
76 enum NavigationGesture { | 76 enum NavigationGesture { |
77 NavigationGestureUser, // User initiated navigation/load. This is not | 77 NavigationGestureUser, // User initiated navigation/load. This is not |
78 // currently used due to the untrustworthy nature | 78 // currently used due to the untrustworthy nature |
79 // of userGestureHint (wasRunByUserGesture). See | 79 // of userGestureHint (wasRunByUserGesture). See |
80 // bug 1051891. | 80 // bug 1051891. |
81 NavigationGestureAuto, // Non-user initiated navigation / load. For example | 81 NavigationGestureAuto, // Non-user initiated navigation / load. For example |
82 // onload or setTimeout triggered document.location | 82 // onload or setTimeout triggered document.location |
83 // changes, and form.submits. See bug 1046841 for | 83 // changes, and form.submits. See bug 1046841 for |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
129 } | 129 } |
130 | 130 |
131 // Like CreatePopupWidget, except the actual widget is rendered by the | 131 // Like CreatePopupWidget, except the actual widget is rendered by the |
132 // embedder using the supplied info. | 132 // embedder using the supplied info. |
133 virtual WebKit::WebWidget* CreatePopupWidgetWithInfo( | 133 virtual WebKit::WebWidget* CreatePopupWidgetWithInfo( |
134 WebView* webview, | 134 WebView* webview, |
135 const WebKit::WebPopupMenuInfo& info) { | 135 const WebKit::WebPopupMenuInfo& info) { |
136 return NULL; | 136 return NULL; |
137 } | 137 } |
138 | 138 |
139 // This method is called to create a WebPluginDelegate implementation when a | 139 virtual WebKit::WebPlugin* CreatePlugin( |
140 // new plugin is instanced. See webkit_glue::CreateWebPluginDelegateHelper | 140 WebKit::WebFrame* parent_frame, |
141 // for a default WebPluginDelegate implementation. | 141 const WebKit::WebPluginParams& params) { |
142 // TODO(port): clsid is very Win- and ActiveX-specific; refactor to be more | |
143 // platform-neutral | |
144 virtual WebPluginDelegate* CreatePluginDelegate( | |
145 WebView* webview, | |
146 const GURL& url, | |
147 const std::string& mime_type, | |
148 const std::string& clsid, | |
149 std::string* actual_mime_type) { | |
150 return NULL; | 142 return NULL; |
151 } | 143 } |
152 | 144 |
153 // Called when a windowed plugin is created. | |
154 // Lets the view delegate create anything it is using to wrap the plugin. | |
155 virtual void CreatedPluginWindow(gfx::PluginWindowHandle handle) { } | |
156 | |
157 // Called when a windowed plugin is closing. | |
158 // Lets the view delegate shut down anything it is using to wrap the plugin. | |
159 virtual void WillDestroyPluginWindow(gfx::PluginWindowHandle handle) { } | |
160 | |
161 // This method is called when the renderer creates a worker object. | 145 // This method is called when the renderer creates a worker object. |
162 virtual WebKit::WebWorker* CreateWebWorker(WebKit::WebWorkerClient* client) { | 146 virtual WebKit::WebWorker* CreateWebWorker(WebKit::WebWorkerClient* client) { |
163 return NULL; | 147 return NULL; |
164 } | 148 } |
165 | 149 |
166 // Called when a WebMediaPlayer is needed. | 150 // Called when a WebMediaPlayer is needed. |
167 virtual WebKit::WebMediaPlayer* CreateWebMediaPlayer( | 151 virtual WebKit::WebMediaPlayer* CreateWebMediaPlayer( |
168 WebKit::WebMediaPlayerClient* client) { | 152 WebKit::WebMediaPlayerClient* client) { |
169 return NULL; | 153 return NULL; |
170 } | 154 } |
(...skipping 27 matching lines...) Expand all Loading... |
198 return true; | 182 return true; |
199 } | 183 } |
200 | 184 |
201 // Called by ChromeClientImpl::focus() if accessibility on the renderer side | 185 // Called by ChromeClientImpl::focus() if accessibility on the renderer side |
202 // is enabled, and a focus change has occurred. Will retrieve the id of the | 186 // is enabled, and a focus change has occurred. Will retrieve the id of the |
203 // input AccessibilityObject and send it through IPC for handling on the | 187 // input AccessibilityObject and send it through IPC for handling on the |
204 // browser side. | 188 // browser side. |
205 virtual void FocusAccessibilityObject(WebCore::AccessibilityObject* acc_obj) { | 189 virtual void FocusAccessibilityObject(WebCore::AccessibilityObject* acc_obj) { |
206 } | 190 } |
207 | 191 |
208 // Keeps track of the necessary window move for a plugin window that resulted | |
209 // from a scroll operation. That way, all plugin windows can be moved at the | |
210 // same time as each other and the page. | |
211 virtual void DidMovePlugin(const WebPluginGeometry& move) { | |
212 } | |
213 | |
214 // FrameLoaderClient ------------------------------------------------------- | 192 // FrameLoaderClient ------------------------------------------------------- |
215 | 193 |
216 virtual bool CanAcceptLoadDrops() const { | 194 virtual bool CanAcceptLoadDrops() const { |
217 // Always return true here so layout tests (which use the default WebView | 195 // Always return true here so layout tests (which use the default WebView |
218 // delegate) continue to pass. | 196 // delegate) continue to pass. |
219 return true; | 197 return true; |
220 } | 198 } |
221 | 199 |
222 // Notifies the delegate that a load has begun. | 200 // Notifies the delegate that a load has begun. |
223 virtual void DidStartLoading(WebView* webview) { | 201 virtual void DidStartLoading(WebView* webview) { |
(...skipping 327 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
551 } | 529 } |
552 | 530 |
553 // Called to retrieve the provider of desktop notifications. Pointer | 531 // Called to retrieve the provider of desktop notifications. Pointer |
554 // is owned by the implementation of WebViewDelegate. | 532 // is owned by the implementation of WebViewDelegate. |
555 virtual WebKit::WebNotificationPresenter* GetNotificationPresenter() { | 533 virtual WebKit::WebNotificationPresenter* GetNotificationPresenter() { |
556 return NULL; | 534 return NULL; |
557 } | 535 } |
558 | 536 |
559 // UIDelegate -------------------------------------------------------------- | 537 // UIDelegate -------------------------------------------------------------- |
560 | 538 |
561 // Asks the browser to show a modal HTML dialog. The dialog is passed the | |
562 // given arguments as a JSON string, and returns its result as a JSON string | |
563 // through json_retval. | |
564 virtual void ShowModalHTMLDialog(const GURL& url, int width, int height, | |
565 const std::string& json_arguments, | |
566 std::string* json_retval) { | |
567 } | |
568 | |
569 // Displays a JavaScript alert panel associated with the given view. Clients | 539 // Displays a JavaScript alert panel associated with the given view. Clients |
570 // should visually indicate that this panel comes from JavaScript and some | 540 // should visually indicate that this panel comes from JavaScript and some |
571 // information about the originating frame (at least the domain). The panel | 541 // information about the originating frame (at least the domain). The panel |
572 // should have a single OK button. | 542 // should have a single OK button. |
573 virtual void RunJavaScriptAlert(WebKit::WebFrame* webframe, | 543 virtual void RunJavaScriptAlert(WebKit::WebFrame* webframe, |
574 const std::wstring& message) { | 544 const std::wstring& message) { |
575 } | 545 } |
576 | 546 |
577 // Displays a JavaScript confirm panel associated with the given view. | 547 // Displays a JavaScript confirm panel associated with the given view. |
578 // Clients should visually indicate that this panel comes | 548 // Clients should visually indicate that this panel comes |
(...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
851 // Called when an item was added to the history | 821 // Called when an item was added to the history |
852 virtual void DidAddHistoryItem() { } | 822 virtual void DidAddHistoryItem() { } |
853 | 823 |
854 WebViewDelegate() { } | 824 WebViewDelegate() { } |
855 | 825 |
856 protected: | 826 protected: |
857 ~WebViewDelegate() { } | 827 ~WebViewDelegate() { } |
858 }; | 828 }; |
859 | 829 |
860 #endif // WEBKIT_GLUE_WEBVIEW_DELEGATE_H_ | 830 #endif // WEBKIT_GLUE_WEBVIEW_DELEGATE_H_ |
OLD | NEW |