[email protected] | 3a80ea33 | 2012-01-09 19:53:29 | [diff] [blame] | 1 | // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
[email protected] | 69b04b9 | 2010-11-08 22:12:18 | [diff] [blame] | 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 CHROME_BROWSER_UI_BROWSER_WINDOW_H_ |
| 6 | #define CHROME_BROWSER_UI_BROWSER_WINDOW_H_ |
| 7 | #pragma once |
| 8 | |
[email protected] | fe54b4a | 2012-03-28 16:11:04 | [diff] [blame] | 9 | #include "base/callback_forward.h" |
[email protected] | 2e6389f | 2012-05-18 19:41:25 | [diff] [blame^] | 10 | #include "chrome/browser/lifetime/application_lifetime.h" |
[email protected] | 41d9faf | 2012-02-28 23:46:02 | [diff] [blame] | 11 | #include "chrome/browser/ui/base_window.h" |
[email protected] | 09b2934 | 2011-06-24 19:18:48 | [diff] [blame] | 12 | #include "chrome/browser/ui/bookmarks/bookmark_bar.h" |
[email protected] | 8d944b3 | 2011-10-17 06:11:53 | [diff] [blame] | 13 | #include "chrome/browser/ui/fullscreen_exit_bubble_type.h" |
[email protected] | 69b04b9 | 2010-11-08 22:12:18 | [diff] [blame] | 14 | #include "chrome/common/content_settings_types.h" |
[email protected] | 08397d5 | 2011-02-05 01:53:38 | [diff] [blame] | 15 | #include "ui/gfx/native_widget_types.h" |
[email protected] | 588300d | 2011-04-28 21:06:35 | [diff] [blame] | 16 | #include "webkit/glue/window_open_disposition.h" |
[email protected] | 69b04b9 | 2010-11-08 22:12:18 | [diff] [blame] | 17 | |
| 18 | class Browser; |
| 19 | class BrowserWindowTesting; |
| 20 | class DownloadShelf; |
| 21 | class FindBar; |
| 22 | class GURL; |
[email protected] | 69b04b9 | 2010-11-08 22:12:18 | [diff] [blame] | 23 | class LocationBar; |
| 24 | class Profile; |
| 25 | class StatusBubble; |
[email protected] | 3c9e187 | 2010-11-18 16:17:49 | [diff] [blame] | 26 | class TabContentsWrapper; |
[email protected] | 69b04b9 | 2010-11-08 22:12:18 | [diff] [blame] | 27 | class TemplateURL; |
[email protected] | 69b04b9 | 2010-11-08 22:12:18 | [diff] [blame] | 28 | #if !defined(OS_MACOSX) |
| 29 | class ToolbarView; |
| 30 | #endif |
[email protected] | 69b04b9 | 2010-11-08 22:12:18 | [diff] [blame] | 31 | |
[email protected] | ea049a0 | 2011-12-25 21:37:09 | [diff] [blame] | 32 | namespace content { |
| 33 | class WebContents; |
[email protected] | b87ee52 | 2012-05-18 15:16:54 | [diff] [blame] | 34 | struct NativeWebKeyboardEvent; |
[email protected] | d583e3f2 | 2011-12-27 21:38:17 | [diff] [blame] | 35 | struct SSLStatus; |
[email protected] | ea049a0 | 2011-12-25 21:37:09 | [diff] [blame] | 36 | } |
| 37 | |
[email protected] | 69b04b9 | 2010-11-08 22:12:18 | [diff] [blame] | 38 | namespace gfx { |
| 39 | class Rect; |
[email protected] | 0548c535 | 2011-09-07 00:33:33 | [diff] [blame] | 40 | class Size; |
[email protected] | 69b04b9 | 2010-11-08 22:12:18 | [diff] [blame] | 41 | } |
| 42 | |
[email protected] | a3b734b | 2010-11-30 03:17:11 | [diff] [blame] | 43 | class Extension; |
| 44 | |
[email protected] | 853e16eb | 2011-12-29 16:58:19 | [diff] [blame] | 45 | enum DevToolsDockSide { |
| 46 | DEVTOOLS_DOCK_SIDE_BOTTOM = 0, |
| 47 | DEVTOOLS_DOCK_SIDE_RIGHT = 1 |
| 48 | }; |
| 49 | |
[email protected] | 69b04b9 | 2010-11-08 22:12:18 | [diff] [blame] | 50 | //////////////////////////////////////////////////////////////////////////////// |
| 51 | // BrowserWindow interface |
| 52 | // An interface implemented by the "view" of the Browser window. |
[email protected] | 41d9faf | 2012-02-28 23:46:02 | [diff] [blame] | 53 | // This interface includes BaseWindow methods as well as Browser window |
| 54 | // specific methods. |
[email protected] | 69b04b9 | 2010-11-08 22:12:18 | [diff] [blame] | 55 | // |
| 56 | // NOTE: All getters may return NULL. |
[email protected] | 41d9faf | 2012-02-28 23:46:02 | [diff] [blame] | 57 | // |
| 58 | class BrowserWindow : public BaseWindow { |
[email protected] | 69b04b9 | 2010-11-08 22:12:18 | [diff] [blame] | 59 | public: |
[email protected] | ed2f2713 | 2011-04-04 17:19:57 | [diff] [blame] | 60 | virtual ~BrowserWindow() {} |
| 61 | |
[email protected] | 41d9faf | 2012-02-28 23:46:02 | [diff] [blame] | 62 | ////////////////////////////////////////////////////////////////////////////// |
| 63 | // BaseWindow interface notes: |
[email protected] | 69b04b9 | 2010-11-08 22:12:18 | [diff] [blame] | 64 | |
[email protected] | 41d9faf | 2012-02-28 23:46:02 | [diff] [blame] | 65 | // Closes the window as soon as possible. If the window is not in a drag |
[email protected] | 69b04b9 | 2010-11-08 22:12:18 | [diff] [blame] | 66 | // session, it will close immediately; otherwise, it will move offscreen (so |
| 67 | // events are still fired) until the drag ends, then close. This assumes |
| 68 | // that the Browser is not immediately destroyed, but will be eventually |
| 69 | // destroyed by other means (eg, the tab strip going to zero elements). |
| 70 | // Bad things happen if the Browser dtor is called directly as a result of |
| 71 | // invoking this method. |
[email protected] | 41d9faf | 2012-02-28 23:46:02 | [diff] [blame] | 72 | // virtual void Close() = 0; |
[email protected] | 69b04b9 | 2010-11-08 22:12:18 | [diff] [blame] | 73 | |
[email protected] | 41d9faf | 2012-02-28 23:46:02 | [diff] [blame] | 74 | // Browser::OnWindowDidShow should be called after showing the window. |
| 75 | // virtual void Show() = 0; |
[email protected] | 69b04b9 | 2010-11-08 22:12:18 | [diff] [blame] | 76 | |
[email protected] | 1443fe8 | 2012-04-02 08:48:03 | [diff] [blame] | 77 | // No BrowserWindow supports this BaseWindow function. |
| 78 | virtual void SetDraggableRegion(SkRegion* region) OVERRIDE {} |
| 79 | |
[email protected] | 41d9faf | 2012-02-28 23:46:02 | [diff] [blame] | 80 | ////////////////////////////////////////////////////////////////////////////// |
| 81 | // Browser specific methods: |
[email protected] | 69b04b9 | 2010-11-08 22:12:18 | [diff] [blame] | 82 | |
| 83 | // Return a platform dependent identifier for this frame. On Windows, this |
| 84 | // returns an HWND. |
| 85 | virtual gfx::NativeWindow GetNativeHandle() = 0; |
| 86 | |
| 87 | // Returns a pointer to the testing interface to the Browser window, or NULL |
| 88 | // if there is none. |
| 89 | virtual BrowserWindowTesting* GetBrowserWindowTesting() = 0; |
| 90 | |
| 91 | // Return the status bubble associated with the frame |
| 92 | virtual StatusBubble* GetStatusBubble() = 0; |
| 93 | |
| 94 | // Inform the receiving frame that an animation has progressed in the |
| 95 | // selected tab. |
| 96 | // TODO(beng): Remove. Infobars/Boomarks bars should talk directly to |
| 97 | // BrowserView. |
[email protected] | c9bd2e8 | 2011-04-15 23:28:19 | [diff] [blame] | 98 | virtual void ToolbarSizeChanged(bool is_animating) = 0; |
[email protected] | 69b04b9 | 2010-11-08 22:12:18 | [diff] [blame] | 99 | |
| 100 | // Inform the frame that the selected tab favicon or title has changed. Some |
| 101 | // frames may need to refresh their title bar. |
| 102 | virtual void UpdateTitleBar() = 0; |
| 103 | |
[email protected] | 09b2934 | 2011-06-24 19:18:48 | [diff] [blame] | 104 | // Invoked when the state of the bookmark bar changes. This is only invoked if |
| 105 | // the state changes for the current tab, it is not sent when switching tabs. |
| 106 | virtual void BookmarkBarStateChanged( |
| 107 | BookmarkBar::AnimateChangeType change_type) = 0; |
[email protected] | 69b04b9 | 2010-11-08 22:12:18 | [diff] [blame] | 108 | |
| 109 | // Inform the frame that the dev tools window for the selected tab has |
| 110 | // changed. |
| 111 | virtual void UpdateDevTools() = 0; |
| 112 | |
[email protected] | 853e16eb | 2011-12-29 16:58:19 | [diff] [blame] | 113 | // Requests that the docked dev tools window changes its dock mode. |
| 114 | virtual void SetDevToolsDockSide(DevToolsDockSide side) = 0; |
| 115 | |
[email protected] | 69b04b9 | 2010-11-08 22:12:18 | [diff] [blame] | 116 | // Update any loading animations running in the window. |should_animate| is |
| 117 | // true if there are tabs loading and the animations should continue, false |
| 118 | // if there are no active loads and the animations should end. |
| 119 | virtual void UpdateLoadingAnimations(bool should_animate) = 0; |
| 120 | |
| 121 | // Sets the starred state for the current tab. |
| 122 | virtual void SetStarredState(bool is_starred) = 0; |
| 123 | |
[email protected] | 69b04b9 | 2010-11-08 22:12:18 | [diff] [blame] | 124 | // Accessors for fullscreen mode state. |
[email protected] | 8d944b3 | 2011-10-17 06:11:53 | [diff] [blame] | 125 | virtual void EnterFullscreen(const GURL& url, |
| 126 | FullscreenExitBubbleType bubble_type) = 0; |
[email protected] | 55c87fa | 2011-10-15 07:28:28 | [diff] [blame] | 127 | virtual void ExitFullscreen() = 0; |
[email protected] | 8d944b3 | 2011-10-17 06:11:53 | [diff] [blame] | 128 | virtual void UpdateFullscreenExitBubbleContent( |
| 129 | const GURL& url, |
| 130 | FullscreenExitBubbleType bubble_type) = 0; |
[email protected] | 69b04b9 | 2010-11-08 22:12:18 | [diff] [blame] | 131 | |
| 132 | // Returns true if the fullscreen bubble is visible. |
| 133 | virtual bool IsFullscreenBubbleVisible() const = 0; |
| 134 | |
| 135 | // Returns the location bar. |
| 136 | virtual LocationBar* GetLocationBar() const = 0; |
| 137 | |
| 138 | // Tries to focus the location bar. Clears the window focus (to avoid |
| 139 | // inconsistent state) if this fails. |
| 140 | virtual void SetFocusToLocationBar(bool select_all) = 0; |
| 141 | |
| 142 | // Informs the view whether or not a load is in progress for the current tab. |
| 143 | // The view can use this notification to update the reload/stop button. |
| 144 | virtual void UpdateReloadStopState(bool is_loading, bool force) = 0; |
| 145 | |
| 146 | // Updates the toolbar with the state for the specified |contents|. |
[email protected] | 3c9e187 | 2010-11-18 16:17:49 | [diff] [blame] | 147 | virtual void UpdateToolbar(TabContentsWrapper* contents, |
[email protected] | 69b04b9 | 2010-11-08 22:12:18 | [diff] [blame] | 148 | bool should_restore_state) = 0; |
| 149 | |
| 150 | // Focuses the toolbar (for accessibility). |
| 151 | virtual void FocusToolbar() = 0; |
| 152 | |
| 153 | // Focuses the app menu like it was a menu bar. |
| 154 | // |
| 155 | // Not used on the Mac, which has a "normal" menu bar. |
| 156 | virtual void FocusAppMenu() = 0; |
| 157 | |
| 158 | // Focuses the bookmarks toolbar (for accessibility). |
| 159 | virtual void FocusBookmarksToolbar() = 0; |
| 160 | |
[email protected] | 69b04b9 | 2010-11-08 22:12:18 | [diff] [blame] | 161 | // Moves keyboard focus to the next pane. |
| 162 | virtual void RotatePaneFocus(bool forwards) = 0; |
| 163 | |
| 164 | // Returns whether the bookmark bar is visible or not. |
| 165 | virtual bool IsBookmarkBarVisible() const = 0; |
| 166 | |
| 167 | // Returns whether the bookmark bar is animating or not. |
| 168 | virtual bool IsBookmarkBarAnimating() const = 0; |
| 169 | |
[email protected] | 95bf8a5b | 2010-12-22 16:04:07 | [diff] [blame] | 170 | // Returns whether the tab strip is editable (for extensions). |
| 171 | virtual bool IsTabStripEditable() const = 0; |
| 172 | |
[email protected] | 69b04b9 | 2010-11-08 22:12:18 | [diff] [blame] | 173 | // Returns whether the tool bar is visible or not. |
| 174 | virtual bool IsToolbarVisible() const = 0; |
| 175 | |
[email protected] | b7a756d4 | 2012-01-23 18:08:17 | [diff] [blame] | 176 | // Returns the rect where the resize corner should be drawn by the render |
| 177 | // widget host view (on top of what the renderer returns). We return an empty |
| 178 | // rect to identify that there shouldn't be a resize corner (in the cases |
| 179 | // where we take care of it ourselves at the browser level). |
| 180 | virtual gfx::Rect GetRootWindowResizerRect() const = 0; |
| 181 | |
[email protected] | 5f58c2af | 2012-01-11 17:55:29 | [diff] [blame] | 182 | // Returns whether the window is a panel. This is not always synonomous |
| 183 | // with the associated browser having type panel since some environments |
| 184 | // may draw popups in panel windows. |
| 185 | virtual bool IsPanel() const = 0; |
| 186 | |
[email protected] | 69b04b9 | 2010-11-08 22:12:18 | [diff] [blame] | 187 | // Tells the frame not to render as inactive until the next activation change. |
| 188 | // This is required on Windows when dropdown selects are shown to prevent the |
| 189 | // select from deactivating the browser frame. A stub implementation is |
| 190 | // provided here since the functionality is Windows-specific. |
| 191 | virtual void DisableInactiveFrame() {} |
| 192 | |
[email protected] | 69b04b9 | 2010-11-08 22:12:18 | [diff] [blame] | 193 | // Shows a confirmation dialog box for adding a search engine described by |
| 194 | // |template_url|. Takes ownership of |template_url|. |
[email protected] | 3613347d | 2012-04-27 20:27:37 | [diff] [blame] | 195 | virtual void ConfirmAddSearchProvider(TemplateURL* template_url, |
[email protected] | 69b04b9 | 2010-11-08 22:12:18 | [diff] [blame] | 196 | Profile* profile) = 0; |
| 197 | |
| 198 | // Shows or hides the bookmark bar depending on its current visibility. |
| 199 | virtual void ToggleBookmarkBar() = 0; |
| 200 | |
| 201 | // Shows the About Chrome dialog box. |
[email protected] | 4c6b474b7 | 2011-02-24 21:35:21 | [diff] [blame] | 202 | virtual void ShowAboutChromeDialog() = 0; |
[email protected] | 69b04b9 | 2010-11-08 22:12:18 | [diff] [blame] | 203 | |
| 204 | // Shows the Update Recommended dialog box. |
| 205 | virtual void ShowUpdateChromeDialog() = 0; |
| 206 | |
| 207 | // Shows the Task manager. |
| 208 | virtual void ShowTaskManager() = 0; |
| 209 | |
[email protected] | adb6a84d | 2011-02-07 16:58:40 | [diff] [blame] | 210 | // Shows task information related to background pages. |
| 211 | virtual void ShowBackgroundPages() = 0; |
| 212 | |
[email protected] | 69b04b9 | 2010-11-08 22:12:18 | [diff] [blame] | 213 | // Shows the Bookmark bubble. |url| is the URL being bookmarked, |
| 214 | // |already_bookmarked| is true if the url is already bookmarked. |
| 215 | virtual void ShowBookmarkBubble(const GURL& url, bool already_bookmarked) = 0; |
| 216 | |
[email protected] | b106ca5 | 2012-03-13 06:08:46 | [diff] [blame] | 217 | // Shows the Chrome To Mobile bubble. |
| 218 | virtual void ShowChromeToMobileBubble() = 0; |
| 219 | |
[email protected] | 235a056 | 2012-03-26 22:22:35 | [diff] [blame] | 220 | #if defined(ENABLE_ONE_CLICK_SIGNIN) |
[email protected] | fe54b4a | 2012-03-28 16:11:04 | [diff] [blame] | 221 | // Shows the one-click sign in bubble. The given closures are run |
| 222 | // when their corresponding links are clicked. |
| 223 | virtual void ShowOneClickSigninBubble( |
| 224 | const base::Closure& learn_more_callback, |
| 225 | const base::Closure& advanced_callback) = 0; |
[email protected] | 235a056 | 2012-03-26 22:22:35 | [diff] [blame] | 226 | #endif |
| 227 | |
[email protected] | 69b04b9 | 2010-11-08 22:12:18 | [diff] [blame] | 228 | // Whether or not the shelf view is visible. |
| 229 | virtual bool IsDownloadShelfVisible() const = 0; |
| 230 | |
| 231 | // Returns the DownloadShelf. |
| 232 | virtual DownloadShelf* GetDownloadShelf() = 0; |
| 233 | |
[email protected] | 69b04b9 | 2010-11-08 22:12:18 | [diff] [blame] | 234 | // Shows the confirmation dialog box warning that the browser is closing with |
| 235 | // in-progress downloads. |
| 236 | // This method should call Browser::InProgressDownloadResponse once the user |
| 237 | // has confirmed. |
| 238 | virtual void ConfirmBrowserCloseWithPendingDownloads() = 0; |
| 239 | |
[email protected] | a0ea76c | 2011-03-23 17:36:42 | [diff] [blame] | 240 | // ThemeService calls this when a user has changed his or her theme, |
[email protected] | 69b04b9 | 2010-11-08 22:12:18 | [diff] [blame] | 241 | // indicating that it's time to redraw everything. |
| 242 | virtual void UserChangedTheme() = 0; |
| 243 | |
| 244 | // Get extra vertical height that the render view should add to its requests |
| 245 | // to webkit. This can help prevent sending extraneous layout/repaint requests |
| 246 | // when the delegate is in the process of resizing the tab contents view (e.g. |
| 247 | // during infobar animations). |
| 248 | virtual int GetExtraRenderViewHeight() const = 0; |
| 249 | |
[email protected] | 2a6bc3e | 2011-12-28 23:51:33 | [diff] [blame] | 250 | // Notification that |contents| got the focus through user action (click |
[email protected] | 69b04b9 | 2010-11-08 22:12:18 | [diff] [blame] | 251 | // on the page). |
[email protected] | 2a6bc3e | 2011-12-28 23:51:33 | [diff] [blame] | 252 | virtual void WebContentsFocused(content::WebContents* contents) = 0; |
[email protected] | 69b04b9 | 2010-11-08 22:12:18 | [diff] [blame] | 253 | |
| 254 | // Shows the page info using the specified information. |
| 255 | // |url| is the url of the page/frame the info applies to, |ssl| is the SSL |
| 256 | // information for that page/frame. If |show_history| is true, a section |
| 257 | // showing how many times that URL has been visited is added to the page info. |
| 258 | virtual void ShowPageInfo(Profile* profile, |
| 259 | const GURL& url, |
[email protected] | d583e3f2 | 2011-12-27 21:38:17 | [diff] [blame] | 260 | const content::SSLStatus& ssl, |
[email protected] | 69b04b9 | 2010-11-08 22:12:18 | [diff] [blame] | 261 | bool show_history) = 0; |
| 262 | |
[email protected] | b8e681e8 | 2012-02-20 10:18:47 | [diff] [blame] | 263 | // Shows the website settings using the specified information. |url| is the |
| 264 | // url of the page/frame the info applies to, |ssl| is the SSL information for |
| 265 | // that page/frame. If |show_history| is true, a section showing how many |
| 266 | // times that URL has been visited is added to the page info. |
| 267 | virtual void ShowWebsiteSettings(Profile* profile, |
| 268 | TabContentsWrapper* tab_contents_wrapper, |
| 269 | const GURL& url, |
| 270 | const content::SSLStatus& ssl, |
| 271 | bool show_history) = 0; |
| 272 | |
[email protected] | 69b04b9 | 2010-11-08 22:12:18 | [diff] [blame] | 273 | // Shows the app menu (for accessibility). |
| 274 | virtual void ShowAppMenu() = 0; |
| 275 | |
| 276 | // Allows the BrowserWindow object to handle the specified keyboard event |
| 277 | // before sending it to the renderer. |
| 278 | // Returns true if the |event| was handled. Otherwise, if the |event| would |
| 279 | // be handled in HandleKeyboardEvent() method as a normal keyboard shortcut, |
| 280 | // |*is_keyboard_shortcut| should be set to true. |
[email protected] | b87ee52 | 2012-05-18 15:16:54 | [diff] [blame] | 281 | virtual bool PreHandleKeyboardEvent( |
| 282 | const content::NativeWebKeyboardEvent& event, |
| 283 | bool* is_keyboard_shortcut) = 0; |
[email protected] | 69b04b9 | 2010-11-08 22:12:18 | [diff] [blame] | 284 | |
| 285 | // Allows the BrowserWindow object to handle the specified keyboard event, |
| 286 | // if the renderer did not process it. |
[email protected] | b87ee52 | 2012-05-18 15:16:54 | [diff] [blame] | 287 | virtual void HandleKeyboardEvent( |
| 288 | const content::NativeWebKeyboardEvent& event) = 0; |
[email protected] | 69b04b9 | 2010-11-08 22:12:18 | [diff] [blame] | 289 | |
| 290 | // Shows the create web app shortcut dialog box. |
[email protected] | f847e608 | 2011-03-24 00:08:26 | [diff] [blame] | 291 | virtual void ShowCreateWebAppShortcutsDialog( |
| 292 | TabContentsWrapper* tab_contents) = 0; |
[email protected] | a3b734b | 2010-11-30 03:17:11 | [diff] [blame] | 293 | |
| 294 | // Shows the create chrome app shortcut dialog box. |
| 295 | virtual void ShowCreateChromeAppShortcutsDialog(Profile* profile, |
| 296 | const Extension* app) = 0; |
[email protected] | 69b04b9 | 2010-11-08 22:12:18 | [diff] [blame] | 297 | |
| 298 | // Clipboard commands applied to the whole browser window. |
| 299 | virtual void Cut() = 0; |
| 300 | virtual void Copy() = 0; |
| 301 | virtual void Paste() = 0; |
| 302 | |
[email protected] | 69b04b9 | 2010-11-08 22:12:18 | [diff] [blame] | 303 | #if defined(OS_MACOSX) |
| 304 | // Opens the tabpose view. |
| 305 | virtual void OpenTabpose() = 0; |
[email protected] | d376693 | 2011-08-04 22:18:23 | [diff] [blame] | 306 | |
| 307 | // Sets the presentation mode for the window. If the window is not already in |
| 308 | // fullscreen, also enters fullscreen mode. |
[email protected] | 8d944b3 | 2011-10-17 06:11:53 | [diff] [blame] | 309 | virtual void EnterPresentationMode( |
| 310 | const GURL& url, |
| 311 | FullscreenExitBubbleType bubble_type) = 0; |
| 312 | virtual void ExitPresentationMode() = 0; |
[email protected] | d376693 | 2011-08-04 22:18:23 | [diff] [blame] | 313 | virtual bool InPresentationMode() = 0; |
[email protected] | 69b04b9 | 2010-11-08 22:12:18 | [diff] [blame] | 314 | #endif |
| 315 | |
[email protected] | 69b04b9 | 2010-11-08 22:12:18 | [diff] [blame] | 316 | // Invoked when instant's tab contents should be shown. |
[email protected] | e3690ed | 2011-03-25 20:25:14 | [diff] [blame] | 317 | virtual void ShowInstant(TabContentsWrapper* preview) = 0; |
[email protected] | 69b04b9 | 2010-11-08 22:12:18 | [diff] [blame] | 318 | |
| 319 | // Invoked when the instant's tab contents should be hidden. |
[email protected] | 3e48128 | 2011-10-15 15:39:50 | [diff] [blame] | 320 | virtual void HideInstant() = 0; |
[email protected] | 69b04b9 | 2010-11-08 22:12:18 | [diff] [blame] | 321 | |
| 322 | // Returns the desired bounds for instant in screen coordinates. Note that if |
| 323 | // instant isn't currently visible this returns the bounds instant would be |
| 324 | // placed at. |
| 325 | virtual gfx::Rect GetInstantBounds() = 0; |
| 326 | |
[email protected] | 588300d | 2011-04-28 21:06:35 | [diff] [blame] | 327 | // Return the correct disposition for a popup window based on |bounds|. |
| 328 | virtual WindowOpenDisposition GetDispositionForPopupBounds( |
| 329 | const gfx::Rect& bounds) = 0; |
| 330 | |
[email protected] | 632983f | 2011-08-08 22:51:24 | [diff] [blame] | 331 | // Construct a FindBar implementation for the |browser|. |
| 332 | virtual FindBar* CreateFindBar() = 0; |
| 333 | |
[email protected] | 0548c535 | 2011-09-07 00:33:33 | [diff] [blame] | 334 | // Invoked when the preferred size of the contents in current tab has been |
| 335 | // changed. We might choose to update the window size to accomodate this |
| 336 | // change. |
| 337 | // Note that this won't be fired if we change tabs. |
[email protected] | 2a6bc3e | 2011-12-28 23:51:33 | [diff] [blame] | 338 | virtual void UpdatePreferredSize(content::WebContents* web_contents, |
[email protected] | 0548c535 | 2011-09-07 00:33:33 | [diff] [blame] | 339 | const gfx::Size& pref_size) {} |
| 340 | |
[email protected] | 61e2b3cc | 2012-03-02 16:13:34 | [diff] [blame] | 341 | // Invoked when the contents auto-resized and the container should match it. |
| 342 | virtual void ResizeDueToAutoResize(content::WebContents* web_contents, |
| 343 | const gfx::Size& new_size) {} |
| 344 | |
[email protected] | 69b04b9 | 2010-11-08 22:12:18 | [diff] [blame] | 345 | // Construct a BrowserWindow implementation for the specified |browser|. |
| 346 | static BrowserWindow* CreateBrowserWindow(Browser* browser); |
| 347 | |
[email protected] | 0ec4898e | 2011-12-30 21:09:24 | [diff] [blame] | 348 | // Shows the avatar bubble inside |web_contents|. The bubble is positioned |
| 349 | // relative to |rect|. |rect| should be in the |web_contents| coordinate |
[email protected] | 2f733a0 | 2011-10-06 15:17:34 | [diff] [blame] | 350 | // system. |
[email protected] | 0ec4898e | 2011-12-30 21:09:24 | [diff] [blame] | 351 | virtual void ShowAvatarBubble(content::WebContents* web_contents, |
[email protected] | 2f733a0 | 2011-10-06 15:17:34 | [diff] [blame] | 352 | const gfx::Rect& rect) = 0; |
| 353 | |
[email protected] | 7d2d0815 | 2011-10-25 22:58:47 | [diff] [blame] | 354 | // Shows the avatar bubble on the window frame off of the avatar button. |
| 355 | virtual void ShowAvatarBubbleFromAvatarButton() = 0; |
| 356 | |
[email protected] | 90ee0923 | 2012-03-21 02:01:01 | [diff] [blame] | 357 | // Show bubble for password generation positioned relative to |rect|. A stub |
| 358 | // implementation is provided since this feature is currently only available |
| 359 | // for Windows. |
| 360 | virtual void ShowPasswordGenerationBubble(const gfx::Rect& rect) {} |
| 361 | |
[email protected] | 69b04b9 | 2010-11-08 22:12:18 | [diff] [blame] | 362 | protected: |
[email protected] | 2e6389f | 2012-05-18 19:41:25 | [diff] [blame^] | 363 | friend void browser::CloseAllBrowsers(); |
[email protected] | 69b04b9 | 2010-11-08 22:12:18 | [diff] [blame] | 364 | friend class BrowserView; |
| 365 | virtual void DestroyBrowser() = 0; |
[email protected] | 69b04b9 | 2010-11-08 22:12:18 | [diff] [blame] | 366 | }; |
| 367 | |
| 368 | #if defined(OS_WIN) || defined(TOOLKIT_VIEWS) |
| 369 | class BookmarkBarView; |
| 370 | class LocationBarView; |
| 371 | |
| 372 | namespace views { |
| 373 | class View; |
| 374 | } |
| 375 | #endif // defined(OS_WIN) |
| 376 | |
| 377 | // A BrowserWindow utility interface used for accessing elements of the browser |
| 378 | // UI used only by UI test automation. |
| 379 | class BrowserWindowTesting { |
| 380 | public: |
| 381 | #if defined(OS_WIN) || defined(TOOLKIT_VIEWS) |
| 382 | // Returns the BookmarkBarView. |
| 383 | virtual BookmarkBarView* GetBookmarkBarView() const = 0; |
| 384 | |
| 385 | // Returns the LocationBarView. |
| 386 | virtual LocationBarView* GetLocationBarView() const = 0; |
| 387 | |
| 388 | // Returns the TabContentsContainer. |
| 389 | virtual views::View* GetTabContentsContainerView() const = 0; |
| 390 | |
[email protected] | 69b04b9 | 2010-11-08 22:12:18 | [diff] [blame] | 391 | // Returns the ToolbarView. |
| 392 | virtual ToolbarView* GetToolbarView() const = 0; |
| 393 | #endif |
| 394 | |
| 395 | protected: |
| 396 | virtual ~BrowserWindowTesting() {} |
| 397 | }; |
| 398 | |
| 399 | #endif // CHROME_BROWSER_UI_BROWSER_WINDOW_H_ |