OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #ifndef CONTENT_PUBLIC_BROWSER_WEB_CONTENTS_DELEGATE_H_ | 5 #ifndef CONTENT_PUBLIC_BROWSER_WEB_CONTENTS_DELEGATE_H_ |
6 #define CONTENT_PUBLIC_BROWSER_WEB_CONTENTS_DELEGATE_H_ | 6 #define CONTENT_PUBLIC_BROWSER_WEB_CONTENTS_DELEGATE_H_ |
7 | 7 |
8 #include <set> | 8 #include <set> |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
112 // Notifies the delegate that this contents is starting or is done loading | 112 // Notifies the delegate that this contents is starting or is done loading |
113 // some resource. The delegate should use this notification to represent | 113 // some resource. The delegate should use this notification to represent |
114 // loading feedback. See WebContents::IsLoading() | 114 // loading feedback. See WebContents::IsLoading() |
115 virtual void LoadingStateChanged(WebContents* source) {} | 115 virtual void LoadingStateChanged(WebContents* source) {} |
116 | 116 |
117 // Notifies the delegate that the page has made some progress loading. | 117 // Notifies the delegate that the page has made some progress loading. |
118 // |progress| is a value between 0.0 (nothing loaded) to 1.0 (page fully | 118 // |progress| is a value between 0.0 (nothing loaded) to 1.0 (page fully |
119 // loaded). | 119 // loaded). |
120 // Note that to receive this notification, you must have called | 120 // Note that to receive this notification, you must have called |
121 // SetReportLoadProgressEnabled(true) in the render view. | 121 // SetReportLoadProgressEnabled(true) in the render view. |
122 virtual void LoadProgressChanged(double progress) {} | 122 virtual void LoadProgressChanged(WebContents* source, |
| 123 double progress) {} |
123 | 124 |
124 // Request the delegate to close this web contents, and do whatever cleanup | 125 // Request the delegate to close this web contents, and do whatever cleanup |
125 // it needs to do. | 126 // it needs to do. |
126 virtual void CloseContents(WebContents* source) {} | 127 virtual void CloseContents(WebContents* source) {} |
127 | 128 |
128 // Informs the delegate that the underlying RenderViewHost has been swapped | 129 // Informs the delegate that the underlying RenderViewHost has been swapped |
129 // out so it can perform any cleanup necessary. | 130 // out so it can perform any cleanup necessary. |
130 virtual void SwappedOut(WebContents* source) {} | 131 virtual void SwappedOut(WebContents* source) {} |
131 | 132 |
132 // Request the delegate to move this WebContents to the specified position | 133 // Request the delegate to move this WebContents to the specified position |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
199 virtual bool ShouldFocusPageAfterCrash(); | 200 virtual bool ShouldFocusPageAfterCrash(); |
200 | 201 |
201 // Called when a popup select is about to be displayed. The delegate can use | 202 // Called when a popup select is about to be displayed. The delegate can use |
202 // this to disable inactive rendering for the frame in the window the select | 203 // this to disable inactive rendering for the frame in the window the select |
203 // is opened within if necessary. | 204 // is opened within if necessary. |
204 virtual void RenderWidgetShowing() {} | 205 virtual void RenderWidgetShowing() {} |
205 | 206 |
206 // This is called when WebKit tells us that it is done tabbing through | 207 // This is called when WebKit tells us that it is done tabbing through |
207 // controls on the page. Provides a way for WebContentsDelegates to handle | 208 // controls on the page. Provides a way for WebContentsDelegates to handle |
208 // this. Returns true if the delegate successfully handled it. | 209 // this. Returns true if the delegate successfully handled it. |
209 virtual bool TakeFocus(bool reverse); | 210 virtual bool TakeFocus(WebContents* soruce, |
| 211 bool reverse); |
210 | 212 |
211 // Invoked when the page loses mouse capture. | 213 // Invoked when the page loses mouse capture. |
212 virtual void LostCapture() {} | 214 virtual void LostCapture() {} |
213 | 215 |
214 // Notification that |contents| has gained focus. | 216 // Notification that |contents| has gained focus. |
215 virtual void WebContentsFocused(WebContents* contents) {} | 217 virtual void WebContentsFocused(WebContents* contents) {} |
216 | 218 |
217 // Asks the delegate if the given tab can download. | 219 // Asks the delegate if the given tab can download. |
218 virtual bool CanDownload(RenderViewHost* render_view_host, | 220 virtual bool CanDownload(RenderViewHost* render_view_host, |
219 int request_id, | 221 int request_id, |
(...skipping 19 matching lines...) Expand all Loading... |
239 | 241 |
240 // Opens source view for the given subframe. | 242 // Opens source view for the given subframe. |
241 virtual void ViewSourceForFrame(WebContents* source, | 243 virtual void ViewSourceForFrame(WebContents* source, |
242 const GURL& url, | 244 const GURL& url, |
243 const std::string& content_state); | 245 const std::string& content_state); |
244 | 246 |
245 // Allows delegates to handle keyboard events before sending to the renderer. | 247 // Allows delegates to handle keyboard events before sending to the renderer. |
246 // Returns true if the |event| was handled. Otherwise, if the |event| would be | 248 // Returns true if the |event| was handled. Otherwise, if the |event| would be |
247 // handled in HandleKeyboardEvent() method as a normal keyboard shortcut, | 249 // handled in HandleKeyboardEvent() method as a normal keyboard shortcut, |
248 // |*is_keyboard_shortcut| should be set to true. | 250 // |*is_keyboard_shortcut| should be set to true. |
249 virtual bool PreHandleKeyboardEvent(const NativeWebKeyboardEvent& event, | 251 virtual bool PreHandleKeyboardEvent(WebContents* source, |
| 252 const NativeWebKeyboardEvent& event, |
250 bool* is_keyboard_shortcut); | 253 bool* is_keyboard_shortcut); |
251 | 254 |
252 // Allows delegates to handle unhandled keyboard messages coming back from | 255 // Allows delegates to handle unhandled keyboard messages coming back from |
253 // the renderer. | 256 // the renderer. |
254 virtual void HandleKeyboardEvent(const NativeWebKeyboardEvent& event) {} | 257 virtual void HandleKeyboardEvent(WebContents* source, |
| 258 const NativeWebKeyboardEvent& event) {} |
255 | 259 |
256 virtual void HandleMouseDown() {} | 260 virtual void HandleMouseDown() {} |
257 virtual void HandleMouseUp() {} | 261 virtual void HandleMouseUp() {} |
258 | 262 |
259 // Handles activation resulting from a pointer event (e.g. when mouse is | 263 // Handles activation resulting from a pointer event (e.g. when mouse is |
260 // pressed, or a touch-gesture begins). | 264 // pressed, or a touch-gesture begins). |
261 virtual void HandlePointerActivate() {} | 265 virtual void HandlePointerActivate() {} |
262 | 266 |
263 virtual void HandleGestureBegin() {} | 267 virtual void HandleGestureBegin() {} |
264 virtual void HandleGestureEnd() {} | 268 virtual void HandleGestureEnd() {} |
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
430 // Called when |this| is no longer the WebContentsDelegate for |source|. | 434 // Called when |this| is no longer the WebContentsDelegate for |source|. |
431 void Detach(WebContents* source); | 435 void Detach(WebContents* source); |
432 | 436 |
433 // The WebContents that this is currently a delegate for. | 437 // The WebContents that this is currently a delegate for. |
434 std::set<WebContents*> attached_contents_; | 438 std::set<WebContents*> attached_contents_; |
435 }; | 439 }; |
436 | 440 |
437 } // namespace content | 441 } // namespace content |
438 | 442 |
439 #endif // CONTENT_PUBLIC_BROWSER_WEB_CONTENTS_DELEGATE_H_ | 443 #endif // CONTENT_PUBLIC_BROWSER_WEB_CONTENTS_DELEGATE_H_ |
OLD | NEW |