Add ENABLE_MEDIA_ROUTER define to builds other than Android and iOS.
[chromium-blink-merge.git] / chrome / browser / ui / views / frame / browser_view.h
blob13f52f3ee6f93ff1d7392f2c700968e7b2163034
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef CHROME_BROWSER_UI_VIEWS_FRAME_BROWSER_VIEW_H_
6 #define CHROME_BROWSER_UI_VIEWS_FRAME_BROWSER_VIEW_H_
8 #include <map>
9 #include <string>
10 #include <vector>
12 #include "base/compiler_specific.h"
13 #include "base/memory/scoped_ptr.h"
14 #include "base/timer/timer.h"
15 #include "build/build_config.h"
16 #include "chrome/browser/devtools/devtools_window.h"
17 #include "chrome/browser/signin/signin_header_helper.h"
18 #include "chrome/browser/ui/browser.h"
19 #include "chrome/browser/ui/browser_window.h"
20 #include "chrome/browser/ui/exclusive_access/exclusive_access_context.h"
21 #include "chrome/browser/ui/infobar_container_delegate.h"
22 #include "chrome/browser/ui/omnibox/omnibox_popup_model_observer.h"
23 #include "chrome/browser/ui/tabs/tab_strip_model_observer.h"
24 #include "chrome/browser/ui/views/exclusive_access_bubble_views_context.h"
25 #include "chrome/browser/ui/views/frame/browser_frame.h"
26 #include "chrome/browser/ui/views/frame/contents_web_view.h"
27 #include "chrome/browser/ui/views/frame/immersive_mode_controller.h"
28 #include "chrome/browser/ui/views/frame/web_contents_close_handler.h"
29 #include "chrome/browser/ui/views/load_complete_listener.h"
30 #include "ui/base/accelerators/accelerator.h"
31 #include "ui/base/models/simple_menu_model.h"
32 #include "ui/gfx/native_widget_types.h"
33 #include "ui/views/controls/button/button.h"
34 #include "ui/views/controls/webview/unhandled_keyboard_event_handler.h"
35 #include "ui/views/widget/widget_delegate.h"
36 #include "ui/views/widget/widget_observer.h"
37 #include "ui/views/window/client_view.h"
39 #if defined(OS_WIN)
40 #include "chrome/browser/hang_monitor/hung_plugin_action.h"
41 #include "chrome/browser/hang_monitor/hung_window_detector.h"
42 #endif
44 // NOTE: For more information about the objects and files in this directory,
45 // view: http://dev.chromium.org/developers/design-documents/browser-window
47 class BookmarkBarView;
48 class Browser;
49 class BrowserViewLayout;
50 class ContentsLayoutManager;
51 class DownloadShelfView;
52 class ExclusiveAccessBubbleViews;
53 class InfoBarContainerView;
54 class LocationBarView;
55 class PermissionBubbleViewViews;
56 class StatusBubbleViews;
57 class TabStrip;
58 class ToolbarView;
59 class TopContainerView;
60 class WebContentsCloseHandler;
62 #if defined(OS_WIN)
63 class JumpList;
64 #endif
66 namespace extensions {
67 class Extension;
70 namespace views {
71 class AccessiblePaneView;
72 class ExternalFocusTracker;
73 class WebView;
76 ///////////////////////////////////////////////////////////////////////////////
77 // BrowserView
79 // A ClientView subclass that provides the contents of a browser window,
80 // including the TabStrip, toolbars, download shelves, the content area etc.
82 class BrowserView : public BrowserWindow,
83 public TabStripModelObserver,
84 public ui::AcceleratorProvider,
85 public views::WidgetDelegate,
86 public views::WidgetObserver,
87 public views::ClientView,
88 public InfoBarContainerDelegate,
89 public LoadCompleteListener::Delegate,
90 public OmniboxPopupModelObserver,
91 public ExclusiveAccessContext,
92 public ExclusiveAccessBubbleViewsContext {
93 public:
94 // The browser view's class name.
95 static const char kViewClassName[];
97 BrowserView();
98 ~BrowserView() override;
100 // Takes ownership of |browser|.
101 void Init(Browser* browser);
103 void set_frame(BrowserFrame* frame) { frame_ = frame; }
104 BrowserFrame* frame() const { return frame_; }
106 // Returns a pointer to the BrowserView* interface implementation (an
107 // instance of this object, typically) for a given native window, or null if
108 // there is no such association.
110 // Don't use this unless you only have a NativeWindow. In nearly all
111 // situations plumb through browser and use it.
112 static BrowserView* GetBrowserViewForNativeWindow(gfx::NativeWindow window);
114 // Returns the BrowserView used for the specified Browser.
115 static BrowserView* GetBrowserViewForBrowser(const Browser* browser);
117 // Returns a Browser instance of this view.
118 Browser* browser() { return browser_.get(); }
119 const Browser* browser() const { return browser_.get(); }
121 // Initializes (or re-initializes) the status bubble. We try to only create
122 // the bubble once and re-use it for the life of the browser, but certain
123 // events (such as changing enabling/disabling Aero on Win) can force a need
124 // to change some of the bubble's creation parameters.
125 void InitStatusBubble();
127 // Returns the apparent bounds of the toolbar, in BrowserView coordinates.
128 // These differ from |toolbar_.bounds()| in that they match where the toolbar
129 // background image is drawn -- slightly outside the "true" bounds
130 // horizontally. Note that this returns the bounds for the toolbar area.
131 gfx::Rect GetToolbarBounds() const;
133 // Returns the constraining bounding box that should be used to lay out the
134 // FindBar within. This is _not_ the size of the find bar, just the bounding
135 // box it should be laid out within. The coordinate system of the returned
136 // rect is in the coordinate system of the frame, since the FindBar is a child
137 // window.
138 gfx::Rect GetFindBarBoundingBox() const;
140 // Returns the preferred height of the TabStrip. Used to position the OTR
141 // avatar icon.
142 int GetTabStripHeight() const;
144 // Takes some view's origin (relative to this BrowserView) and offsets it such
145 // that it can be used as the source origin for seamlessly tiling the toolbar
146 // background image over that view.
147 gfx::Point OffsetPointForToolbarBackgroundImage(
148 const gfx::Point& point) const;
150 // Container for the tabstrip, toolbar, etc.
151 TopContainerView* top_container() { return top_container_; }
153 // Accessor for the TabStrip.
154 TabStrip* tabstrip() { return tabstrip_; }
156 // Accessor for the Toolbar.
157 ToolbarView* toolbar() { return toolbar_; }
159 // Bookmark bar may be null, for example for pop-ups.
160 BookmarkBarView* bookmark_bar() { return bookmark_bar_view_.get(); }
162 // Returns the do-nothing view which controls the z-order of the find bar
163 // widget relative to views which paint into layers and views which have an
164 // associated NativeView. The presence / visibility of this view is not
165 // indicative of the visibility of the find bar widget or even whether
166 // FindBarController is initialized.
167 View* find_bar_host_view() { return find_bar_host_view_; }
169 // Accessor for the InfobarContainer.
170 InfoBarContainerView* infobar_container() { return infobar_container_; }
172 // Accessor for the FullscreenExitBubbleViews.
173 ExclusiveAccessBubbleViews* exclusive_access_bubble() {
174 return exclusive_access_bubble_.get();
177 // Returns true if various window components are visible.
178 bool IsTabStripVisible() const;
180 // Returns true if the profile associated with this Browser window is
181 // incognito.
182 bool IsOffTheRecord() const;
184 // Returns true if the profile associated with this Browser window is
185 // a guest session.
186 bool IsGuestSession() const;
188 // Returns true if the profile associated with this Browser window is
189 // not off the record or a guest session.
190 bool IsRegularOrGuestSession() const;
192 // Returns true if the non-client view should render an avatar icon.
193 bool ShouldShowAvatar() const;
195 // Provides the containing frame with the accelerator for the specified
196 // command id. This can be used to provide menu item shortcut hints etc.
197 // Returns true if an accelerator was found for the specified |cmd_id|, false
198 // otherwise.
199 bool GetAccelerator(int cmd_id, ui::Accelerator* accelerator) const;
201 // Returns true if the specificed |accelerator| is registered with this view.
202 bool IsAcceleratorRegistered(const ui::Accelerator& accelerator);
204 // Returns the active WebContents. Used by our NonClientView's
205 // TabIconView::TabContentsProvider implementations.
206 // TODO(beng): exposing this here is a bit bogus, since it's only used to
207 // determine loading state. It'd be nicer if we could change this to be
208 // bool IsSelectedTabLoading() const; or something like that. We could even
209 // move it to a WindowDelegate subclass.
210 content::WebContents* GetActiveWebContents() const;
212 // Retrieves the icon to use in the frame to indicate an OTR window.
213 gfx::ImageSkia GetOTRAvatarIcon() const;
215 // Returns true if the Browser object associated with this BrowserView is a
216 // tabbed-type window (i.e. a browser window, not an app or popup).
217 bool IsBrowserTypeNormal() const {
218 return browser_->is_type_tabbed();
221 // See ImmersiveModeController for description.
222 ImmersiveModeController* immersive_mode_controller() const {
223 return immersive_mode_controller_.get();
226 // Restores the focused view. This is also used to set the initial focus
227 // when a new browser window is created.
228 void RestoreFocus();
230 // Called after the widget's fullscreen state is changed without going through
231 // FullscreenController. This method does any processing which was skipped.
232 // Only exiting fullscreen in this way is currently supported.
233 void FullscreenStateChanged();
235 // Overridden from BrowserWindow:
236 void Show() override;
237 void ShowInactive() override;
238 void Hide() override;
239 void SetBounds(const gfx::Rect& bounds) override;
240 void Close() override;
241 void Activate() override;
242 void Deactivate() override;
243 bool IsActive() const override;
244 void FlashFrame(bool flash) override;
245 bool IsAlwaysOnTop() const override;
246 void SetAlwaysOnTop(bool always_on_top) override;
247 gfx::NativeWindow GetNativeWindow() const override;
248 StatusBubble* GetStatusBubble() override;
249 void UpdateTitleBar() override;
250 void BookmarkBarStateChanged(
251 BookmarkBar::AnimateChangeType change_type) override;
252 void UpdateDevTools() override;
253 void UpdateLoadingAnimations(bool should_animate) override;
254 void SetStarredState(bool is_starred) override;
255 void SetTranslateIconToggled(bool is_lit) override;
256 void OnActiveTabChanged(content::WebContents* old_contents,
257 content::WebContents* new_contents,
258 int index,
259 int reason) override;
260 void ZoomChangedForActiveTab(bool can_show_bubble) override;
261 gfx::Rect GetRestoredBounds() const override;
262 ui::WindowShowState GetRestoredState() const override;
263 gfx::Rect GetBounds() const override;
264 bool IsMaximized() const override;
265 bool IsMinimized() const override;
266 void Maximize() override;
267 void Minimize() override;
268 void Restore() override;
269 void EnterFullscreen(const GURL& url,
270 ExclusiveAccessBubbleType bubble_type,
271 bool with_toolbar) override;
272 void ExitFullscreen() override;
273 void UpdateExclusiveAccessExitBubbleContent(
274 const GURL& url,
275 ExclusiveAccessBubbleType bubble_type) override;
276 bool ShouldHideUIForFullscreen() const override;
277 bool IsFullscreen() const override;
278 bool IsFullscreenBubbleVisible() const override;
279 bool SupportsFullscreenWithToolbar() const override;
280 void UpdateFullscreenWithToolbar(bool with_toolbar) override;
281 bool IsFullscreenWithToolbar() const override;
282 #if defined(OS_WIN)
283 void SetMetroSnapMode(bool enable) override;
284 bool IsInMetroSnapMode() const override;
285 #endif // defined(OS_WIN)
286 LocationBar* GetLocationBar() const override;
287 void SetFocusToLocationBar(bool select_all) override;
288 void UpdateReloadStopState(bool is_loading, bool force) override;
289 void UpdateToolbar(content::WebContents* contents) override;
290 void ResetToolbarTabState(content::WebContents* contents) override;
291 void FocusToolbar() override;
292 void ToolbarSizeChanged(bool is_animating) override;
293 void FocusAppMenu() override;
294 void FocusBookmarksToolbar() override;
295 void FocusInfobars() override;
296 void RotatePaneFocus(bool forwards) override;
297 void DestroyBrowser() override;
298 bool IsBookmarkBarVisible() const override;
299 bool IsBookmarkBarAnimating() const override;
300 bool IsTabStripEditable() const override;
301 bool IsToolbarVisible() const override;
302 gfx::Rect GetRootWindowResizerRect() const override;
303 void ConfirmAddSearchProvider(TemplateURL* template_url,
304 Profile* profile) override;
305 void ShowUpdateChromeDialog() override;
306 void ShowBookmarkBubble(const GURL& url, bool already_bookmarked) override;
307 void ShowBookmarkAppBubble(
308 const WebApplicationInfo& web_app_info,
309 const ShowBookmarkAppBubbleCallback& callback) override;
310 void ShowTranslateBubble(content::WebContents* contents,
311 translate::TranslateStep step,
312 translate::TranslateErrors::Type error_type,
313 bool is_user_gesture) override;
314 bool ShowSessionCrashedBubble() override;
315 bool IsProfileResetBubbleSupported() const override;
316 GlobalErrorBubbleViewBase* ShowProfileResetBubble(
317 const base::WeakPtr<ProfileResetGlobalError>& global_error) override;
318 #if defined(ENABLE_ONE_CLICK_SIGNIN)
319 void ShowOneClickSigninBubble(
320 OneClickSigninBubbleType type,
321 const base::string16& email,
322 const base::string16& error_message,
323 const StartSyncCallback& start_sync_callback) override;
324 #endif
325 // TODO(beng): Not an override, move somewhere else.
326 void SetDownloadShelfVisible(bool visible);
327 bool IsDownloadShelfVisible() const override;
328 DownloadShelf* GetDownloadShelf() override;
329 void ConfirmBrowserCloseWithPendingDownloads(
330 int download_count,
331 Browser::DownloadClosePreventionType dialog_type,
332 bool app_modal,
333 const base::Callback<void(bool)>& callback) override;
334 void UserChangedTheme() override;
335 void WebContentsFocused(content::WebContents* contents) override;
336 void ShowWebsiteSettings(Profile* profile,
337 content::WebContents* web_contents,
338 const GURL& url,
339 const content::SSLStatus& ssl) override;
340 void ShowAppMenu() override;
341 bool PreHandleKeyboardEvent(const content::NativeWebKeyboardEvent& event,
342 bool* is_keyboard_shortcut) override;
343 void HandleKeyboardEvent(
344 const content::NativeWebKeyboardEvent& event) override;
345 void Cut() override;
346 void Copy() override;
347 void Paste() override;
348 WindowOpenDisposition GetDispositionForPopupBounds(
349 const gfx::Rect& bounds) override;
350 FindBar* CreateFindBar() override;
351 web_modal::WebContentsModalDialogHost* GetWebContentsModalDialogHost()
352 override;
353 void ShowAvatarBubbleFromAvatarButton(
354 AvatarBubbleMode mode,
355 const signin::ManageAccountsParams& manage_accounts_params) override;
356 int GetRenderViewHeightInsetWithDetachedBookmarkBar() override;
357 void ExecuteExtensionCommand(const extensions::Extension* extension,
358 const extensions::Command& command) override;
359 ExclusiveAccessContext* GetExclusiveAccessContext() override;
361 BookmarkBarView* GetBookmarkBarView() const;
362 LocationBarView* GetLocationBarView() const;
363 views::View* GetTabContentsContainerView() const;
364 ToolbarView* GetToolbarView() const;
366 // Overridden from TabStripModelObserver:
367 void TabInsertedAt(content::WebContents* contents,
368 int index,
369 bool foreground) override;
370 void TabDetachedAt(content::WebContents* contents, int index) override;
371 void TabDeactivated(content::WebContents* contents) override;
372 void TabStripEmpty() override;
373 void WillCloseAllTabs() override;
374 void CloseAllTabsCanceled() override;
376 // Overridden from ui::AcceleratorProvider:
377 bool GetAcceleratorForCommandId(int command_id,
378 ui::Accelerator* accelerator) override;
380 // Overridden from views::WidgetDelegate:
381 bool CanResize() const override;
382 bool CanMaximize() const override;
383 bool CanMinimize() const override;
384 bool CanActivate() const override;
385 base::string16 GetWindowTitle() const override;
386 base::string16 GetAccessibleWindowTitle() const override;
387 views::View* GetInitiallyFocusedView() override;
388 bool ShouldShowWindowTitle() const override;
389 gfx::ImageSkia GetWindowAppIcon() override;
390 gfx::ImageSkia GetWindowIcon() override;
391 bool ShouldShowWindowIcon() const override;
392 bool ExecuteWindowsCommand(int command_id) override;
393 std::string GetWindowName() const override;
394 void SaveWindowPlacement(const gfx::Rect& bounds,
395 ui::WindowShowState show_state) override;
396 bool GetSavedWindowPlacement(const views::Widget* widget,
397 gfx::Rect* bounds,
398 ui::WindowShowState* show_state) const override;
399 views::View* GetContentsView() override;
400 views::ClientView* CreateClientView(views::Widget* widget) override;
401 void OnWindowBeginUserBoundsChange() override;
402 void OnWidgetMove() override;
403 views::Widget* GetWidget() override;
404 const views::Widget* GetWidget() const override;
405 void GetAccessiblePanes(std::vector<View*>* panes) override;
407 // Overridden from views::WidgetObserver:
408 void OnWidgetActivationChanged(views::Widget* widget, bool active) override;
410 // Overridden from views::ClientView:
411 bool CanClose() override;
412 int NonClientHitTest(const gfx::Point& point) override;
413 gfx::Size GetMinimumSize() const override;
415 // InfoBarContainerDelegate:
416 SkColor GetInfoBarSeparatorColor() const override;
417 void InfoBarContainerStateChanged(bool is_animating) override;
418 bool DrawInfoBarArrows(int* x) const override;
420 // Overridden from views::View:
421 const char* GetClassName() const override;
422 void Layout() override;
423 void PaintChildren(const ui::PaintContext& context) override;
424 void ViewHierarchyChanged(
425 const ViewHierarchyChangedDetails& details) override;
426 void ChildPreferredSizeChanged(View* child) override;
427 void GetAccessibleState(ui::AXViewState* state) override;
428 void OnNativeThemeChanged(const ui::NativeTheme* theme) override;
430 // Overridden from ui::AcceleratorTarget:
431 bool AcceleratorPressed(const ui::Accelerator& accelerator) override;
433 // OmniboxPopupModelObserver overrides
434 void OnOmniboxPopupShownOrHidden() override;
436 // ExclusiveAccessContext overrides
437 Profile* GetProfile() override;
438 content::WebContents* GetActiveWebContents() override;
439 void HideDownloadShelf() override;
440 void UnhideDownloadShelf() override;
442 // ExclusiveAccessBubbleViewsContext overrides
443 ExclusiveAccessManager* GetExclusiveAccessManager() override;
444 bool IsImmersiveModeEnabled() override;
445 views::Widget* GetBubbleAssociatedWidget() override;
446 gfx::Rect GetTopContainerBoundsInScreen() override;
448 // Testing interface:
449 views::View* GetContentsContainerForTest() { return contents_container_; }
450 views::WebView* GetContentsWebViewForTest() { return contents_web_view_; }
451 views::WebView* GetDevToolsWebViewForTest() { return devtools_web_view_; }
453 private:
454 // Do not friend BrowserViewLayout. Use the BrowserViewLayoutDelegate
455 // interface to keep these two classes decoupled and testable.
456 friend class BrowserViewLayoutDelegateImpl;
457 FRIEND_TEST_ALL_PREFIXES(BrowserViewTest, BrowserView);
458 FRIEND_TEST_ALL_PREFIXES(BrowserViewsAccessibilityTest,
459 TestAboutChromeViewAccObj);
461 enum FullscreenMode {
462 NORMAL_FULLSCREEN,
463 METRO_SNAP_FULLSCREEN
466 // Appends to |toolbars| a pointer to each AccessiblePaneView that
467 // can be traversed using F6, in the order they should be traversed.
468 void GetAccessiblePanes(std::vector<views::AccessiblePaneView*>* panes);
470 // Constructs and initializes the child views.
471 void InitViews();
473 // Callback for the loading animation(s) associated with this view.
474 void LoadingAnimationCallback();
476 // LoadCompleteListener::Delegate implementation. Creates and initializes the
477 // |jumplist_| after the first page load.
478 void OnLoadCompleted() override;
480 // Returns the BrowserViewLayout.
481 BrowserViewLayout* GetBrowserViewLayout() const;
483 // Returns the ContentsLayoutManager.
484 ContentsLayoutManager* GetContentsLayoutManager() const;
486 // Prepare to show the Bookmark Bar for the specified WebContents.
487 // Returns true if the Bookmark Bar can be shown (i.e. it's supported for this
488 // Browser type) and there should be a subsequent re-layout to show it.
489 // |contents| can be null.
490 bool MaybeShowBookmarkBar(content::WebContents* contents);
492 // Moves the bookmark bar view to the specified parent, which may be null,
493 // |this|, or |top_container_|. Ensures that |top_container_| stays in front
494 // of |bookmark_bar_view_|.
495 void SetBookmarkBarParent(views::View* new_parent);
497 // Prepare to show an Info Bar for the specified WebContents. Returns
498 // true if there is an Info Bar to show and one is supported for this Browser
499 // type, and there should be a subsequent re-layout to show it.
500 // |contents| can be null.
501 bool MaybeShowInfoBar(content::WebContents* contents);
503 // Updates devtools window for given contents. This method will show docked
504 // devtools window for inspected |web_contents| that has docked devtools
505 // and hide it for null or not inspected |web_contents|. It will also make
506 // sure devtools window size and position are restored for given tab.
507 // This method will not update actual DevTools WebContents, if not
508 // |update_devtools_web_contents|. In this case, manual update is required.
509 void UpdateDevToolsForContents(content::WebContents* web_contents,
510 bool update_devtools_web_contents);
512 // Updates various optional child Views, e.g. Bookmarks Bar, Info Bar or the
513 // Download Shelf in response to a change notification from the specified
514 // |contents|. |contents| can be null. In this case, all optional UI will be
515 // removed.
516 void UpdateUIForContents(content::WebContents* contents);
518 // Invoked to update the necessary things when our fullscreen state changes
519 // to |fullscreen|. On Windows this is invoked immediately when we toggle the
520 // full screen state. On Linux changing the fullscreen state is async, so we
521 // ask the window to change its fullscreen state, then when we get
522 // notification that it succeeded this method is invoked.
523 // If |url| is not empty, it is the URL of the page that requested fullscreen
524 // (via the fullscreen JS API).
525 // |bubble_type| determines what should be shown in the fullscreen exit
526 // bubble.
527 void ProcessFullscreen(bool fullscreen,
528 FullscreenMode mode,
529 const GURL& url,
530 ExclusiveAccessBubbleType bubble_type);
532 // Returns whether immmersive fullscreen should replace fullscreen. This
533 // should only occur for "browser-fullscreen" for tabbed-typed windows (not
534 // for tab-fullscreen and not for app/popup type windows).
535 bool ShouldUseImmersiveFullscreenForUrl(const GURL& url) const;
537 // Copy the accelerator table from the app resources into something we can
538 // use.
539 void LoadAccelerators();
541 // Retrieves the command id for the specified Windows app command.
542 int GetCommandIDForAppCommandID(int app_command_id) const;
544 // Initialize the hung plugin detector.
545 void InitHangMonitor();
547 // Possibly records a user metrics action corresponding to the passed-in
548 // accelerator. Only implemented for Chrome OS, where we're interested in
549 // learning about how frequently the top-row keys are used.
550 void UpdateAcceleratorMetrics(const ui::Accelerator& accelerator,
551 int command_id);
553 // Calls |method| which is either WebContents::Cut, ::Copy, or ::Paste,
554 // first trying the content WebContents, then the devtools WebContents, and
555 // lastly the Views::Textfield if one is focused.
556 void DoCutCopyPaste(void (content::WebContents::*method)(),
557 int command_id);
559 // Calls |method| which is either WebContents::Cut, ::Copy, or ::Paste on
560 // the given WebContents, returning true if it consumed the event.
561 bool DoCutCopyPasteForWebContents(
562 content::WebContents* contents,
563 void (content::WebContents::*method)());
565 // Shows the next app-modal dialog box, if there is one to be shown, or moves
566 // an existing showing one to the front.
567 void ActivateAppModalDialog() const;
569 // Returns the max top arrow height for infobar.
570 int GetMaxTopInfoBarArrowHeight();
572 // Last focused view that issued a tab traversal.
573 int last_focused_view_storage_id_;
575 // The BrowserFrame that hosts this view.
576 BrowserFrame* frame_;
578 // The Browser object we are associated with.
579 scoped_ptr<Browser> browser_;
581 // BrowserView layout (LTR one is pictured here).
583 // --------------------------------------------------------------------
584 // | TopContainerView (top_container_) |
585 // | -------------------------------------------------------------- |
586 // | | Tabs (tabstrip_) | |
587 // | |------------------------------------------------------------| |
588 // | | Navigation buttons, address bar, menu (toolbar_) | |
589 // | -------------------------------------------------------------- |
590 // |------------------------------------------------------------------|
591 // | All infobars (infobar_container_) [1] |
592 // |------------------------------------------------------------------|
593 // | Bookmarks (bookmark_bar_view_) [1] |
594 // |------------------------------------------------------------------|
595 // | Contents container (contents_container_) |
596 // | -------------------------------------------------------------- |
597 // | | devtools_web_view_ | |
598 // | |------------------------------------------------------------| |
599 // | | contents_web_view_ | |
600 // | -------------------------------------------------------------- |
601 // |------------------------------------------------------------------|
602 // | Active downloads (download_shelf_) |
603 // --------------------------------------------------------------------
605 // [1] The bookmark bar and info bar are swapped when on the new tab page.
606 // Additionally when the bookmark bar is detached, contents_container_ is
607 // positioned on top of the bar while the tab's contents are placed below
608 // the bar. This allows the find bar to always align with the top of
609 // contents_container_ regardless if there's bookmark or info bars.
611 // The view that manages the tab strip, toolbar, and sometimes the bookmark
612 // bar. Stacked top in the view hiearachy so it can be used to slide out
613 // the top views in immersive fullscreen.
614 TopContainerView* top_container_;
616 // The TabStrip.
617 TabStrip* tabstrip_;
619 // The Toolbar containing the navigation buttons, menus and the address bar.
620 ToolbarView* toolbar_;
622 // The Bookmark Bar View for this window. Lazily created. May be null for
623 // non-tabbed browsers like popups. May not be visible.
624 scoped_ptr<BookmarkBarView> bookmark_bar_view_;
626 // The do-nothing view which controls the z-order of the find bar widget
627 // relative to views which paint into layers and views with an associated
628 // NativeView.
629 View* find_bar_host_view_;
631 // The download shelf view (view at the bottom of the page).
632 scoped_ptr<DownloadShelfView> download_shelf_;
634 // The InfoBarContainerView that contains InfoBars for the current tab.
635 InfoBarContainerView* infobar_container_;
637 // The view that contains the selected WebContents.
638 ContentsWebView* contents_web_view_;
640 // The view that contains devtools window for the selected WebContents.
641 views::WebView* devtools_web_view_;
643 // The view managing the devtools and contents positions.
644 // Handled by ContentsLayoutManager.
645 views::View* contents_container_;
647 // Tracks and stores the last focused view which is not the
648 // devtools_web_view_ or any of its children. Used to restore focus once
649 // the devtools_web_view_ is hidden.
650 scoped_ptr<views::ExternalFocusTracker> devtools_focus_tracker_;
652 // The Status information bubble that appears at the bottom of the window.
653 scoped_ptr<StatusBubbleViews> status_bubble_;
655 // The permission bubble view is the toolkit-specific implementation of the
656 // interface used by the manager to display permissions bubbles.
657 scoped_ptr<PermissionBubbleViewViews> permission_bubble_;
659 // A mapping between accelerators and commands.
660 std::map<ui::Accelerator, int> accelerator_table_;
662 // True if we have already been initialized.
663 bool initialized_;
665 // True when in ProcessFullscreen(). The flag is used to avoid reentrance and
666 // to ignore requests to layout while in ProcessFullscreen() to reduce
667 // jankiness.
668 bool in_process_fullscreen_;
670 scoped_ptr<ExclusiveAccessBubbleViews> exclusive_access_bubble_;
672 #if defined(OS_WIN)
673 // This object is used to perform periodic actions in a worker
674 // thread. It is currently used to monitor hung plugin windows.
675 WorkerThreadTicker ticker_;
677 // This object is initialized with the frame window HWND. This
678 // object is also passed as a tick handler with the ticker_ object.
679 // It is used to periodically monitor for hung plugin windows
680 HungWindowDetector hung_window_detector_;
682 // This object is invoked by hung_window_detector_ when it detects a hung
683 // plugin window.
684 HungPluginAction hung_plugin_action_;
686 // Helper class to listen for completion of first page load.
687 scoped_ptr<LoadCompleteListener> load_complete_listener_;
689 // The custom JumpList for Windows 7.
690 scoped_refptr<JumpList> jumplist_;
691 #endif
693 // The timer used to update frames for the Loading Animation.
694 base::RepeatingTimer<BrowserView> loading_animation_timer_;
696 views::UnhandledKeyboardEventHandler unhandled_keyboard_event_handler_;
698 // Used to measure the loading spinner animation rate.
699 base::TimeTicks last_animation_time_;
701 // If this flag is set then SetFocusToLocationBar() will set focus to the
702 // location bar even if the browser window is not active.
703 bool force_location_bar_focus_;
705 scoped_ptr<ImmersiveModeController> immersive_mode_controller_;
707 scoped_ptr<WebContentsCloseHandler> web_contents_close_handler_;
709 mutable base::WeakPtrFactory<BrowserView> activate_modal_dialog_factory_;
711 DISALLOW_COPY_AND_ASSIGN(BrowserView);
714 #endif // CHROME_BROWSER_UI_VIEWS_FRAME_BROWSER_VIEW_H_