blob: 2d1669cefc28e17b24371950a2890d15c097eef6 [file] [log] [blame]
[email protected]4fdf6742012-01-10 20:14:361// Copyright (c) 2012 The Chromium Authors. All rights reserved.
[email protected]0dd3a0ab2011-02-18 08:17:442// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
[email protected]674bc592011-12-20 23:00:425#ifndef CONTENT_PUBLIC_BROWSER_WEB_CONTENTS_DELEGATE_H_
6#define CONTENT_PUBLIC_BROWSER_WEB_CONTENTS_DELEGATE_H_
[email protected]0dd3a0ab2011-02-18 08:17:447#pragma once
8
[email protected]1de2b8b2011-06-29 19:38:469#include <set>
[email protected]0dd3a0ab2011-02-18 08:17:4410#include <string>
[email protected]0dd3a0ab2011-02-18 08:17:4411
12#include "base/basictypes.h"
[email protected]d583e3f22011-12-27 21:38:1713#include "base/string16.h"
[email protected]8d128d62011-09-13 22:11:5714#include "content/common/content_export.h"
[email protected]e6e646d2011-12-01 00:50:1115#include "content/public/browser/navigation_type.h"
[email protected]2905f742011-10-13 03:51:5816#include "content/public/common/page_transition_types.h"
[email protected]4fdf6742012-01-10 20:14:3617#include "content/public/common/window_container_type.h"
[email protected]da8543762012-03-20 08:52:2018#include "third_party/skia/include/core/SkColor.h"
[email protected]0dd3a0ab2011-02-18 08:17:4419#include "ui/gfx/native_widget_types.h"
20#include "webkit/glue/window_open_disposition.h"
21
[email protected]7dba43dc2011-11-10 01:57:5822class FilePath;
23class GURL;
[email protected]32ded2212011-11-10 18:51:4324class TabContents;
[email protected]7dba43dc2011-11-10 01:57:5825struct NativeWebKeyboardEvent;
[email protected]7dba43dc2011-11-10 01:57:5826
[email protected]32ded2212011-11-10 18:51:4327namespace base {
28class ListValue;
29}
30
[email protected]3ab9cb82011-06-03 18:02:0731namespace content {
[email protected]3d7474ff2011-07-27 17:47:3732class BrowserContext;
[email protected]da8543762012-03-20 08:52:2033class ColorChooser;
[email protected]e582fdd2011-12-20 16:48:1734class DownloadItem;
[email protected]3ab9cb82011-06-03 18:02:0735class JavaScriptDialogCreator;
[email protected]c0c1c622012-03-13 04:51:5436class RenderViewHost;
[email protected]a81343d232011-12-27 07:39:2037class WebContents;
[email protected]0d9989d2011-12-21 20:26:0038class WebIntentsDispatcher;
[email protected]35be7ec2012-02-12 20:42:5139struct ContextMenuParams;
[email protected]e582fdd2011-12-20 16:48:1740struct FileChooserParams;
[email protected]d583e3f22011-12-27 21:38:1741struct SSLStatus;
[email protected]3ab9cb82011-06-03 18:02:0742}
43
[email protected]0dd3a0ab2011-02-18 08:17:4444namespace gfx {
45class Point;
46class Rect;
47class Size;
48}
49
50namespace history {
51class HistoryAddPageArgs;
52}
53
[email protected]ce9751942011-09-21 01:57:2454namespace webkit_glue {
55struct WebIntentData;
56}
57
[email protected]674bc592011-12-20 23:00:4258namespace content {
59
[email protected]e5d549d2011-12-28 01:29:2060struct OpenURLParams;
61
[email protected]0dd3a0ab2011-02-18 08:17:4462// Objects implement this interface to get notified about changes in the
[email protected]2a6bc3e2011-12-28 23:51:3363// WebContents and to provide necessary functionality.
[email protected]674bc592011-12-20 23:00:4264class CONTENT_EXPORT WebContentsDelegate {
[email protected]0dd3a0ab2011-02-18 08:17:4465 public:
[email protected]674bc592011-12-20 23:00:4266 WebContentsDelegate();
[email protected]1de2b8b2011-06-29 19:38:4667
[email protected]e5d549d2011-12-28 01:29:2068 // Opens a new URL inside the passed in WebContents (if source is 0 open
[email protected]0dd3a0ab2011-02-18 08:17:4469 // in the current front-most tab), unless |disposition| indicates the url
70 // should be opened in a new tab or window.
71 //
72 // A NULL source indicates the current tab (callers should probably use
73 // OpenURL() for these cases which does it for you).
[email protected]00c37fc2011-08-02 00:22:5074
[email protected]e5d549d2011-12-28 01:29:2075 // Returns the WebContents the URL is opened in, or NULL if the URL wasn't
[email protected]992e4542011-07-20 23:09:2576 // opened immediately.
[email protected]e5d549d2011-12-28 01:29:2077 virtual WebContents* OpenURLFromTab(WebContents* source,
[email protected]00c37fc2011-08-02 00:22:5078 const OpenURLParams& params);
79
[email protected]0dd3a0ab2011-02-18 08:17:4480 // Called to inform the delegate that the tab content's navigation state
81 // changed. The |changed_flags| indicates the parts of the navigation state
82 // that have been updated, and is any combination of the
[email protected]2a6bc3e2011-12-28 23:51:3383 // |WebContents::InvalidateTypes| bits.
84 virtual void NavigationStateChanged(const WebContents* source,
[email protected]229eb7e2011-12-23 01:04:0885 unsigned changed_flags) {}
[email protected]0dd3a0ab2011-02-18 08:17:4486
[email protected]6c6b02d2011-09-02 03:36:4787 // Adds the navigation request headers to |headers|. Use
[email protected]0dd3a0ab2011-02-18 08:17:4488 // net::HttpUtil::AppendHeaderIfMissing to build the set of headers.
[email protected]229eb7e2011-12-23 01:04:0889 virtual void AddNavigationHeaders(const GURL& url, std::string* headers) {}
[email protected]0dd3a0ab2011-02-18 08:17:4490
[email protected]2a6bc3e2011-12-28 23:51:3391 // Creates a new tab with the already-created WebContents 'new_contents'.
[email protected]0dd3a0ab2011-02-18 08:17:4492 // The window for the added contents should be reparented correctly when this
93 // method returns. If |disposition| is NEW_POPUP, |pos| should hold the
94 // initial position.
[email protected]2a6bc3e2011-12-28 23:51:3395 virtual void AddNewContents(WebContents* source,
96 WebContents* new_contents,
[email protected]0dd3a0ab2011-02-18 08:17:4497 WindowOpenDisposition disposition,
98 const gfx::Rect& initial_pos,
[email protected]229eb7e2011-12-23 01:04:0899 bool user_gesture) {}
[email protected]0dd3a0ab2011-02-18 08:17:44100
101 // Selects the specified contents, bringing its container to the front.
[email protected]2a6bc3e2011-12-28 23:51:33102 virtual void ActivateContents(WebContents* contents) {}
[email protected]0dd3a0ab2011-02-18 08:17:44103
104 // Deactivates the specified contents by deactivating its container and
105 // potentialy moving it to the back of the Z order.
[email protected]2a6bc3e2011-12-28 23:51:33106 virtual void DeactivateContents(WebContents* contents) {}
[email protected]0dd3a0ab2011-02-18 08:17:44107
108 // Notifies the delegate that this contents is starting or is done loading
109 // some resource. The delegate should use this notification to represent
[email protected]2a6bc3e2011-12-28 23:51:33110 // loading feedback. See WebContents::IsLoading()
111 virtual void LoadingStateChanged(WebContents* source) {}
[email protected]0dd3a0ab2011-02-18 08:17:44112
113 // Notifies the delegate that the page has made some progress loading.
114 // |progress| is a value between 0.0 (nothing loaded) to 1.0 (page fully
115 // loaded).
116 // Note that to receive this notification, you must have called
117 // SetReportLoadProgressEnabled(true) in the render view.
[email protected]229eb7e2011-12-23 01:04:08118 virtual void LoadProgressChanged(double progress) {}
[email protected]0dd3a0ab2011-02-18 08:17:44119
[email protected]2a6bc3e2011-12-28 23:51:33120 // Request the delegate to close this web contents, and do whatever cleanup
[email protected]0dd3a0ab2011-02-18 08:17:44121 // it needs to do.
[email protected]a81343d232011-12-27 07:39:20122 virtual void CloseContents(WebContents* source) {}
[email protected]0dd3a0ab2011-02-18 08:17:44123
[email protected]cd9ed79d2011-11-15 19:22:57124 // Informs the delegate that the underlying RenderViewHost has been swapped
125 // out so it can perform any cleanup necessary.
[email protected]2a6bc3e2011-12-28 23:51:33126 virtual void SwappedOut(WebContents* source) {}
[email protected]cd9ed79d2011-11-15 19:22:57127
[email protected]0dd3a0ab2011-02-18 08:17:44128 // Request the delegate to move this tab contents to the specified position
129 // in screen coordinates.
[email protected]2a6bc3e2011-12-28 23:51:33130 virtual void MoveContents(WebContents* source, const gfx::Rect& pos) {}
[email protected]0dd3a0ab2011-02-18 08:17:44131
132 // Causes the delegate to detach |source| and clean up any internal data
133 // pointing to it. After this call ownership of |source| passes to the
134 // caller, and it is safe to call "source->set_delegate(someone_else);".
[email protected]2a6bc3e2011-12-28 23:51:33135 virtual void DetachContents(WebContents* source) {}
[email protected]0dd3a0ab2011-02-18 08:17:44136
[email protected]2a6bc3e2011-12-28 23:51:33137 // Called to determine if the WebContents is contained in a popup window
[email protected]b35b26b32011-05-05 20:35:14138 // or a panel window.
[email protected]2a6bc3e2011-12-28 23:51:33139 virtual bool IsPopupOrPanel(const WebContents* source) const;
[email protected]0dd3a0ab2011-02-18 08:17:44140
[email protected]0dd3a0ab2011-02-18 08:17:44141 // Notification that the target URL has changed.
[email protected]2a6bc3e2011-12-28 23:51:33142 virtual void UpdateTargetURL(WebContents* source,
[email protected]229eb7e2011-12-23 01:04:08143 int32 page_id,
144 const GURL& url) {}
[email protected]0dd3a0ab2011-02-18 08:17:44145
146 // Notification that there was a mouse event, along with the absolute
147 // coordinates of the mouse pointer and whether it was a normal motion event
148 // (otherwise, the pointer left the contents area).
[email protected]2a6bc3e2011-12-28 23:51:33149 virtual void ContentsMouseEvent(WebContents* source,
[email protected]229eb7e2011-12-23 01:04:08150 const gfx::Point& location,
151 bool motion) {}
[email protected]0dd3a0ab2011-02-18 08:17:44152
153 // Request the delegate to change the zoom level of the current tab.
[email protected]229eb7e2011-12-23 01:04:08154 virtual void ContentsZoomChange(bool zoom_in) {}
[email protected]0dd3a0ab2011-02-18 08:17:44155
[email protected]0dd3a0ab2011-02-18 08:17:44156 // Check whether this contents is inside a window dedicated to running a web
157 // application.
158 virtual bool IsApplication() const;
159
160 // Detach the given tab and convert it to a "webapp" view. The tab must be
[email protected]2a6bc3e2011-12-28 23:51:33161 // a WebContents with a valid WebApp set.
162 virtual void ConvertContentsToApplication(WebContents* source) {}
[email protected]0dd3a0ab2011-02-18 08:17:44163
164 // Whether the specified tab can be reloaded.
165 // Reloading can be disabled e. g. for the DevTools window.
[email protected]2a6bc3e2011-12-28 23:51:33166 virtual bool CanReloadContents(WebContents* source) const;
[email protected]0dd3a0ab2011-02-18 08:17:44167
[email protected]b7a756d42012-01-23 18:08:17168 // Return the rect where to display the resize corner, if any, otherwise
169 // an empty rect.
170 virtual gfx::Rect GetRootWindowResizerRect() const;
171
[email protected]0dd3a0ab2011-02-18 08:17:44172 // Invoked prior to showing before unload handler confirmation dialog.
[email protected]229eb7e2011-12-23 01:04:08173 virtual void WillRunBeforeUnloadConfirm() {}
[email protected]0dd3a0ab2011-02-18 08:17:44174
175 // Returns true if javascript dialogs and unload alerts are suppressed.
176 // Default is false.
177 virtual bool ShouldSuppressDialogs();
178
179 // Tells us that we've finished firing this tab's beforeunload event.
180 // The proceed bool tells us whether the user chose to proceed closing the
181 // tab. Returns true if the tab can continue on firing it's unload event.
182 // If we're closing the entire browser, then we'll want to delay firing
183 // unload events until all the beforeunload events have fired.
[email protected]2a6bc3e2011-12-28 23:51:33184 virtual void BeforeUnloadFired(WebContents* tab,
[email protected]0dd3a0ab2011-02-18 08:17:44185 bool proceed,
186 bool* proceed_to_fire_unload);
187
[email protected]0dd3a0ab2011-02-18 08:17:44188 // Sets focus to the location bar or some other place that is appropriate.
189 // This is called when the tab wants to encourage user input, like for the
190 // new tab page.
[email protected]229eb7e2011-12-23 01:04:08191 virtual void SetFocusToLocationBar(bool select_all) {}
[email protected]0dd3a0ab2011-02-18 08:17:44192
193 // Returns whether the page should be focused when transitioning from crashed
194 // to live. Default is true.
195 virtual bool ShouldFocusPageAfterCrash();
196
197 // Called when a popup select is about to be displayed. The delegate can use
198 // this to disable inactive rendering for the frame in the window the select
199 // is opened within if necessary.
[email protected]229eb7e2011-12-23 01:04:08200 virtual void RenderWidgetShowing() {}
[email protected]0dd3a0ab2011-02-18 08:17:44201
202 // This is called when WebKit tells us that it is done tabbing through
[email protected]674bc592011-12-20 23:00:42203 // controls on the page. Provides a way for WebContentsDelegates to handle
[email protected]0dd3a0ab2011-02-18 08:17:44204 // this. Returns true if the delegate successfully handled it.
205 virtual bool TakeFocus(bool reverse);
206
207 // Invoked when the page loses mouse capture.
[email protected]229eb7e2011-12-23 01:04:08208 virtual void LostCapture() {}
[email protected]0dd3a0ab2011-02-18 08:17:44209
[email protected]2a6bc3e2011-12-28 23:51:33210 // Notification that |contents| has gained focus.
211 virtual void WebContentsFocused(WebContents* contents) {}
[email protected]0dd3a0ab2011-02-18 08:17:44212
[email protected]686493142011-07-15 21:47:22213 // Asks the delegate if the given tab can download.
[email protected]c0c1c622012-03-13 04:51:54214 virtual bool CanDownload(RenderViewHost* render_view_host,
215 int request_id,
216 const std::string& request_method);
[email protected]686493142011-07-15 21:47:22217
218 // Notifies the delegate that a download is starting.
[email protected]2a6bc3e2011-12-28 23:51:33219 virtual void OnStartDownload(WebContents* source, DownloadItem* download) {}
[email protected]686493142011-07-15 21:47:22220
[email protected]0dd3a0ab2011-02-18 08:17:44221 // Return much extra vertical space should be allotted to the
222 // render view widget during various animations (e.g. infobar closing).
223 // This is used to make painting look smoother.
224 virtual int GetExtraRenderViewHeight() const;
225
[email protected]0dd3a0ab2011-02-18 08:17:44226 // Returns true if the context menu operation was handled by the delegate.
[email protected]35be7ec2012-02-12 20:42:51227 virtual bool HandleContextMenu(const content::ContextMenuParams& params);
[email protected]0dd3a0ab2011-02-18 08:17:44228
229 // Returns true if the context menu command was handled
230 virtual bool ExecuteContextMenuCommand(int command);
231
[email protected]0dd3a0ab2011-02-18 08:17:44232 // Opens source view for given tab contents that is navigated to the given
233 // page url.
[email protected]2a6bc3e2011-12-28 23:51:33234 virtual void ViewSourceForTab(WebContents* source, const GURL& page_url);
[email protected]0dd3a0ab2011-02-18 08:17:44235
[email protected]932b7a12011-03-09 12:50:27236 // Opens source view for the given subframe.
[email protected]2a6bc3e2011-12-28 23:51:33237 virtual void ViewSourceForFrame(WebContents* source,
[email protected]932b7a12011-03-09 12:50:27238 const GURL& url,
239 const std::string& content_state);
240
[email protected]0dd3a0ab2011-02-18 08:17:44241 // Allows delegates to handle keyboard events before sending to the renderer.
242 // Returns true if the |event| was handled. Otherwise, if the |event| would be
243 // handled in HandleKeyboardEvent() method as a normal keyboard shortcut,
244 // |*is_keyboard_shortcut| should be set to true.
245 virtual bool PreHandleKeyboardEvent(const NativeWebKeyboardEvent& event,
246 bool* is_keyboard_shortcut);
247
248 // Allows delegates to handle unhandled keyboard messages coming back from
249 // the renderer.
[email protected]229eb7e2011-12-23 01:04:08250 virtual void HandleKeyboardEvent(const NativeWebKeyboardEvent& event) {}
[email protected]0dd3a0ab2011-02-18 08:17:44251
[email protected]229eb7e2011-12-23 01:04:08252 virtual void HandleMouseDown() {}
253 virtual void HandleMouseUp() {}
254 virtual void HandleMouseActivate() {}
[email protected]0dd3a0ab2011-02-18 08:17:44255
256 // Render view drag n drop ended.
[email protected]229eb7e2011-12-23 01:04:08257 virtual void DragEnded() {}
[email protected]0dd3a0ab2011-02-18 08:17:44258
259 // Shows the repost form confirmation dialog box.
[email protected]2a6bc3e2011-12-28 23:51:33260 virtual void ShowRepostFormWarningDialog(WebContents* source) {}
[email protected]0dd3a0ab2011-02-18 08:17:44261
[email protected]0dd3a0ab2011-02-18 08:17:44262 // Allows delegate to override navigation to the history entries.
[email protected]2a6bc3e2011-12-28 23:51:33263 // Returns true to allow WebContents to continue with the default processing.
[email protected]0dd3a0ab2011-02-18 08:17:44264 virtual bool OnGoToEntryOffset(int offset);
265
266 // Returns whether this tab contents should add the specified navigation to
267 // history.
268 virtual bool ShouldAddNavigationToHistory(
269 const history::HistoryAddPageArgs& add_page_args,
[email protected]229eb7e2011-12-23 01:04:08270 NavigationType navigation_type);
[email protected]0dd3a0ab2011-02-18 08:17:44271
[email protected]0dd3a0ab2011-02-18 08:17:44272 // Returns the native window framing the view containing the tab contents.
273 virtual gfx::NativeWindow GetFrameNativeWindow();
274
[email protected]4fdf6742012-01-10 20:14:36275 // Allows delegate to control whether a WebContents will be created. Returns
276 // true to allow the creation. Default is to allow it.
277 virtual bool ShouldCreateWebContents(
278 WebContents* web_contents,
279 int route_id,
280 WindowContainerType window_container_type,
281 const string16& frame_name);
282
[email protected]2a6bc3e2011-12-28 23:51:33283 // Notifies the delegate about the creation of a new WebContents. This
[email protected]0dd3a0ab2011-02-18 08:17:44284 // typically happens when popups are created.
[email protected]4fdf6742012-01-10 20:14:36285 virtual void WebContentsCreated(WebContents* source_contents,
286 int64 source_frame_id,
287 const GURL& target_url,
288 WebContents* new_contents) {}
[email protected]0dd3a0ab2011-02-18 08:17:44289
[email protected]0dd3a0ab2011-02-18 08:17:44290 // Notifies the delegate that the content restrictions for this tab has
291 // changed.
[email protected]2a6bc3e2011-12-28 23:51:33292 virtual void ContentRestrictionsChanged(WebContents* source) {}
[email protected]0dd3a0ab2011-02-18 08:17:44293
[email protected]55452902011-06-01 21:57:47294 // Notification that the tab is hung.
[email protected]2a6bc3e2011-12-28 23:51:33295 virtual void RendererUnresponsive(WebContents* source) {}
[email protected]55452902011-06-01 21:57:47296
297 // Notification that the tab is no longer hung.
[email protected]2a6bc3e2011-12-28 23:51:33298 virtual void RendererResponsive(WebContents* source) {}
[email protected]0dd3a0ab2011-02-18 08:17:44299
300 // Notification that a worker associated with this tab has crashed.
[email protected]2a6bc3e2011-12-28 23:51:33301 virtual void WorkerCrashed(WebContents* source) {}
[email protected]0dd3a0ab2011-02-18 08:17:44302
[email protected]09b29342011-06-24 19:18:48303 // Invoked when a main fram navigation occurs.
[email protected]2a6bc3e2011-12-28 23:51:33304 virtual void DidNavigateMainFramePostCommit(WebContents* tab) {}
[email protected]93f230e02011-06-01 14:40:00305
[email protected]09b29342011-06-24 19:18:48306 // Invoked when navigating to a pending entry. When invoked the
307 // NavigationController has configured its pending entry, but it has not yet
308 // been committed.
[email protected]2a6bc3e2011-12-28 23:51:33309 virtual void DidNavigateToPendingEntry(WebContents* tab) {}
[email protected]93f230e02011-06-01 14:40:00310
[email protected]51da7e32012-01-30 19:24:52311 // Returns a pointer to a service to create JavaScript dialogs. May return
312 // NULL in which case dialogs aren't shown.
[email protected]229eb7e2011-12-23 01:04:08313 virtual JavaScriptDialogCreator* GetJavaScriptDialogCreator();
[email protected]3ab9cb82011-06-03 18:02:07314
[email protected]da8543762012-03-20 08:52:20315 // Called when color chooser should open. Returns the opened color chooser.
316 virtual content::ColorChooser* OpenColorChooser(WebContents* tab,
317 int color_chooser_id,
318 const SkColor& color);
319
320 virtual void DidEndColorChooser() {}
321
[email protected]3a29a6e2011-08-24 18:26:21322 // Called when a file selection is to be done.
[email protected]2a6bc3e2011-12-28 23:51:33323 virtual void RunFileChooser(WebContents* tab,
[email protected]229eb7e2011-12-23 01:04:08324 const FileChooserParams& params) {}
[email protected]3a29a6e2011-08-24 18:26:21325
326 // Request to enumerate a directory. This is equivalent to running the file
327 // chooser in directory-enumeration mode and having the user select the given
328 // directory.
[email protected]2a6bc3e2011-12-28 23:51:33329 virtual void EnumerateDirectory(WebContents* tab,
[email protected]229eb7e2011-12-23 01:04:08330 int request_id,
331 const FilePath& path) {}
[email protected]3a29a6e2011-08-24 18:26:21332
[email protected]8a5e0ca2011-08-25 06:30:47333 // Called when the renderer puts a tab into or out of fullscreen mode.
[email protected]2a6bc3e2011-12-28 23:51:33334 virtual void ToggleFullscreenModeForTab(WebContents* tab,
[email protected]229eb7e2011-12-23 01:04:08335 bool enter_fullscreen) {}
[email protected]2a6bc3e2011-12-28 23:51:33336 virtual bool IsFullscreenForTab(const WebContents* tab) const;
[email protected]8a5e0ca2011-08-25 06:30:47337
[email protected]7d189022011-08-25 22:54:20338 // Called when a Javascript out of memory notification is received.
[email protected]2a6bc3e2011-12-28 23:51:33339 virtual void JSOutOfMemory(WebContents* tab) {}
[email protected]7d189022011-08-25 22:54:20340
341 // Register a new handler for URL requests with the given scheme.
[email protected]2a6bc3e2011-12-28 23:51:33342 virtual void RegisterProtocolHandler(WebContents* tab,
[email protected]7d189022011-08-25 22:54:20343 const std::string& protocol,
344 const GURL& url,
[email protected]229eb7e2011-12-23 01:04:08345 const string16& title) {}
[email protected]7d189022011-08-25 22:54:20346
347 // Register a new handler for Intents with the given action and type filter.
[email protected]2a6bc3e2011-12-28 23:51:33348 virtual void RegisterIntentHandler(WebContents* tab,
[email protected]7d189022011-08-25 22:54:20349 const string16& action,
350 const string16& type,
351 const string16& href,
[email protected]63c239322011-10-31 23:56:30352 const string16& title,
[email protected]229eb7e2011-12-23 01:04:08353 const string16& disposition) {}
[email protected]7d189022011-08-25 22:54:20354
[email protected]0b5af6f2012-02-03 23:14:16355 // Web Intents notification handler. See WebIntentsDispatcher for
356 // documentation of callee responsibility for the dispatcher.
[email protected]2a6bc3e2011-12-28 23:51:33357 virtual void WebIntentDispatch(WebContents* tab,
[email protected]229eb7e2011-12-23 01:04:08358 WebIntentsDispatcher* intents_dispatcher);
[email protected]7d189022011-08-25 22:54:20359
[email protected]b888919c2011-09-02 00:32:16360 // Result of string search in the page. This includes the number of matches
361 // found and the selection rect (in screen coordinates) for the string found.
362 // If |final_update| is false, it indicates that more results follow.
[email protected]2a6bc3e2011-12-28 23:51:33363 virtual void FindReply(WebContents* tab,
[email protected]b888919c2011-09-02 00:32:16364 int request_id,
365 int number_of_matches,
366 const gfx::Rect& selection_rect,
367 int active_match_ordinal,
[email protected]229eb7e2011-12-23 01:04:08368 bool final_update) {}
[email protected]b888919c2011-09-02 00:32:16369
[email protected]d952a052011-09-06 18:42:45370 // Notification that a plugin has crashed.
[email protected]2a6bc3e2011-12-28 23:51:33371 virtual void CrashedPlugin(WebContents* tab, const FilePath& plugin_path) {}
[email protected]d952a052011-09-06 18:42:45372
[email protected]0548c5352011-09-07 00:33:33373 // Invoked when the preferred size of the contents has been changed.
[email protected]2a6bc3e2011-12-28 23:51:33374 virtual void UpdatePreferredSize(WebContents* tab,
[email protected]229eb7e2011-12-23 01:04:08375 const gfx::Size& pref_size) {}
[email protected]0548c5352011-09-07 00:33:33376
[email protected]61e2b3cc2012-03-02 16:13:34377 // Invoked when the contents auto-resized and the container should match it.
378 virtual void ResizeDueToAutoResize(WebContents* tab,
379 const gfx::Size& new_size) {}
380
[email protected]32ded2212011-11-10 18:51:43381 // Notification message from HTML UI.
[email protected]2a6bc3e2011-12-28 23:51:33382 virtual void WebUISend(WebContents* tab,
[email protected]32ded2212011-11-10 18:51:43383 const GURL& source_url,
384 const std::string& name,
[email protected]229eb7e2011-12-23 01:04:08385 const base::ListValue& args) {}
[email protected]32ded2212011-11-10 18:51:43386
[email protected]e9621112011-10-17 05:38:37387 // Requests to lock the mouse. Once the request is approved or rejected,
388 // GotResponseToLockMouseRequest() will be called on the requesting tab
389 // contents.
[email protected]2a6bc3e2011-12-28 23:51:33390 virtual void RequestToLockMouse(WebContents* tab) {}
[email protected]e9621112011-10-17 05:38:37391
392 // Notification that the page has lost the mouse lock.
[email protected]229eb7e2011-12-23 01:04:08393 virtual void LostMouseLock() {}
[email protected]e9621112011-10-17 05:38:37394
[email protected]0dd3a0ab2011-02-18 08:17:44395 protected:
[email protected]674bc592011-12-20 23:00:42396 virtual ~WebContentsDelegate();
[email protected]1de2b8b2011-06-29 19:38:46397
398 private:
[email protected]674bc592011-12-20 23:00:42399 friend class ::TabContents;
[email protected]1de2b8b2011-06-29 19:38:46400
[email protected]674bc592011-12-20 23:00:42401 // Called when |this| becomes the WebContentsDelegate for |source|.
[email protected]2a6bc3e2011-12-28 23:51:33402 void Attach(WebContents* source);
[email protected]1de2b8b2011-06-29 19:38:46403
[email protected]674bc592011-12-20 23:00:42404 // Called when |this| is no longer the WebContentsDelegate for |source|.
[email protected]2a6bc3e2011-12-28 23:51:33405 void Detach(WebContents* source);
[email protected]1de2b8b2011-06-29 19:38:46406
[email protected]2a6bc3e2011-12-28 23:51:33407 // The WebContents that this is currently a delegate for.
408 std::set<WebContents*> attached_contents_;
[email protected]0dd3a0ab2011-02-18 08:17:44409};
410
[email protected]674bc592011-12-20 23:00:42411} // namespace content
412
413#endif // CONTENT_PUBLIC_BROWSER_WEB_CONTENTS_DELEGATE_H_