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