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