15821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// Copyright (c) 2012 The Chromium Authors. All rights reserved.
25821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// Use of this source code is governed by a BSD-style license that can be
35821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// found in the LICENSE file.
45821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
55821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#ifndef CHROME_BROWSER_UI_VIEWS_FRAME_BROWSER_VIEW_H_
65821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#define CHROME_BROWSER_UI_VIEWS_FRAME_BROWSER_VIEW_H_
75821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
85821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include <map>
95821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include <string>
105821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include <vector>
115821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
125821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "base/compiler_specific.h"
135821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "base/memory/scoped_ptr.h"
14eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch#include "base/timer/timer.h"
155821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "build/build_config.h"
162a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)#include "chrome/browser/devtools/devtools_window.h"
17cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)#include "chrome/browser/signin/signin_header_helper.h"
185821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "chrome/browser/ui/browser.h"
195821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "chrome/browser/ui/browser_window.h"
20116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch#include "chrome/browser/ui/browser_window_testing_views.h"
217dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch#include "chrome/browser/ui/omnibox/omnibox_popup_model_observer.h"
225821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "chrome/browser/ui/tabs/tab_strip_model_observer.h"
235821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "chrome/browser/ui/views/frame/browser_frame.h"
245d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)#include "chrome/browser/ui/views/frame/contents_web_view.h"
2590dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)#include "chrome/browser/ui/views/frame/immersive_mode_controller.h"
26a36e5920737c6adbddd3e43b760e5de8431db6e0Torne (Richard Coles)#include "chrome/browser/ui/views/frame/scroll_end_effect_controller.h"
27a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch#include "chrome/browser/ui/views/frame/web_contents_close_handler.h"
282a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)#include "chrome/browser/ui/views/load_complete_listener.h"
290529e5d033099cbfc42635f6f6183833b09dff6eBen Murdoch#include "components/infobars/core/infobar_container.h"
305821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "ui/base/accelerators/accelerator.h"
315821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "ui/base/models/simple_menu_model.h"
325821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "ui/gfx/native_widget_types.h"
335821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "ui/views/controls/button/button.h"
34c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)#include "ui/views/controls/webview/unhandled_keyboard_event_handler.h"
355821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "ui/views/widget/widget_delegate.h"
365821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "ui/views/widget/widget_observer.h"
375821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "ui/views/window/client_view.h"
385821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
395821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#if defined(OS_WIN)
405821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "chrome/browser/hang_monitor/hung_plugin_action.h"
415821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "chrome/browser/hang_monitor/hung_window_detector.h"
425821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#endif
435821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
445821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// NOTE: For more information about the objects and files in this directory,
455821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// view: http://dev.chromium.org/developers/design-documents/browser-window
465821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
475821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)class BookmarkBarView;
485821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)class Browser;
495821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)class BrowserViewLayout;
505d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)class ContentsLayoutManager;
515821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)class DownloadShelfView;
525821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)class FullscreenExitBubbleViews;
535821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)class InfoBarContainerView;
545821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)class LocationBarView;
555d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)class PermissionBubbleViewViews;
565821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)class StatusBubbleViews;
575821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)class SearchViewController;
585821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)class TabStrip;
595821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)class TabStripModel;
605821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)class ToolbarView;
612a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)class TopContainerView;
62a02191e04bc25c4935f804f2c080ae28663d096dBen Murdochclass WebContentsCloseHandler;
635821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
645821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#if defined(OS_WIN)
655821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)class JumpList;
665821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#endif
675821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
685821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)namespace content {
69a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)class RenderFrameHost;
705821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)}
715821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
725821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)namespace extensions {
735821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)class Extension;
745821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)}
755821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
765821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)namespace views {
775821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)class AccessiblePaneView;
785821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)class ExternalFocusTracker;
795821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)class WebView;
805821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)}
815821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
825821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)///////////////////////////////////////////////////////////////////////////////
835821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// BrowserView
845821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)//
855821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)//  A ClientView subclass that provides the contents of a browser window,
865821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)//  including the TabStrip, toolbars, download shelves, the content area etc.
875821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)//
885821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)class BrowserView : public BrowserWindow,
895821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)                    public BrowserWindowTesting,
905821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)                    public TabStripModelObserver,
915821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)                    public ui::AcceleratorProvider,
925821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)                    public views::WidgetDelegate,
935821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)                    public views::WidgetObserver,
945821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)                    public views::ClientView,
950529e5d033099cbfc42635f6f6183833b09dff6eBen Murdoch                    public infobars::InfoBarContainer::Delegate,
967dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch                    public LoadCompleteListener::Delegate,
977dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch                    public OmniboxPopupModelObserver {
985821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) public:
995821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // The browser view's class name.
1005821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  static const char kViewClassName[];
1015821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
102c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)  BrowserView();
1035821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual ~BrowserView();
1045821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
105c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)  // Takes ownership of |browser|.
106c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)  void Init(Browser* browser);
107c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)
1085821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  void set_frame(BrowserFrame* frame) { frame_ = frame; }
1095821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  BrowserFrame* frame() const { return frame_; }
1105821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
1115821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Returns a pointer to the BrowserView* interface implementation (an
1125821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // instance of this object, typically) for a given native window, or NULL if
1135821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // there is no such association.
1145821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  //
1155821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Don't use this unless you only have a NativeWindow. In nearly all
1165821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // situations plumb through browser and use it.
1175821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  static BrowserView* GetBrowserViewForNativeWindow(gfx::NativeWindow window);
1185821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
1195821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Returns the BrowserView used for the specified Browser.
1205821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  static BrowserView* GetBrowserViewForBrowser(const Browser* browser);
1215821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
1225821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Returns a Browser instance of this view.
1232a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  Browser* browser() { return browser_.get(); }
124a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch  const Browser* browser() const { return browser_.get(); }
1255821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
126eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch  // Initializes (or re-initializes) the status bubble.  We try to only create
127eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch  // the bubble once and re-use it for the life of the browser, but certain
128eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch  // events (such as changing enabling/disabling Aero on Win) can force a need
129eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch  // to change some of the bubble's creation parameters.
130eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch  void InitStatusBubble();
131eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch
1325d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  // Initializes the permission bubble view. This class is intended to be
1335d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  // created once and then re-used for the life of the browser window. The
1345d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  // bubbles it creates will be associated with a single visible tab.
1355d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  void InitPermissionBubbleView();
1365d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)
1375821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Returns the apparent bounds of the toolbar, in BrowserView coordinates.
1385821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // These differ from |toolbar_.bounds()| in that they match where the toolbar
1395821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // background image is drawn -- slightly outside the "true" bounds
1405821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // horizontally. Note that this returns the bounds for the toolbar area.
141c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)  gfx::Rect GetToolbarBounds() const;
1425821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
1435821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Returns the constraining bounding box that should be used to lay out the
1445821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // FindBar within. This is _not_ the size of the find bar, just the bounding
1455821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // box it should be laid out within. The coordinate system of the returned
1465821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // rect is in the coordinate system of the frame, since the FindBar is a child
1475821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // window.
1485821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  gfx::Rect GetFindBarBoundingBox() const;
1495821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
1505821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Returns the preferred height of the TabStrip. Used to position the OTR
1515821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // avatar icon.
152c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)  int GetTabStripHeight() const;
1535821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
1545821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Takes some view's origin (relative to this BrowserView) and offsets it such
1555821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // that it can be used as the source origin for seamlessly tiling the toolbar
1565821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // background image over that view.
1575821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  gfx::Point OffsetPointForToolbarBackgroundImage(
1585821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)      const gfx::Point& point) const;
1595821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
1602a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  // Container for the tabstrip, toolbar, etc.
1612a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  TopContainerView* top_container() { return top_container_; }
1622a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)
1635821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Accessor for the TabStrip.
1642a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  TabStrip* tabstrip() { return tabstrip_; }
1655821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
1665821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Accessor for the Toolbar.
1672a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  ToolbarView* toolbar() { return toolbar_; }
1682a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)
169c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)  // Bookmark bar may be NULL, for example for pop-ups.
170c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)  BookmarkBarView* bookmark_bar() { return bookmark_bar_view_.get(); }
171c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)
172868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)  // Returns the do-nothing view which controls the z-order of the find bar
173868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)  // widget relative to views which paint into layers and views which have an
174868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)  // associated NativeView. The presence / visibility of this view is not
175868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)  // indicative of the visibility of the find bar widget or even whether
176868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)  // FindBarController is initialized.
177868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)  View* find_bar_host_view() { return find_bar_host_view_; }
178868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)
1792a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  // Accessor for the InfobarContainer.
1802a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  InfoBarContainerView* infobar_container() { return infobar_container_; }
1815821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
1827dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch  // Accessor for the FullscreenExitBubbleViews.
1837dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch  FullscreenExitBubbleViews* fullscreen_exit_bubble() {
1847dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch    return fullscreen_bubble_.get();
1857dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch  }
1867dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch
1875821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Returns true if various window components are visible.
188c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)  bool IsTabStripVisible() const;
1895821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
1905821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Returns true if the profile associated with this Browser window is
1915821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // incognito.
1925821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  bool IsOffTheRecord() const;
1935821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
1945821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Returns true if the profile associated with this Browser window is
1955821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // a guest session.
1965821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  bool IsGuestSession() const;
1975821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
1988bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)  // Returns true if the profile associated with this Browser window is
1998bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)  // not off the record or a guest session.
2008bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)  bool IsRegularOrGuestSession() const;
2018bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)
2025821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Returns true if the non-client view should render an avatar icon.
203c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)  bool ShouldShowAvatar() const;
2045821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
2055821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Provides the containing frame with the accelerator for the specified
2065821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // command id. This can be used to provide menu item shortcut hints etc.
2075821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Returns true if an accelerator was found for the specified |cmd_id|, false
2085821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // otherwise.
209cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)  bool GetAccelerator(int cmd_id, ui::Accelerator* accelerator) const;
2105821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
211c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)  // Returns true if the specificed |accelerator| is registered with this view.
212c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)  bool IsAcceleratorRegistered(const ui::Accelerator& accelerator);
213c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)
2142a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  // Returns the active WebContents. Used by our NonClientView's
2152a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  // TabIconView::TabContentsProvider implementations.
2165821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // TODO(beng): exposing this here is a bit bogus, since it's only used to
2175821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // determine loading state. It'd be nicer if we could change this to be
2185821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // bool IsSelectedTabLoading() const; or something like that. We could even
2195821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // move it to a WindowDelegate subclass.
2205821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  content::WebContents* GetActiveWebContents() const;
2215821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
2225821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Retrieves the icon to use in the frame to indicate an OTR window.
2235821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  gfx::ImageSkia GetOTRAvatarIcon() const;
2245821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
2255821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Returns true if the Browser object associated with this BrowserView is a
2265821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // tabbed-type window (i.e. a browser window, not an app or popup).
2275821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  bool IsBrowserTypeNormal() const {
2285821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    return browser_->is_type_tabbed();
2295821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  }
2305821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
2312a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  // See ImmersiveModeController for description.
232c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)  ImmersiveModeController* immersive_mode_controller() const {
2332a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)    return immersive_mode_controller_.get();
2342a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  }
2352a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)
2365821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Restores the focused view. This is also used to set the initial focus
2375821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // when a new browser window is created.
2385821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  void RestoreFocus();
2395821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
240f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)  // Called after the widget's fullscreen state is changed without going through
241f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)  // FullscreenController. This method does any processing which was skipped.
242f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)  // Only exiting fullscreen in this way is currently supported.
243f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)  void FullscreenStateChanged();
244f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)
2455821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Called from BookmarkBarView/DownloadShelfView during their show/hide
2465821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // animations.
2475821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  void ToolbarSizeChanged(bool is_animating);
2485821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
2495821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Overridden from BrowserWindow:
2505821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual void Show() OVERRIDE;
2515821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual void ShowInactive() OVERRIDE;
2525821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual void Hide() OVERRIDE;
2535821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual void SetBounds(const gfx::Rect& bounds) OVERRIDE;
2545821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual void Close() OVERRIDE;
2555821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual void Activate() OVERRIDE;
2565821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual void Deactivate() OVERRIDE;
2575821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual bool IsActive() const OVERRIDE;
2585821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual void FlashFrame(bool flash) OVERRIDE;
2595821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual bool IsAlwaysOnTop() const OVERRIDE;
2604e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles)  virtual void SetAlwaysOnTop(bool always_on_top) OVERRIDE;
2615821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual gfx::NativeWindow GetNativeWindow() OVERRIDE;
2625821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual BrowserWindowTesting* GetBrowserWindowTesting() OVERRIDE;
2635821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual StatusBubble* GetStatusBubble() OVERRIDE;
2645821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual void UpdateTitleBar() OVERRIDE;
2655821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual void BookmarkBarStateChanged(
2665821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)      BookmarkBar::AnimateChangeType change_type) OVERRIDE;
2675821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual void UpdateDevTools() OVERRIDE;
2685821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual void UpdateLoadingAnimations(bool should_animate) OVERRIDE;
2695821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual void SetStarredState(bool is_starred) OVERRIDE;
270f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)  virtual void SetTranslateIconToggled(bool is_lit) OVERRIDE;
27168043e1e95eeb07d5cae7aca370b26518b0867d6Torne (Richard Coles)  virtual void OnActiveTabChanged(content::WebContents* old_contents,
27268043e1e95eeb07d5cae7aca370b26518b0867d6Torne (Richard Coles)                                  content::WebContents* new_contents,
27368043e1e95eeb07d5cae7aca370b26518b0867d6Torne (Richard Coles)                                  int index,
27468043e1e95eeb07d5cae7aca370b26518b0867d6Torne (Richard Coles)                                  int reason) OVERRIDE;
2755821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual void ZoomChangedForActiveTab(bool can_show_bubble) OVERRIDE;
2765821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual gfx::Rect GetRestoredBounds() const OVERRIDE;
277b2df76ea8fec9e32f6f3718986dba0d95315b29cTorne (Richard Coles)  virtual ui::WindowShowState GetRestoredState() const OVERRIDE;
2785821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual gfx::Rect GetBounds() const OVERRIDE;
2795821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual bool IsMaximized() const OVERRIDE;
2805821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual bool IsMinimized() const OVERRIDE;
2815821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual void Maximize() OVERRIDE;
2825821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual void Minimize() OVERRIDE;
2835821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual void Restore() OVERRIDE;
2845821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual void EnterFullscreen(
2855821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)      const GURL& url, FullscreenExitBubbleType bubble_type) OVERRIDE;
2865821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual void ExitFullscreen() OVERRIDE;
2875821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual void UpdateFullscreenExitBubbleContent(
2885821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)      const GURL& url,
2895821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)      FullscreenExitBubbleType bubble_type) OVERRIDE;
2902a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  virtual bool ShouldHideUIForFullscreen() const OVERRIDE;
2915821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual bool IsFullscreen() const OVERRIDE;
292c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)  virtual bool IsFullscreenBubbleVisible() const OVERRIDE;
2935821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#if defined(OS_WIN)
2945821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual void SetMetroSnapMode(bool enable) OVERRIDE;
2955821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual bool IsInMetroSnapMode() const OVERRIDE;
2965821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#endif
2975821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual LocationBar* GetLocationBar() const OVERRIDE;
2985821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual void SetFocusToLocationBar(bool select_all) OVERRIDE;
2995821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual void UpdateReloadStopState(bool is_loading, bool force) OVERRIDE;
3003551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)  virtual void UpdateToolbar(content::WebContents* contents) OVERRIDE;
3015821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual void FocusToolbar() OVERRIDE;
3025821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual void FocusAppMenu() OVERRIDE;
3035821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual void FocusBookmarksToolbar() OVERRIDE;
304c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)  virtual void FocusInfobars() OVERRIDE;
3055821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual void RotatePaneFocus(bool forwards) OVERRIDE;
3065821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual void DestroyBrowser() OVERRIDE;
3075821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual bool IsBookmarkBarVisible() const OVERRIDE;
3085821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual bool IsBookmarkBarAnimating() const OVERRIDE;
3095821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual bool IsTabStripEditable() const OVERRIDE;
3105821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual bool IsToolbarVisible() const OVERRIDE;
3115821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual gfx::Rect GetRootWindowResizerRect() const OVERRIDE;
3125821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual void ConfirmAddSearchProvider(TemplateURL* template_url,
3135821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)                                        Profile* profile) OVERRIDE;
3145821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual void ShowUpdateChromeDialog() OVERRIDE;
3155821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual void ShowBookmarkBubble(const GURL& url,
3165821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)                                  bool already_bookmarked) OVERRIDE;
3175d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  virtual void ShowBookmarkAppBubble(
3185d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)      const WebApplicationInfo& web_app_info,
3195d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)      const std::string& extension_id) OVERRIDE;
3205f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)  virtual void ShowTranslateBubble(
3215f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)      content::WebContents* contents,
3225f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)      translate::TranslateStep step,
3235f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)      translate::TranslateErrors::Type error_type,
3245f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)      bool is_user_gesture) OVERRIDE;
3255821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#if defined(ENABLE_ONE_CLICK_SIGNIN)
3265821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual void ShowOneClickSigninBubble(
3272a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)      OneClickSigninBubbleType type,
328a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)      const base::string16& email,
329a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)      const base::string16& error_message,
3305821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)      const StartSyncCallback& start_sync_callback) OVERRIDE;
3315821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#endif
3325821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // TODO(beng): Not an override, move somewhere else.
3335821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  void SetDownloadShelfVisible(bool visible);
3345821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual bool IsDownloadShelfVisible() const OVERRIDE;
3355821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual DownloadShelf* GetDownloadShelf() OVERRIDE;
3363551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)  virtual void ConfirmBrowserCloseWithPendingDownloads(
3373551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)      int download_count,
3383551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)      Browser::DownloadClosePreventionType dialog_type,
3393551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)      bool app_modal,
3403551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)      const base::Callback<void(bool)>& callback) OVERRIDE;
3415821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual void UserChangedTheme() OVERRIDE;
3425821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual int GetExtraRenderViewHeight() const OVERRIDE;
3435821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual void WebContentsFocused(content::WebContents* contents) OVERRIDE;
3445821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual void ShowWebsiteSettings(Profile* profile,
3452a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)                                   content::WebContents* web_contents,
3465821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)                                   const GURL& url,
3477dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch                                   const content::SSLStatus& ssl) OVERRIDE;
3485821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual void ShowAppMenu() OVERRIDE;
3495821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual bool PreHandleKeyboardEvent(
3505821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)      const content::NativeWebKeyboardEvent& event,
3515821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)      bool* is_keyboard_shortcut) OVERRIDE;
3525821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual void HandleKeyboardEvent(
3535821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)      const content::NativeWebKeyboardEvent& event) OVERRIDE;
3545821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual void Cut() OVERRIDE;
3555821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual void Copy() OVERRIDE;
3565821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual void Paste() OVERRIDE;
3575821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual WindowOpenDisposition GetDispositionForPopupBounds(
3585821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)      const gfx::Rect& bounds) OVERRIDE;
3595821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual FindBar* CreateFindBar() OVERRIDE;
36090dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)  virtual web_modal::WebContentsModalDialogHost*
361c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)      GetWebContentsModalDialogHost() OVERRIDE;
3625821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual void ShowAvatarBubble(content::WebContents* web_contents,
3635821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)                                const gfx::Rect& rect) OVERRIDE;
364cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)  virtual void ShowAvatarBubbleFromAvatarButton(AvatarBubbleMode mode,
3656d86b77056ed63eb6871182f42a9fd5f07550f90Torne (Richard Coles)      const signin::ManageAccountsParams& manage_accounts_params) OVERRIDE;
366bbcdd45c55eb7c4641ab97aef9889b0fc828e7d3Ben Murdoch  virtual void OverscrollUpdate(int delta_y) OVERRIDE;
367424c4d7b64af9d0d8fd9624f381f469654d5e3d2Torne (Richard Coles)  virtual int GetRenderViewHeightInsetWithDetachedBookmarkBar() OVERRIDE;
368a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  virtual void ExecuteExtensionCommand(
369a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)      const extensions::Extension* extension,
370a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)      const extensions::Command& command) OVERRIDE;
3715821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
3725821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Overridden from BrowserWindowTesting:
3735821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual BookmarkBarView* GetBookmarkBarView() const OVERRIDE;
3745821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual LocationBarView* GetLocationBarView() const OVERRIDE;
3755821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual views::View* GetTabContentsContainerView() const OVERRIDE;
3765821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual ToolbarView* GetToolbarView() const OVERRIDE;
3775821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
3785821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Overridden from TabStripModelObserver:
379effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch  virtual void TabInsertedAt(content::WebContents* contents,
380effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch                             int index,
381effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch                             bool foreground) OVERRIDE;
3825821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual void TabDetachedAt(content::WebContents* contents,
3835821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)                             int index) OVERRIDE;
3842a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  virtual void TabDeactivated(content::WebContents* contents) OVERRIDE;
3855821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual void TabStripEmpty() OVERRIDE;
386a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch  virtual void WillCloseAllTabs() OVERRIDE;
387a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch  virtual void CloseAllTabsCanceled() OVERRIDE;
3885821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
3895821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Overridden from ui::AcceleratorProvider:
3905821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual bool GetAcceleratorForCommandId(int command_id,
3915821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)      ui::Accelerator* accelerator) OVERRIDE;
3925821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
3935821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Overridden from views::WidgetDelegate:
3945821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual bool CanResize() const OVERRIDE;
3955821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual bool CanMaximize() const OVERRIDE;
3961320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci  virtual bool CanMinimize() const OVERRIDE;
3975821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual bool CanActivate() const OVERRIDE;
398a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)  virtual base::string16 GetWindowTitle() const OVERRIDE;
399a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)  virtual base::string16 GetAccessibleWindowTitle() const OVERRIDE;
4005821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual views::View* GetInitiallyFocusedView() OVERRIDE;
4015821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual bool ShouldShowWindowTitle() const OVERRIDE;
4025821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual gfx::ImageSkia GetWindowAppIcon() OVERRIDE;
4035821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual gfx::ImageSkia GetWindowIcon() OVERRIDE;
4045821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual bool ShouldShowWindowIcon() const OVERRIDE;
4055821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual bool ExecuteWindowsCommand(int command_id) OVERRIDE;
4065821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual std::string GetWindowName() const OVERRIDE;
4075821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual void SaveWindowPlacement(const gfx::Rect& bounds,
4085821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)                                   ui::WindowShowState show_state) OVERRIDE;
4095821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual bool GetSavedWindowPlacement(
4100f1bc08d4cfcc34181b0b5cbf065c40f687bf740Torne (Richard Coles)      const views::Widget* widget,
4115821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)      gfx::Rect* bounds,
4125821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)      ui::WindowShowState* show_state) const OVERRIDE;
4135821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual views::View* GetContentsView() OVERRIDE;
4145821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual views::ClientView* CreateClientView(views::Widget* widget) OVERRIDE;
4155821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual void OnWindowBeginUserBoundsChange() OVERRIDE;
4165821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual void OnWidgetMove() OVERRIDE;
4175821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual views::Widget* GetWidget() OVERRIDE;
4185821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual const views::Widget* GetWidget() const OVERRIDE;
419c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)  virtual void GetAccessiblePanes(std::vector<View*>* panes) OVERRIDE;
4205821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
4215821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Overridden from views::WidgetObserver:
4225821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual void OnWidgetActivationChanged(views::Widget* widget,
4235821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)                                         bool active) OVERRIDE;
4245821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
4255821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Overridden from views::ClientView:
4265821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual bool CanClose() OVERRIDE;
4275821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual int NonClientHitTest(const gfx::Point& point) OVERRIDE;
428cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)  virtual gfx::Size GetMinimumSize() const OVERRIDE;
4295821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
4305821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // InfoBarContainer::Delegate overrides
4315821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual SkColor GetInfoBarSeparatorColor() const OVERRIDE;
4325821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual void InfoBarContainerStateChanged(bool is_animating) OVERRIDE;
4335821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual bool DrawInfoBarArrows(int* x) const OVERRIDE;
4345821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
4352a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  // Overridden from views::View:
436b2df76ea8fec9e32f6f3718986dba0d95315b29cTorne (Richard Coles)  virtual const char* GetClassName() const OVERRIDE;
4372a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  virtual void Layout() OVERRIDE;
438cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)  virtual void PaintChildren(gfx::Canvas* canvas,
439cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)                             const views::CullSet& cull_set) OVERRIDE;
440a93a17c8d99d686bd4a1511e5504e5e6cc9fcadfTorne (Richard Coles)  virtual void ViewHierarchyChanged(
441a93a17c8d99d686bd4a1511e5504e5e6cc9fcadfTorne (Richard Coles)      const ViewHierarchyChangedDetails& details) OVERRIDE;
4422a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  virtual void ChildPreferredSizeChanged(View* child) OVERRIDE;
443a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  virtual void GetAccessibleState(ui::AXViewState* state) OVERRIDE;
4445c02ac1a9c1b504631c0a3d2b6e737b5d738bae1Bo Liu  virtual void OnNativeThemeChanged(const ui::NativeTheme* theme) OVERRIDE;
4452a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)
446c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)  // Overridden from ui::AcceleratorTarget:
447c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)  virtual bool AcceleratorPressed(const ui::Accelerator& accelerator) OVERRIDE;
4485821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
4497dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch  // OmniboxPopupModelObserver overrides
4507dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch  virtual void OnOmniboxPopupShownOrHidden() OVERRIDE;
4517dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch
452c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)  // Testing interface:
4535d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  views::View* GetContentsContainerForTest() { return contents_container_; }
454c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)  views::WebView* GetContentsWebViewForTest() { return contents_web_view_; }
4555d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  views::WebView* GetDevToolsWebViewForTest() { return devtools_web_view_; }
4562a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)
4575821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) private:
45890dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)  // Do not friend BrowserViewLayout. Use the BrowserViewLayoutDelegate
45990dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)  // interface to keep these two classes decoupled and testable.
46090dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles)  friend class BrowserViewLayoutDelegateImpl;
461c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)  FRIEND_TEST_ALL_PREFIXES(BrowserViewTest, BrowserView);
4625821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  FRIEND_TEST_ALL_PREFIXES(BrowserViewsAccessibilityTest,
4635821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)                           TestAboutChromeViewAccObj);
4645821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
465a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch  enum FullscreenMode {
466a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch    NORMAL_FULLSCREEN,
467a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch    METRO_SNAP_FULLSCREEN
4685821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  };
4695821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
470c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)  // Appends to |toolbars| a pointer to each AccessiblePaneView that
471c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)  // can be traversed using F6, in the order they should be traversed.
472c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)  void GetAccessiblePanes(std::vector<views::AccessiblePaneView*>* panes);
473c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)
474c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)  // Constructs and initializes the child views.
475c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)  void InitViews();
476c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)
477c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)  // Callback for the loading animation(s) associated with this view.
478c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)  void LoadingAnimationCallback();
479c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)
480c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)  // LoadCompleteListener::Delegate implementation. Creates and initializes the
481c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)  // |jumplist_| after the first page load.
482c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)  virtual void OnLoadCompleted() OVERRIDE;
483c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)
4845821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Returns the BrowserViewLayout.
4855821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  BrowserViewLayout* GetBrowserViewLayout() const;
4865821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
4875d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  // Returns the ContentsLayoutManager.
4885d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  ContentsLayoutManager* GetContentsLayoutManager() const;
4895821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
4902a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  // Prepare to show the Bookmark Bar for the specified WebContents.
4915821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Returns true if the Bookmark Bar can be shown (i.e. it's supported for this
4925821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Browser type) and there should be a subsequent re-layout to show it.
4935821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // |contents| can be NULL.
4942a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  bool MaybeShowBookmarkBar(content::WebContents* contents);
4955821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
496c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)  // Moves the bookmark bar view to the specified parent, which may be NULL,
497c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)  // |this|, or |top_container_|. Ensures that |top_container_| stays in front
498c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)  // of |bookmark_bar_view_|.
499c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)  void SetBookmarkBarParent(views::View* new_parent);
500c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)
5012a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  // Prepare to show an Info Bar for the specified WebContents. Returns
5025821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // true if there is an Info Bar to show and one is supported for this Browser
5035821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // type, and there should be a subsequent re-layout to show it.
5045821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // |contents| can be NULL.
5052a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  bool MaybeShowInfoBar(content::WebContents* contents);
5065821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
5075821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Updates devtools window for given contents. This method will show docked
5082a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  // devtools window for inspected |web_contents| that has docked devtools
5092a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  // and hide it for NULL or not inspected |web_contents|. It will also make
5105821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // sure devtools window size and position are restored for given tab.
5115d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  // This method will not update actual DevTools WebContents, if not
5125d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  // |update_devtools_web_contents|. In this case, manual update is required.
5135d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  void UpdateDevToolsForContents(content::WebContents* web_contents,
5145d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)                                 bool update_devtools_web_contents);
5155821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
5165821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Updates various optional child Views, e.g. Bookmarks Bar, Info Bar or the
5175821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Download Shelf in response to a change notification from the specified
5185821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // |contents|. |contents| can be NULL. In this case, all optional UI will be
5195821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // removed.
5202a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  void UpdateUIForContents(content::WebContents* contents);
5215821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
5225821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Invoked to update the necessary things when our fullscreen state changes
5235821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // to |fullscreen|. On Windows this is invoked immediately when we toggle the
5245821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // full screen state. On Linux changing the fullscreen state is async, so we
5255821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // ask the window to change its fullscreen state, then when we get
5265821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // notification that it succeeded this method is invoked.
5275821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // If |url| is not empty, it is the URL of the page that requested fullscreen
5285821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // (via the fullscreen JS API).
5295821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // |bubble_type| determines what should be shown in the fullscreen exit
5305821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // bubble.
5315821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  void ProcessFullscreen(bool fullscreen,
532a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch                         FullscreenMode mode,
5335821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)                         const GURL& url,
5345821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)                         FullscreenExitBubbleType bubble_type);
5355821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
536eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch  // Returns whether immmersive fullscreen should replace fullscreen. This
537eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch  // should only occur for "browser-fullscreen" for tabbed-typed windows (not
538eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch  // for tab-fullscreen and not for app/popup type windows).
539eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch  bool ShouldUseImmersiveFullscreenForUrl(const GURL& url) const;
540eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch
5415821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Copy the accelerator table from the app resources into something we can
5425821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // use.
5435821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  void LoadAccelerators();
5445821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
5455821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Retrieves the command id for the specified Windows app command.
5465821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  int GetCommandIDForAppCommandID(int app_command_id) const;
5475821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
5485821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Initialize the hung plugin detector.
5495821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  void InitHangMonitor();
5505821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
5515821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Possibly records a user metrics action corresponding to the passed-in
5525821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // accelerator.  Only implemented for Chrome OS, where we're interested in
5535821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // learning about how frequently the top-row keys are used.
5545821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  void UpdateAcceleratorMetrics(const ui::Accelerator& accelerator,
5555821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)                                int command_id);
5565821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
557c5cede9ae108bb15f6b7a8aea21c7e1fefa2834cBen Murdoch  // Calls |method| which is either WebContents::Cut, ::Copy, or ::Paste,
5582a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  // first trying the content WebContents, then the devtools WebContents, and
5592a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  // lastly the Views::Textfield if one is focused.
560c5cede9ae108bb15f6b7a8aea21c7e1fefa2834cBen Murdoch  void DoCutCopyPaste(void (content::WebContents::*method)(),
5612a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)                      int command_id);
5622a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)
563c5cede9ae108bb15f6b7a8aea21c7e1fefa2834cBen Murdoch  // Calls |method| which is either WebContents::Cut, ::Copy, or ::Paste on
5642a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  // the given WebContents, returning true if it consumed the event.
5652a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  bool DoCutCopyPasteForWebContents(
5662a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)      content::WebContents* contents,
567c5cede9ae108bb15f6b7a8aea21c7e1fefa2834cBen Murdoch      void (content::WebContents::*method)());
5685821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
5695821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Shows the next app-modal dialog box, if there is one to be shown, or moves
5705821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // an existing showing one to the front.
5715821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  void ActivateAppModalDialog() const;
5725821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
5737dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch  // Returns the max top arrow height for infobar.
574a93a17c8d99d686bd4a1511e5504e5e6cc9fcadfTorne (Richard Coles)  int GetMaxTopInfoBarArrowHeight();
575a93a17c8d99d686bd4a1511e5504e5e6cc9fcadfTorne (Richard Coles)
5765821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Last focused view that issued a tab traversal.
5775821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  int last_focused_view_storage_id_;
5785821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
5795821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // The BrowserFrame that hosts this view.
5805821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  BrowserFrame* frame_;
5815821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
5825821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // The Browser object we are associated with.
5835821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  scoped_ptr<Browser> browser_;
5845821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
5855821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // BrowserView layout (LTR one is pictured here).
5865821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  //
5872a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  // --------------------------------------------------------------------
5882a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  // | TopContainerView (top_container_)                                |
5892a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  // |  --------------------------------------------------------------  |
5902a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  // |  | Tabs (tabstrip_)                                           |  |
5912a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  // |  |------------------------------------------------------------|  |
5922a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  // |  | Navigation buttons, address bar, menu (toolbar_)           |  |
5932a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  // |  --------------------------------------------------------------  |
5942a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  // |------------------------------------------------------------------|
595ca12bfac764ba476d6cd062bf1dde12cc64c3f40Ben Murdoch  // | All infobars (infobar_container_) [1]                            |
596a93a17c8d99d686bd4a1511e5504e5e6cc9fcadfTorne (Richard Coles)  // |------------------------------------------------------------------|
597ca12bfac764ba476d6cd062bf1dde12cc64c3f40Ben Murdoch  // | Bookmarks (bookmark_bar_view_) [1]                               |
5982a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  // |------------------------------------------------------------------|
5995d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  // | Contents container (contents_container_)                         |
6002a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  // |  --------------------------------------------------------------  |
6015d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  // |  |  devtools_web_view_                                        |  |
6025d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  // |  |------------------------------------------------------------|  |
6035d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  // |  |  contents_web_view_                                        |  |
6042a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  // |  --------------------------------------------------------------  |
6052a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  // |------------------------------------------------------------------|
6062a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  // | Active downloads (download_shelf_)                               |
6072a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  // --------------------------------------------------------------------
6085821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  //
609ca12bfac764ba476d6cd062bf1dde12cc64c3f40Ben Murdoch  // [1] The bookmark bar and info bar are swapped when on the new tab page.
610ca12bfac764ba476d6cd062bf1dde12cc64c3f40Ben Murdoch  //     Additionally when the bookmark bar is detached, contents_container_ is
611ca12bfac764ba476d6cd062bf1dde12cc64c3f40Ben Murdoch  //     positioned on top of the bar while the tab's contents are placed below
612ca12bfac764ba476d6cd062bf1dde12cc64c3f40Ben Murdoch  //     the bar.  This allows the find bar to always align with the top of
613ca12bfac764ba476d6cd062bf1dde12cc64c3f40Ben Murdoch  //     contents_container_ regardless if there's bookmark or info bars.
6145821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
6152a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  // The view that manages the tab strip, toolbar, and sometimes the bookmark
616ca12bfac764ba476d6cd062bf1dde12cc64c3f40Ben Murdoch  // bar. Stacked top in the view hiearachy so it can be used to slide out
617a93a17c8d99d686bd4a1511e5504e5e6cc9fcadfTorne (Richard Coles)  // the top views in immersive fullscreen.
6182a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  TopContainerView* top_container_;
6192a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)
6205821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // The TabStrip.
6215821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  TabStrip* tabstrip_;
6225821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
6235821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // The Toolbar containing the navigation buttons, menus and the address bar.
6245821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  ToolbarView* toolbar_;
6255821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
626c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)  // The Bookmark Bar View for this window. Lazily created. May be NULL for
627c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)  // non-tabbed browsers like popups. May not be visible.
6285821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  scoped_ptr<BookmarkBarView> bookmark_bar_view_;
6295821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
630868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)  // The do-nothing view which controls the z-order of the find bar widget
631868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)  // relative to views which paint into layers and views with an associated
632868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)  // NativeView.
633868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)  View* find_bar_host_view_;
634868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)
6355821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // The download shelf view (view at the bottom of the page).
6365821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  scoped_ptr<DownloadShelfView> download_shelf_;
6375821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
6385821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // The InfoBarContainerView that contains InfoBars for the current tab.
6395821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  InfoBarContainerView* infobar_container_;
6405821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
6415821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // The view that contains the selected WebContents.
6425d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  ContentsWebView* contents_web_view_;
6435821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
6445821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // The view that contains devtools window for the selected WebContents.
6455d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  views::WebView* devtools_web_view_;
6465821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
6475d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  // The view managing the devtools and contents positions.
6485d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  // Handled by ContentsLayoutManager.
6495d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  views::View* contents_container_;
6505821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
6515821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Tracks and stores the last focused view which is not the
6525d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  // devtools_web_view_ or any of its children. Used to restore focus once
6535d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  // the devtools_web_view_ is hidden.
6545821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  scoped_ptr<views::ExternalFocusTracker> devtools_focus_tracker_;
6555821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
6565821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // The Status information bubble that appears at the bottom of the window.
6575821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  scoped_ptr<StatusBubbleViews> status_bubble_;
6585821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
6595d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  // The permission bubble view is the toolkit-specific implementation of the
6605d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  // interface used by the manager to display permissions bubbles.
6615d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  scoped_ptr<PermissionBubbleViewViews> permission_bubble_view_;
6625d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)
6635821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // A mapping between accelerators and commands.
6645821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  std::map<ui::Accelerator, int> accelerator_table_;
6655821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
6665821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // True if we have already been initialized.
6675821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  bool initialized_;
6685821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
6691e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)  // True when in ProcessFullscreen(). The flag is used to avoid reentrance and
6701e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)  // to ignore requests to layout while in ProcessFullscreen() to reduce
6711e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)  // jankiness.
6721e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)  bool in_process_fullscreen_;
6735821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
6745821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  scoped_ptr<FullscreenExitBubbleViews> fullscreen_bubble_;
6755821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
6765d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)#if defined(OS_WIN)
6775821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // This object is used to perform periodic actions in a worker
6785821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // thread. It is currently used to monitor hung plugin windows.
6795821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  WorkerThreadTicker ticker_;
6805821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
6815821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // This object is initialized with the frame window HWND. This
6825821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // object is also passed as a tick handler with the ticker_ object.
6835821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // It is used to periodically monitor for hung plugin windows
6845821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  HungWindowDetector hung_window_detector_;
6855821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
6865821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // This object is invoked by hung_window_detector_ when it detects a hung
6875821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // plugin window.
6885821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  HungPluginAction hung_plugin_action_;
6895821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
6902a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  // Helper class to listen for completion of first page load.
6912a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  scoped_ptr<LoadCompleteListener> load_complete_listener_;
6922a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)
6935821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // The custom JumpList for Windows 7.
6945821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  scoped_refptr<JumpList> jumplist_;
6955821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#endif
6965821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
6975821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // The timer used to update frames for the Loading Animation.
6985821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  base::RepeatingTimer<BrowserView> loading_animation_timer_;
6995821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
700c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)  views::UnhandledKeyboardEventHandler unhandled_keyboard_event_handler_;
7015821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
7025821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // Used to measure the loading spinner animation rate.
7035821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  base::TimeTicks last_animation_time_;
7045821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
7055821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // If this flag is set then SetFocusToLocationBar() will set focus to the
7065821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // location bar even if the browser window is not active.
7075821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  bool force_location_bar_focus_;
7085821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
7092a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  scoped_ptr<ImmersiveModeController> immersive_mode_controller_;
7102a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)
711a36e5920737c6adbddd3e43b760e5de8431db6e0Torne (Richard Coles)  scoped_ptr<ScrollEndEffectController> scroll_end_effect_controller_;
712a36e5920737c6adbddd3e43b760e5de8431db6e0Torne (Richard Coles)
713a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch  scoped_ptr<WebContentsCloseHandler> web_contents_close_handler_;
714a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch
7155821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  mutable base::WeakPtrFactory<BrowserView> activate_modal_dialog_factory_;
7165821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
7175821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  DISALLOW_COPY_AND_ASSIGN(BrowserView);
7185821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)};
7195821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
7205821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#endif  // CHROME_BROWSER_UI_VIEWS_FRAME_BROWSER_VIEW_H_
721