[email protected] | 0dd3a0ab | 2011-02-18 08:17:44 | [diff] [blame] | 1 | // Copyright (c) 2011 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 CONTENT_BROWSER_TAB_CONTENTS_TAB_CONTENTS_DELEGATE_H_ |
| 6 | #define CONTENT_BROWSER_TAB_CONTENTS_TAB_CONTENTS_DELEGATE_H_ |
| 7 | #pragma once |
| 8 | |
[email protected] | 1de2b8b | 2011-06-29 19:38:46 | [diff] [blame] | 9 | #include <set> |
[email protected] | 0dd3a0ab | 2011-02-18 08:17:44 | [diff] [blame] | 10 | #include <string> |
[email protected] | 0dd3a0ab | 2011-02-18 08:17:44 | [diff] [blame] | 11 | |
| 12 | #include "base/basictypes.h" |
[email protected] | 0dd3a0ab | 2011-02-18 08:17:44 | [diff] [blame] | 13 | #include "content/browser/tab_contents/navigation_entry.h" |
[email protected] | 8d128d6 | 2011-09-13 22:11:57 | [diff] [blame] | 14 | #include "content/common/content_export.h" |
[email protected] | 610cbb8 | 2011-10-18 16:35:08 | [diff] [blame] | 15 | #include "content/public/browser/navigation_types.h" |
[email protected] | 2905f74 | 2011-10-13 03:51:58 | [diff] [blame] | 16 | #include "content/public/common/page_transition_types.h" |
[email protected] | 0dd3a0ab | 2011-02-18 08:17:44 | [diff] [blame] | 17 | #include "ui/gfx/native_widget_types.h" |
| 18 | #include "webkit/glue/window_open_disposition.h" |
| 19 | |
[email protected] | 3ab9cb8 | 2011-06-03 18:02:07 | [diff] [blame] | 20 | namespace content { |
[email protected] | 3d7474ff | 2011-07-27 17:47:37 | [diff] [blame] | 21 | class BrowserContext; |
[email protected] | 3ab9cb8 | 2011-06-03 18:02:07 | [diff] [blame] | 22 | class JavaScriptDialogCreator; |
| 23 | } |
| 24 | |
[email protected] | 0dd3a0ab | 2011-02-18 08:17:44 | [diff] [blame] | 25 | namespace gfx { |
| 26 | class Point; |
| 27 | class Rect; |
| 28 | class Size; |
| 29 | } |
| 30 | |
| 31 | namespace history { |
| 32 | class HistoryAddPageArgs; |
| 33 | } |
| 34 | |
[email protected] | ce975194 | 2011-09-21 01:57:24 | [diff] [blame] | 35 | namespace webkit_glue { |
| 36 | struct WebIntentData; |
| 37 | } |
| 38 | |
[email protected] | 0dd3a0ab | 2011-02-18 08:17:44 | [diff] [blame] | 39 | struct ContextMenuParams; |
[email protected] | 00c37fc | 2011-08-02 00:22:50 | [diff] [blame] | 40 | struct OpenURLParams; |
[email protected] | 68649314 | 2011-07-15 21:47:22 | [diff] [blame] | 41 | class DownloadItem; |
[email protected] | 0dd3a0ab | 2011-02-18 08:17:44 | [diff] [blame] | 42 | class GURL; |
| 43 | class HtmlDialogUIDelegate; |
| 44 | struct NativeWebKeyboardEvent; |
[email protected] | 0dd3a0ab | 2011-02-18 08:17:44 | [diff] [blame] | 45 | class RenderViewHost; |
| 46 | class TabContents; |
[email protected] | 3a29a6e | 2011-08-24 18:26:21 | [diff] [blame] | 47 | struct ViewHostMsg_RunFileChooser_Params; |
| 48 | class FilePath; |
[email protected] | 0dd3a0ab | 2011-02-18 08:17:44 | [diff] [blame] | 49 | |
| 50 | // Objects implement this interface to get notified about changes in the |
| 51 | // TabContents and to provide necessary functionality. |
[email protected] | 8d128d6 | 2011-09-13 22:11:57 | [diff] [blame] | 52 | class CONTENT_EXPORT TabContentsDelegate { |
[email protected] | 0dd3a0ab | 2011-02-18 08:17:44 | [diff] [blame] | 53 | public: |
[email protected] | 1de2b8b | 2011-06-29 19:38:46 | [diff] [blame] | 54 | TabContentsDelegate(); |
| 55 | |
[email protected] | 0dd3a0ab | 2011-02-18 08:17:44 | [diff] [blame] | 56 | // Opens a new URL inside the passed in TabContents (if source is 0 open |
| 57 | // in the current front-most tab), unless |disposition| indicates the url |
| 58 | // should be opened in a new tab or window. |
| 59 | // |
| 60 | // A NULL source indicates the current tab (callers should probably use |
| 61 | // OpenURL() for these cases which does it for you). |
[email protected] | 00c37fc | 2011-08-02 00:22:50 | [diff] [blame] | 62 | |
[email protected] | 992e454 | 2011-07-20 23:09:25 | [diff] [blame] | 63 | // Returns the TabContents the URL is opened in, or NULL if the URL wasn't |
| 64 | // opened immediately. |
[email protected] | 00c37fc | 2011-08-02 00:22:50 | [diff] [blame] | 65 | // Deprecated. Please use the two-arguments method instead. |
| 66 | // TODO(adriansc): Remove this method once refactoring changed all call sites. |
[email protected] | 992e454 | 2011-07-20 23:09:25 | [diff] [blame] | 67 | virtual TabContents* OpenURLFromTab(TabContents* source, |
| 68 | const GURL& url, |
| 69 | const GURL& referrer, |
| 70 | WindowOpenDisposition disposition, |
[email protected] | 2905f74 | 2011-10-13 03:51:58 | [diff] [blame] | 71 | content::PageTransition transition); |
[email protected] | 0dd3a0ab | 2011-02-18 08:17:44 | [diff] [blame] | 72 | |
[email protected] | 00c37fc | 2011-08-02 00:22:50 | [diff] [blame] | 73 | virtual TabContents* OpenURLFromTab(TabContents* source, |
| 74 | const OpenURLParams& params); |
| 75 | |
[email protected] | 0dd3a0ab | 2011-02-18 08:17:44 | [diff] [blame] | 76 | // Called to inform the delegate that the tab content's navigation state |
| 77 | // changed. The |changed_flags| indicates the parts of the navigation state |
| 78 | // that have been updated, and is any combination of the |
| 79 | // |TabContents::InvalidateTypes| bits. |
| 80 | virtual void NavigationStateChanged(const TabContents* source, |
[email protected] | bd021ddd2 | 2011-07-01 19:45:54 | [diff] [blame] | 81 | unsigned changed_flags); |
[email protected] | 0dd3a0ab | 2011-02-18 08:17:44 | [diff] [blame] | 82 | |
[email protected] | 6c6b02d | 2011-09-02 03:36:47 | [diff] [blame] | 83 | // Adds the navigation request headers to |headers|. Use |
[email protected] | 0dd3a0ab | 2011-02-18 08:17:44 | [diff] [blame] | 84 | // net::HttpUtil::AppendHeaderIfMissing to build the set of headers. |
[email protected] | 6c6b02d | 2011-09-02 03:36:47 | [diff] [blame] | 85 | virtual void AddNavigationHeaders(const GURL& url, std::string* headers); |
[email protected] | 0dd3a0ab | 2011-02-18 08:17:44 | [diff] [blame] | 86 | |
| 87 | // Creates a new tab with the already-created TabContents 'new_contents'. |
| 88 | // The window for the added contents should be reparented correctly when this |
| 89 | // method returns. If |disposition| is NEW_POPUP, |pos| should hold the |
| 90 | // initial position. |
| 91 | virtual void AddNewContents(TabContents* source, |
| 92 | TabContents* new_contents, |
| 93 | WindowOpenDisposition disposition, |
| 94 | const gfx::Rect& initial_pos, |
[email protected] | bd021ddd2 | 2011-07-01 19:45:54 | [diff] [blame] | 95 | bool user_gesture); |
[email protected] | 0dd3a0ab | 2011-02-18 08:17:44 | [diff] [blame] | 96 | |
| 97 | // Selects the specified contents, bringing its container to the front. |
[email protected] | bd021ddd2 | 2011-07-01 19:45:54 | [diff] [blame] | 98 | virtual void ActivateContents(TabContents* contents); |
[email protected] | 0dd3a0ab | 2011-02-18 08:17:44 | [diff] [blame] | 99 | |
| 100 | // Deactivates the specified contents by deactivating its container and |
| 101 | // potentialy moving it to the back of the Z order. |
[email protected] | bd021ddd2 | 2011-07-01 19:45:54 | [diff] [blame] | 102 | virtual void DeactivateContents(TabContents* contents); |
[email protected] | 0dd3a0ab | 2011-02-18 08:17:44 | [diff] [blame] | 103 | |
| 104 | // Notifies the delegate that this contents is starting or is done loading |
| 105 | // some resource. The delegate should use this notification to represent |
[email protected] | f5d978c | 2011-07-21 14:43:51 | [diff] [blame] | 106 | // loading feedback. See TabContents::IsLoading() |
[email protected] | bd021ddd2 | 2011-07-01 19:45:54 | [diff] [blame] | 107 | virtual void LoadingStateChanged(TabContents* source); |
[email protected] | 0dd3a0ab | 2011-02-18 08:17:44 | [diff] [blame] | 108 | |
| 109 | // Notifies the delegate that the page has made some progress loading. |
| 110 | // |progress| is a value between 0.0 (nothing loaded) to 1.0 (page fully |
| 111 | // loaded). |
| 112 | // Note that to receive this notification, you must have called |
| 113 | // SetReportLoadProgressEnabled(true) in the render view. |
| 114 | virtual void LoadProgressChanged(double progress); |
| 115 | |
| 116 | // Request the delegate to close this tab contents, and do whatever cleanup |
| 117 | // it needs to do. |
[email protected] | bd021ddd2 | 2011-07-01 19:45:54 | [diff] [blame] | 118 | virtual void CloseContents(TabContents* source); |
[email protected] | 0dd3a0ab | 2011-02-18 08:17:44 | [diff] [blame] | 119 | |
| 120 | // Request the delegate to move this tab contents to the specified position |
| 121 | // in screen coordinates. |
[email protected] | bd021ddd2 | 2011-07-01 19:45:54 | [diff] [blame] | 122 | virtual void MoveContents(TabContents* source, const gfx::Rect& pos); |
[email protected] | 0dd3a0ab | 2011-02-18 08:17:44 | [diff] [blame] | 123 | |
| 124 | // Causes the delegate to detach |source| and clean up any internal data |
| 125 | // pointing to it. After this call ownership of |source| passes to the |
| 126 | // caller, and it is safe to call "source->set_delegate(someone_else);". |
| 127 | virtual void DetachContents(TabContents* source); |
| 128 | |
[email protected] | b35b26b3 | 2011-05-05 20:35:14 | [diff] [blame] | 129 | // Called to determine if the TabContents is contained in a popup window |
| 130 | // or a panel window. |
| 131 | virtual bool IsPopupOrPanel(const TabContents* source) const; |
[email protected] | 0dd3a0ab | 2011-02-18 08:17:44 | [diff] [blame] | 132 | |
[email protected] | 0dd3a0ab | 2011-02-18 08:17:44 | [diff] [blame] | 133 | // Notification that the target URL has changed. |
[email protected] | d952a05 | 2011-09-06 18:42:45 | [diff] [blame] | 134 | virtual void UpdateTargetURL(TabContents* source, int32 page_id, |
| 135 | const GURL& url); |
[email protected] | 0dd3a0ab | 2011-02-18 08:17:44 | [diff] [blame] | 136 | |
| 137 | // Notification that there was a mouse event, along with the absolute |
| 138 | // coordinates of the mouse pointer and whether it was a normal motion event |
| 139 | // (otherwise, the pointer left the contents area). |
| 140 | virtual void ContentsMouseEvent( |
| 141 | TabContents* source, const gfx::Point& location, bool motion); |
| 142 | |
| 143 | // Request the delegate to change the zoom level of the current tab. |
| 144 | virtual void ContentsZoomChange(bool zoom_in); |
| 145 | |
[email protected] | 0dd3a0ab | 2011-02-18 08:17:44 | [diff] [blame] | 146 | // Check whether this contents is inside a window dedicated to running a web |
| 147 | // application. |
| 148 | virtual bool IsApplication() const; |
| 149 | |
| 150 | // Detach the given tab and convert it to a "webapp" view. The tab must be |
| 151 | // a TabContents with a valid WebApp set. |
| 152 | virtual void ConvertContentsToApplication(TabContents* source); |
| 153 | |
| 154 | // Whether the specified tab can be reloaded. |
| 155 | // Reloading can be disabled e. g. for the DevTools window. |
| 156 | virtual bool CanReloadContents(TabContents* source) const; |
| 157 | |
[email protected] | 0dd3a0ab | 2011-02-18 08:17:44 | [diff] [blame] | 158 | // Invoked prior to showing before unload handler confirmation dialog. |
| 159 | virtual void WillRunBeforeUnloadConfirm(); |
| 160 | |
| 161 | // Returns true if javascript dialogs and unload alerts are suppressed. |
| 162 | // Default is false. |
| 163 | virtual bool ShouldSuppressDialogs(); |
| 164 | |
| 165 | // Tells us that we've finished firing this tab's beforeunload event. |
| 166 | // The proceed bool tells us whether the user chose to proceed closing the |
| 167 | // tab. Returns true if the tab can continue on firing it's unload event. |
| 168 | // If we're closing the entire browser, then we'll want to delay firing |
| 169 | // unload events until all the beforeunload events have fired. |
| 170 | virtual void BeforeUnloadFired(TabContents* tab, |
| 171 | bool proceed, |
| 172 | bool* proceed_to_fire_unload); |
| 173 | |
[email protected] | 0dd3a0ab | 2011-02-18 08:17:44 | [diff] [blame] | 174 | // Sets focus to the location bar or some other place that is appropriate. |
| 175 | // This is called when the tab wants to encourage user input, like for the |
| 176 | // new tab page. |
| 177 | virtual void SetFocusToLocationBar(bool select_all); |
| 178 | |
| 179 | // Returns whether the page should be focused when transitioning from crashed |
| 180 | // to live. Default is true. |
| 181 | virtual bool ShouldFocusPageAfterCrash(); |
| 182 | |
| 183 | // Called when a popup select is about to be displayed. The delegate can use |
| 184 | // this to disable inactive rendering for the frame in the window the select |
| 185 | // is opened within if necessary. |
| 186 | virtual void RenderWidgetShowing(); |
| 187 | |
| 188 | // This is called when WebKit tells us that it is done tabbing through |
| 189 | // controls on the page. Provides a way for TabContentsDelegates to handle |
| 190 | // this. Returns true if the delegate successfully handled it. |
| 191 | virtual bool TakeFocus(bool reverse); |
| 192 | |
| 193 | // Invoked when the page loses mouse capture. |
| 194 | virtual void LostCapture(); |
| 195 | |
[email protected] | 0dd3a0ab | 2011-02-18 08:17:44 | [diff] [blame] | 196 | // Notification that |tab_contents| has gained focus. |
| 197 | virtual void TabContentsFocused(TabContents* tab_content); |
| 198 | |
[email protected] | 68649314 | 2011-07-15 21:47:22 | [diff] [blame] | 199 | // Asks the delegate if the given tab can download. |
| 200 | virtual bool CanDownload(TabContents* source, int request_id); |
| 201 | |
| 202 | // Notifies the delegate that a download is starting. |
| 203 | virtual void OnStartDownload(TabContents* source, DownloadItem* download); |
| 204 | |
[email protected] | 0dd3a0ab | 2011-02-18 08:17:44 | [diff] [blame] | 205 | // Return much extra vertical space should be allotted to the |
| 206 | // render view widget during various animations (e.g. infobar closing). |
| 207 | // This is used to make painting look smoother. |
| 208 | virtual int GetExtraRenderViewHeight() const; |
| 209 | |
[email protected] | 0dd3a0ab | 2011-02-18 08:17:44 | [diff] [blame] | 210 | // Returns true if the context menu operation was handled by the delegate. |
| 211 | virtual bool HandleContextMenu(const ContextMenuParams& params); |
| 212 | |
| 213 | // Returns true if the context menu command was handled |
| 214 | virtual bool ExecuteContextMenuCommand(int command); |
| 215 | |
| 216 | // Shows the page info using the specified information. |
| 217 | // |url| is the url of the page/frame the info applies to, |ssl| is the SSL |
| 218 | // information for that page/frame. If |show_history| is true, a section |
| 219 | // showing how many times that URL has been visited is added to the page info. |
[email protected] | 3d7474ff | 2011-07-27 17:47:37 | [diff] [blame] | 220 | virtual void ShowPageInfo(content::BrowserContext* browser_context, |
[email protected] | 0dd3a0ab | 2011-02-18 08:17:44 | [diff] [blame] | 221 | const GURL& url, |
| 222 | const NavigationEntry::SSLStatus& ssl, |
| 223 | bool show_history); |
| 224 | |
| 225 | // Opens source view for given tab contents that is navigated to the given |
| 226 | // page url. |
| 227 | virtual void ViewSourceForTab(TabContents* source, const GURL& page_url); |
| 228 | |
[email protected] | 932b7a1 | 2011-03-09 12:50:27 | [diff] [blame] | 229 | // Opens source view for the given subframe. |
| 230 | virtual void ViewSourceForFrame(TabContents* source, |
| 231 | const GURL& url, |
| 232 | const std::string& content_state); |
| 233 | |
[email protected] | 0dd3a0ab | 2011-02-18 08:17:44 | [diff] [blame] | 234 | // Allows delegates to handle keyboard events before sending to the renderer. |
| 235 | // Returns true if the |event| was handled. Otherwise, if the |event| would be |
| 236 | // handled in HandleKeyboardEvent() method as a normal keyboard shortcut, |
| 237 | // |*is_keyboard_shortcut| should be set to true. |
| 238 | virtual bool PreHandleKeyboardEvent(const NativeWebKeyboardEvent& event, |
| 239 | bool* is_keyboard_shortcut); |
| 240 | |
| 241 | // Allows delegates to handle unhandled keyboard messages coming back from |
| 242 | // the renderer. |
| 243 | virtual void HandleKeyboardEvent(const NativeWebKeyboardEvent& event); |
| 244 | |
| 245 | virtual void HandleMouseUp(); |
| 246 | virtual void HandleMouseActivate(); |
| 247 | |
| 248 | // Render view drag n drop ended. |
| 249 | virtual void DragEnded(); |
| 250 | |
| 251 | // Shows the repost form confirmation dialog box. |
| 252 | virtual void ShowRepostFormWarningDialog(TabContents* tab_contents); |
| 253 | |
[email protected] | 0dd3a0ab | 2011-02-18 08:17:44 | [diff] [blame] | 254 | // Allows delegate to override navigation to the history entries. |
| 255 | // Returns true to allow TabContents to continue with the default processing. |
| 256 | virtual bool OnGoToEntryOffset(int offset); |
| 257 | |
| 258 | // Returns whether this tab contents should add the specified navigation to |
| 259 | // history. |
| 260 | virtual bool ShouldAddNavigationToHistory( |
| 261 | const history::HistoryAddPageArgs& add_page_args, |
[email protected] | 610cbb8 | 2011-10-18 16:35:08 | [diff] [blame] | 262 | content::NavigationType navigation_type); |
[email protected] | 0dd3a0ab | 2011-02-18 08:17:44 | [diff] [blame] | 263 | |
[email protected] | 0dd3a0ab | 2011-02-18 08:17:44 | [diff] [blame] | 264 | // Returns the native window framing the view containing the tab contents. |
| 265 | virtual gfx::NativeWindow GetFrameNativeWindow(); |
| 266 | |
| 267 | // Notifies the delegate about the creation of a new TabContents. This |
| 268 | // typically happens when popups are created. |
| 269 | virtual void TabContentsCreated(TabContents* new_contents); |
| 270 | |
[email protected] | 0dd3a0ab | 2011-02-18 08:17:44 | [diff] [blame] | 271 | // Notifies the delegate that the content restrictions for this tab has |
| 272 | // changed. |
| 273 | virtual void ContentRestrictionsChanged(TabContents* source); |
| 274 | |
[email protected] | 5545290 | 2011-06-01 21:57:47 | [diff] [blame] | 275 | // Notification that the tab is hung. |
| 276 | virtual void RendererUnresponsive(TabContents* source); |
| 277 | |
| 278 | // Notification that the tab is no longer hung. |
| 279 | virtual void RendererResponsive(TabContents* source); |
[email protected] | 0dd3a0ab | 2011-02-18 08:17:44 | [diff] [blame] | 280 | |
| 281 | // Notification that a worker associated with this tab has crashed. |
[email protected] | 5545290 | 2011-06-01 21:57:47 | [diff] [blame] | 282 | virtual void WorkerCrashed(TabContents* source); |
[email protected] | 0dd3a0ab | 2011-02-18 08:17:44 | [diff] [blame] | 283 | |
[email protected] | 09b2934 | 2011-06-24 19:18:48 | [diff] [blame] | 284 | // Invoked when a main fram navigation occurs. |
| 285 | virtual void DidNavigateMainFramePostCommit(TabContents* tab); |
[email protected] | 93f230e0 | 2011-06-01 14:40:00 | [diff] [blame] | 286 | |
[email protected] | 09b2934 | 2011-06-24 19:18:48 | [diff] [blame] | 287 | // Invoked when navigating to a pending entry. When invoked the |
| 288 | // NavigationController has configured its pending entry, but it has not yet |
| 289 | // been committed. |
| 290 | virtual void DidNavigateToPendingEntry(TabContents* tab); |
[email protected] | 93f230e0 | 2011-06-01 14:40:00 | [diff] [blame] | 291 | |
[email protected] | 3ab9cb8 | 2011-06-03 18:02:07 | [diff] [blame] | 292 | // Returns a pointer to a service to create JavaScript dialogs. The default |
| 293 | // pointer returned is to a stub service that marks all dialogs as suppressed |
| 294 | // and displays nothing. |
| 295 | virtual content::JavaScriptDialogCreator* GetJavaScriptDialogCreator(); |
| 296 | |
[email protected] | 3a29a6e | 2011-08-24 18:26:21 | [diff] [blame] | 297 | // Called when a file selection is to be done. |
| 298 | virtual void RunFileChooser(TabContents* tab, |
| 299 | const ViewHostMsg_RunFileChooser_Params& params); |
| 300 | |
| 301 | // Request to enumerate a directory. This is equivalent to running the file |
| 302 | // chooser in directory-enumeration mode and having the user select the given |
| 303 | // directory. |
| 304 | virtual void EnumerateDirectory(TabContents* tab, int request_id, |
| 305 | const FilePath& path); |
| 306 | |
[email protected] | 8a5e0ca | 2011-08-25 06:30:47 | [diff] [blame] | 307 | // Called when the renderer puts a tab into or out of fullscreen mode. |
| 308 | virtual void ToggleFullscreenModeForTab(TabContents* tab, |
| 309 | bool enter_fullscreen); |
[email protected] | 5d5f7af | 2011-10-01 01:38:12 | [diff] [blame] | 310 | virtual bool IsFullscreenForTab(const TabContents* tab) const; |
[email protected] | 8a5e0ca | 2011-08-25 06:30:47 | [diff] [blame] | 311 | |
[email protected] | 7d18902 | 2011-08-25 22:54:20 | [diff] [blame] | 312 | // Called when a Javascript out of memory notification is received. |
| 313 | virtual void JSOutOfMemory(TabContents* tab); |
| 314 | |
| 315 | // Register a new handler for URL requests with the given scheme. |
| 316 | virtual void RegisterProtocolHandler(TabContents* tab, |
| 317 | const std::string& protocol, |
| 318 | const GURL& url, |
| 319 | const string16& title); |
| 320 | |
| 321 | // Register a new handler for Intents with the given action and type filter. |
| 322 | virtual void RegisterIntentHandler(TabContents* tab, |
| 323 | const string16& action, |
| 324 | const string16& type, |
| 325 | const string16& href, |
[email protected] | 63c23932 | 2011-10-31 23:56:30 | [diff] [blame^] | 326 | const string16& title, |
| 327 | const string16& disposition); |
[email protected] | 7d18902 | 2011-08-25 22:54:20 | [diff] [blame] | 328 | |
| 329 | // WebIntent notification handler. |
| 330 | virtual void WebIntentDispatch(TabContents* tab, |
| 331 | int routing_id, |
[email protected] | ce975194 | 2011-09-21 01:57:24 | [diff] [blame] | 332 | const webkit_glue::WebIntentData& intent, |
[email protected] | 7d18902 | 2011-08-25 22:54:20 | [diff] [blame] | 333 | int intent_id); |
| 334 | |
[email protected] | b888919c | 2011-09-02 00:32:16 | [diff] [blame] | 335 | // Result of string search in the page. This includes the number of matches |
| 336 | // found and the selection rect (in screen coordinates) for the string found. |
| 337 | // If |final_update| is false, it indicates that more results follow. |
| 338 | virtual void FindReply(TabContents* tab, |
| 339 | int request_id, |
| 340 | int number_of_matches, |
| 341 | const gfx::Rect& selection_rect, |
| 342 | int active_match_ordinal, |
| 343 | bool final_update); |
| 344 | |
[email protected] | d952a05 | 2011-09-06 18:42:45 | [diff] [blame] | 345 | // Notification that a plugin has crashed. |
| 346 | virtual void CrashedPlugin(TabContents* tab, const FilePath& plugin_path); |
| 347 | |
[email protected] | 0548c535 | 2011-09-07 00:33:33 | [diff] [blame] | 348 | // Invoked when the preferred size of the contents has been changed. |
| 349 | virtual void UpdatePreferredSize(TabContents* source, |
| 350 | const gfx::Size& pref_size); |
| 351 | |
[email protected] | e962111 | 2011-10-17 05:38:37 | [diff] [blame] | 352 | // Requests to lock the mouse. Once the request is approved or rejected, |
| 353 | // GotResponseToLockMouseRequest() will be called on the requesting tab |
| 354 | // contents. |
| 355 | virtual void RequestToLockMouse(TabContents* tab); |
| 356 | |
| 357 | // Notification that the page has lost the mouse lock. |
| 358 | virtual void LostMouseLock(); |
| 359 | |
[email protected] | 0dd3a0ab | 2011-02-18 08:17:44 | [diff] [blame] | 360 | protected: |
| 361 | virtual ~TabContentsDelegate(); |
[email protected] | 1de2b8b | 2011-06-29 19:38:46 | [diff] [blame] | 362 | |
| 363 | private: |
| 364 | friend class TabContents; |
| 365 | |
| 366 | // Called when |this| becomes the TabContentsDelegate for |source|. |
| 367 | void Attach(TabContents* source); |
| 368 | |
| 369 | // Called when |this| is no longer the TabContentsDelegate for |source|. |
| 370 | void Detach(TabContents* source); |
| 371 | |
| 372 | // The TabContents that this is currently a delegate for. |
| 373 | std::set<TabContents*> attached_contents_; |
[email protected] | 0dd3a0ab | 2011-02-18 08:17:44 | [diff] [blame] | 374 | }; |
| 375 | |
| 376 | #endif // CONTENT_BROWSER_TAB_CONTENTS_TAB_CONTENTS_DELEGATE_H_ |