Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / chrome / browser / ui / views / frame / browser_view.h
bloba18f74817c37893e669e06791811c9354931083a
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef CHROME_BROWSER_UI_VIEWS_FRAME_BROWSER_VIEW_H_
6 #define CHROME_BROWSER_UI_VIEWS_FRAME_BROWSER_VIEW_H_
8 #include <map>
9 #include <string>
10 #include <vector>
12 #include "base/compiler_specific.h"
13 #include "base/memory/scoped_ptr.h"
14 #include "base/timer/timer.h"
15 #include "build/build_config.h"
16 #include "chrome/browser/devtools/devtools_window.h"
17 #include "chrome/browser/ui/browser.h"
18 #include "chrome/browser/ui/browser_window.h"
19 #include "chrome/browser/ui/exclusive_access/exclusive_access_context.h"
20 #include "chrome/browser/ui/infobar_container_delegate.h"
21 #include "chrome/browser/ui/tabs/tab_strip_model_observer.h"
22 #include "chrome/browser/ui/views/exclusive_access_bubble_views_context.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/omnibox/browser/omnibox_popup_model_observer.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"
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
43 // NOTE: For more information about the objects and files in this directory,
44 // view: http://dev.chromium.org/developers/design-documents/browser-window
46 class BookmarkBarView;
47 class Browser;
48 class BrowserViewLayout;
49 class ContentsLayoutManager;
50 class DownloadShelfView;
51 class ExclusiveAccessBubbleViews;
52 class InfoBarContainerView;
53 class LocationBarView;
54 class StatusBubbleViews;
55 class TabStrip;
56 class ToolbarView;
57 class TopContainerView;
58 class WebContentsCloseHandler;
60 #if defined(OS_WIN)
61 class JumpList;
62 #endif
64 namespace extensions {
65 class Extension;
68 namespace views {
69 class AccessiblePaneView;
70 class ExternalFocusTracker;
71 class WebView;
74 ///////////////////////////////////////////////////////////////////////////////
75 // BrowserView
77 // A ClientView subclass that provides the contents of a browser window,
78 // including the TabStrip, toolbars, download shelves, the content area etc.
80 class BrowserView : public BrowserWindow,
81 public TabStripModelObserver,
82 public ui::AcceleratorProvider,
83 public views::WidgetDelegate,
84 public views::WidgetObserver,
85 public views::ClientView,
86 public InfoBarContainerDelegate,
87 public LoadCompleteListener::Delegate,
88 public OmniboxPopupModelObserver,
89 public ExclusiveAccessContext,
90 public ExclusiveAccessBubbleViewsContext {
91 public:
92 // The browser view's class name.
93 static const char kViewClassName[];
95 BrowserView();
96 ~BrowserView() override;
98 // Takes ownership of |browser|.
99 void Init(Browser* browser);
101 void set_frame(BrowserFrame* frame) { frame_ = frame; }
102 BrowserFrame* frame() const { return frame_; }
104 // Returns a pointer to the BrowserView* interface implementation (an
105 // instance of this object, typically) for a given native window, or null if
106 // there is no such association.
108 // Don't use this unless you only have a NativeWindow. In nearly all
109 // situations plumb through browser and use it.
110 static BrowserView* GetBrowserViewForNativeWindow(gfx::NativeWindow window);
112 // Returns the BrowserView used for the specified Browser.
113 static BrowserView* GetBrowserViewForBrowser(const Browser* browser);
115 // Paints a 1 device-pixel-thick horizontal line (regardless of device scale
116 // factor) flush with the bottom of |bounds|.
117 static void Paint1pxHorizontalLine(gfx::Canvas* canvas,
118 SkColor color,
119 const gfx::Rect& bounds);
121 // Returns a Browser instance of this view.
122 Browser* browser() { return browser_.get(); }
123 const Browser* browser() const { return browser_.get(); }
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();
131 // Returns the apparent bounds of the toolbar, in BrowserView coordinates.
132 // These differ from |toolbar_.bounds()| in that they match where the toolbar
133 // background image is drawn -- slightly outside the "true" bounds
134 // horizontally. Note that this returns the bounds for the toolbar area.
135 gfx::Rect GetToolbarBounds() const;
137 // Returns the constraining bounding box that should be used to lay out the
138 // FindBar within. This is _not_ the size of the find bar, just the bounding
139 // box it should be laid out within. The coordinate system of the returned
140 // rect is in the coordinate system of the frame, since the FindBar is a child
141 // window.
142 gfx::Rect GetFindBarBoundingBox() const;
144 // Returns the preferred height of the TabStrip. Used to position the OTR
145 // avatar icon.
146 int GetTabStripHeight() const;
148 // Takes some view's origin (relative to this BrowserView) and offsets it such
149 // that it can be used as the source origin for seamlessly tiling the toolbar
150 // background image over that view.
151 gfx::Point OffsetPointForToolbarBackgroundImage(
152 const gfx::Point& point) const;
154 // Container for the tabstrip, toolbar, etc.
155 TopContainerView* top_container() { return top_container_; }
157 // Accessor for the TabStrip.
158 TabStrip* tabstrip() { return tabstrip_; }
160 // Accessor for the Toolbar.
161 ToolbarView* toolbar() { return toolbar_; }
163 // Bookmark bar may be null, for example for pop-ups.
164 BookmarkBarView* bookmark_bar() { return bookmark_bar_view_.get(); }
166 // Returns the do-nothing view which controls the z-order of the find bar
167 // widget relative to views which paint into layers and views which have an
168 // associated NativeView. The presence / visibility of this view is not
169 // indicative of the visibility of the find bar widget or even whether
170 // FindBarController is initialized.
171 View* find_bar_host_view() { return find_bar_host_view_; }
173 // Accessor for the InfobarContainer.
174 InfoBarContainerView* infobar_container() { return infobar_container_; }
176 // Accessor for the FullscreenExitBubbleViews.
177 ExclusiveAccessBubbleViews* exclusive_access_bubble() {
178 return exclusive_access_bubble_.get();
181 // Returns true if various window components are visible.
182 bool IsTabStripVisible() const;
184 // Returns true if the profile associated with this Browser window is
185 // incognito.
186 bool IsOffTheRecord() const;
188 // Returns true if the profile associated with this Browser window is
189 // a guest session.
190 bool IsGuestSession() const;
192 // Returns true if the profile associated with this Browser window is
193 // not off the record or a guest session.
194 bool IsRegularOrGuestSession() const;
196 // Returns true if the non-client view should render an avatar icon.
197 bool ShouldShowAvatar() const;
199 // Provides the containing frame with the accelerator for the specified
200 // command id. This can be used to provide menu item shortcut hints etc.
201 // Returns true if an accelerator was found for the specified |cmd_id|, false
202 // otherwise.
203 bool GetAccelerator(int cmd_id, ui::Accelerator* accelerator) const;
205 // Returns true if the specificed |accelerator| is registered with this view.
206 bool IsAcceleratorRegistered(const ui::Accelerator& accelerator);
208 // Returns the active WebContents. Used by our NonClientView's
209 // TabIconView::TabContentsProvider implementations.
210 // TODO(beng): exposing this here is a bit bogus, since it's only used to
211 // determine loading state. It'd be nicer if we could change this to be
212 // bool IsSelectedTabLoading() const; or something like that. We could even
213 // move it to a WindowDelegate subclass.
214 content::WebContents* GetActiveWebContents() const;
216 // Retrieves the icon to use in the frame to indicate an OTR window.
217 gfx::ImageSkia GetOTRAvatarIcon() const;
219 // Returns true if the Browser object associated with this BrowserView is a
220 // tabbed-type window (i.e. a browser window, not an app or popup).
221 bool IsBrowserTypeNormal() const {
222 return browser_->is_type_tabbed();
225 // See ImmersiveModeController for description.
226 ImmersiveModeController* immersive_mode_controller() const {
227 return immersive_mode_controller_.get();
230 // Returns true if the view has been initialized.
231 bool initialized() const { return initialized_; }
233 // Restores the focused view. This is also used to set the initial focus
234 // when a new browser window is created.
235 void RestoreFocus();
237 // Called after the widget's fullscreen state is changed without going through
238 // FullscreenController. This method does any processing which was skipped.
239 // Only exiting fullscreen in this way is currently supported.
240 void FullscreenStateChanged();
242 // Overridden from BrowserWindow:
243 void Show() override;
244 void ShowInactive() override;
245 void Hide() override;
246 void SetBounds(const gfx::Rect& bounds) override;
247 void Close() override;
248 void Activate() override;
249 void Deactivate() override;
250 bool IsActive() const override;
251 void FlashFrame(bool flash) override;
252 bool IsAlwaysOnTop() const override;
253 void SetAlwaysOnTop(bool always_on_top) override;
254 gfx::NativeWindow GetNativeWindow() const override;
255 StatusBubble* GetStatusBubble() override;
256 void UpdateTitleBar() override;
257 void BookmarkBarStateChanged(
258 BookmarkBar::AnimateChangeType change_type) override;
259 void UpdateDevTools() override;
260 void UpdateLoadingAnimations(bool should_animate) override;
261 void SetStarredState(bool is_starred) override;
262 void SetTranslateIconToggled(bool is_lit) override;
263 void OnActiveTabChanged(content::WebContents* old_contents,
264 content::WebContents* new_contents,
265 int index,
266 int reason) override;
267 void ZoomChangedForActiveTab(bool can_show_bubble) override;
268 gfx::Rect GetRestoredBounds() const override;
269 ui::WindowShowState GetRestoredState() const override;
270 gfx::Rect GetBounds() const override;
271 bool IsMaximized() const override;
272 bool IsMinimized() const override;
273 void Maximize() override;
274 void Minimize() override;
275 void Restore() override;
276 void EnterFullscreen(const GURL& url,
277 ExclusiveAccessBubbleType bubble_type,
278 bool with_toolbar) override;
279 void ExitFullscreen() override;
280 void UpdateExclusiveAccessExitBubbleContent(
281 const GURL& url,
282 ExclusiveAccessBubbleType bubble_type) override;
283 bool ShouldHideUIForFullscreen() const override;
284 bool IsFullscreen() const override;
285 bool IsFullscreenBubbleVisible() const override;
286 bool SupportsFullscreenWithToolbar() const override;
287 void UpdateFullscreenWithToolbar(bool with_toolbar) override;
288 bool IsFullscreenWithToolbar() const override;
289 #if defined(OS_WIN)
290 void SetMetroSnapMode(bool enable) override;
291 bool IsInMetroSnapMode() const override;
292 #endif // defined(OS_WIN)
293 LocationBar* GetLocationBar() const override;
294 void SetFocusToLocationBar(bool select_all) override;
295 void UpdateReloadStopState(bool is_loading, bool force) override;
296 void UpdateToolbar(content::WebContents* contents) override;
297 void ResetToolbarTabState(content::WebContents* contents) override;
298 void FocusToolbar() override;
299 ToolbarActionsBar* GetToolbarActionsBar() override;
300 void ToolbarSizeChanged(bool is_animating) 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(
316 const WebApplicationInfo& web_app_info,
317 const ShowBookmarkAppBubbleCallback& callback) override;
318 void ShowTranslateBubble(content::WebContents* contents,
319 translate::TranslateStep step,
320 translate::TranslateErrors::Type error_type,
321 bool is_user_gesture) override;
322 bool ShowSessionCrashedBubble() override;
323 bool IsProfileResetBubbleSupported() const override;
324 GlobalErrorBubbleViewBase* ShowProfileResetBubble(
325 const base::WeakPtr<ProfileResetGlobalError>& global_error) override;
326 #if defined(ENABLE_ONE_CLICK_SIGNIN)
327 void ShowOneClickSigninBubble(
328 OneClickSigninBubbleType type,
329 const base::string16& email,
330 const base::string16& error_message,
331 const StartSyncCallback& start_sync_callback) override;
332 #endif
333 // TODO(beng): Not an override, move somewhere else.
334 void SetDownloadShelfVisible(bool visible);
335 bool IsDownloadShelfVisible() const override;
336 DownloadShelf* GetDownloadShelf() override;
337 void ConfirmBrowserCloseWithPendingDownloads(
338 int download_count,
339 Browser::DownloadClosePreventionType dialog_type,
340 bool app_modal,
341 const base::Callback<void(bool)>& callback) override;
342 void UserChangedTheme() override;
343 void ShowWebsiteSettings(
344 Profile* profile,
345 content::WebContents* web_contents,
346 const GURL& url,
347 const SecurityStateModel::SecurityInfo& security_info) override;
348 void ShowAppMenu() override;
349 bool PreHandleKeyboardEvent(const content::NativeWebKeyboardEvent& event,
350 bool* is_keyboard_shortcut) override;
351 void HandleKeyboardEvent(
352 const content::NativeWebKeyboardEvent& event) override;
353 void CutCopyPaste(int command_id) override;
354 WindowOpenDisposition GetDispositionForPopupBounds(
355 const gfx::Rect& bounds) override;
356 FindBar* CreateFindBar() override;
357 web_modal::WebContentsModalDialogHost* GetWebContentsModalDialogHost()
358 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 ExclusiveAccessContext* GetExclusiveAccessContext() override;
367 BookmarkBarView* GetBookmarkBarView() const;
368 LocationBarView* GetLocationBarView() const;
369 views::View* GetTabContentsContainerView() const;
370 ToolbarView* GetToolbarView() const;
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;
382 // Overridden from ui::AcceleratorProvider:
383 bool GetAcceleratorForCommandId(int command_id,
384 ui::Accelerator* accelerator) override;
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;
413 // Overridden from views::WidgetObserver:
414 void OnWidgetActivationChanged(views::Widget* widget, bool active) override;
416 // Overridden from views::ClientView:
417 bool CanClose() override;
418 int NonClientHitTest(const gfx::Point& point) override;
419 gfx::Size GetMinimumSize() const override;
421 // InfoBarContainerDelegate:
422 SkColor GetInfoBarSeparatorColor() const override;
423 void InfoBarContainerStateChanged(bool is_animating) override;
424 bool DrawInfoBarArrows(int* x) const override;
426 // Overridden from views::View:
427 const char* GetClassName() const override;
428 void Layout() override;
429 void PaintChildren(const ui::PaintContext& context) override;
430 void ViewHierarchyChanged(
431 const ViewHierarchyChangedDetails& details) override;
432 void ChildPreferredSizeChanged(View* child) override;
433 void GetAccessibleState(ui::AXViewState* state) override;
434 void OnNativeThemeChanged(const ui::NativeTheme* theme) override;
436 // Overridden from ui::AcceleratorTarget:
437 bool AcceleratorPressed(const ui::Accelerator& accelerator) override;
439 // OmniboxPopupModelObserver overrides
440 void OnOmniboxPopupShownOrHidden() override;
442 // ExclusiveAccessContext overrides
443 Profile* GetProfile() override;
444 content::WebContents* GetActiveWebContents() override;
445 void HideDownloadShelf() override;
446 void UnhideDownloadShelf() override;
448 // ExclusiveAccessBubbleViewsContext overrides
449 ExclusiveAccessManager* GetExclusiveAccessManager() override;
450 bool IsImmersiveModeEnabled() override;
451 views::Widget* GetBubbleAssociatedWidget() override;
452 gfx::Rect GetTopContainerBoundsInScreen() override;
454 // Testing interface:
455 views::View* GetContentsContainerForTest() { return contents_container_; }
456 views::WebView* GetContentsWebViewForTest() { return contents_web_view_; }
457 views::WebView* GetDevToolsWebViewForTest() { return devtools_web_view_; }
459 private:
460 // Do not friend BrowserViewLayout. Use the BrowserViewLayoutDelegate
461 // interface to keep these two classes decoupled and testable.
462 friend class BrowserViewLayoutDelegateImpl;
463 FRIEND_TEST_ALL_PREFIXES(BrowserViewTest, BrowserView);
464 FRIEND_TEST_ALL_PREFIXES(BrowserViewsAccessibilityTest,
465 TestAboutChromeViewAccObj);
467 enum FullscreenMode {
468 NORMAL_FULLSCREEN,
469 METRO_SNAP_FULLSCREEN
472 // Appends to |toolbars| a pointer to each AccessiblePaneView that
473 // can be traversed using F6, in the order they should be traversed.
474 void GetAccessiblePanes(std::vector<views::AccessiblePaneView*>* panes);
476 // Constructs and initializes the child views.
477 void InitViews();
479 // Callback for the loading animation(s) associated with this view.
480 void LoadingAnimationCallback();
482 // LoadCompleteListener::Delegate implementation. Creates and initializes the
483 // |jumplist_| after the first page load.
484 void OnLoadCompleted() override;
486 // Returns the BrowserViewLayout.
487 BrowserViewLayout* GetBrowserViewLayout() const;
489 // Returns the ContentsLayoutManager.
490 ContentsLayoutManager* GetContentsLayoutManager() const;
492 // Prepare to show the Bookmark Bar for the specified WebContents.
493 // Returns true if the Bookmark Bar can be shown (i.e. it's supported for this
494 // Browser type) and there should be a subsequent re-layout to show it.
495 // |contents| can be null.
496 bool MaybeShowBookmarkBar(content::WebContents* contents);
498 // Moves the bookmark bar view to the specified parent, which may be null,
499 // |this|, or |top_container_|. Ensures that |top_container_| stays in front
500 // of |bookmark_bar_view_|.
501 void SetBookmarkBarParent(views::View* new_parent);
503 // Prepare to show an Info Bar for the specified WebContents. Returns
504 // true if there is an Info Bar to show and one is supported for this Browser
505 // type, and there should be a subsequent re-layout to show it.
506 // |contents| can be null.
507 bool MaybeShowInfoBar(content::WebContents* contents);
509 // Updates devtools window for given contents. This method will show docked
510 // devtools window for inspected |web_contents| that has docked devtools
511 // and hide it for null or not inspected |web_contents|. It will also make
512 // sure devtools window size and position are restored for given tab.
513 // This method will not update actual DevTools WebContents, if not
514 // |update_devtools_web_contents|. In this case, manual update is required.
515 void UpdateDevToolsForContents(content::WebContents* web_contents,
516 bool update_devtools_web_contents);
518 // Updates various optional child Views, e.g. Bookmarks Bar, Info Bar or the
519 // Download Shelf in response to a change notification from the specified
520 // |contents|. |contents| can be null. In this case, all optional UI will be
521 // removed.
522 void UpdateUIForContents(content::WebContents* contents);
524 // Invoked to update the necessary things when our fullscreen state changes
525 // to |fullscreen|. On Windows this is invoked immediately when we toggle the
526 // full screen state. On Linux changing the fullscreen state is async, so we
527 // ask the window to change its fullscreen state, then when we get
528 // notification that it succeeded this method is invoked.
529 // If |url| is not empty, it is the URL of the page that requested fullscreen
530 // (via the fullscreen JS API).
531 // |bubble_type| determines what should be shown in the fullscreen exit
532 // bubble.
533 void ProcessFullscreen(bool fullscreen,
534 FullscreenMode mode,
535 const GURL& url,
536 ExclusiveAccessBubbleType bubble_type);
538 // Returns whether immmersive fullscreen should replace fullscreen. This
539 // should only occur for "browser-fullscreen" for tabbed-typed windows (not
540 // for tab-fullscreen and not for app/popup type windows).
541 bool ShouldUseImmersiveFullscreenForUrl(const GURL& url) const;
543 // Copy the accelerator table from the app resources into something we can
544 // use.
545 void LoadAccelerators();
547 // Retrieves the command id for the specified Windows app command.
548 int GetCommandIDForAppCommandID(int app_command_id) const;
550 // Initialize the hung plugin detector.
551 void InitHangMonitor();
553 // Possibly records a user metrics action corresponding to the passed-in
554 // accelerator. Only implemented for Chrome OS, where we're interested in
555 // learning about how frequently the top-row keys are used.
556 void UpdateAcceleratorMetrics(const ui::Accelerator& accelerator,
557 int command_id);
559 // Calls |method| which is either WebContents::Cut, ::Copy, or ::Paste on
560 // the given WebContents, returning true if it consumed the event.
561 bool DoCutCopyPasteForWebContents(
562 content::WebContents* contents,
563 void (content::WebContents::*method)());
565 // Shows the next app-modal dialog box, if there is one to be shown, or moves
566 // an existing showing one to the front.
567 void ActivateAppModalDialog() const;
569 // Returns the max top arrow height for infobar.
570 int GetMaxTopInfoBarArrowHeight();
572 // Last focused view that issued a tab traversal.
573 int last_focused_view_storage_id_;
575 // The BrowserFrame that hosts this view.
576 BrowserFrame* frame_;
578 // The Browser object we are associated with.
579 scoped_ptr<Browser> browser_;
581 // BrowserView layout (LTR one is pictured here).
583 // --------------------------------------------------------------------
584 // | TopContainerView (top_container_) |
585 // | -------------------------------------------------------------- |
586 // | | Tabs (tabstrip_) | |
587 // | |------------------------------------------------------------| |
588 // | | Navigation buttons, address bar, menu (toolbar_) | |
589 // | -------------------------------------------------------------- |
590 // |------------------------------------------------------------------|
591 // | All infobars (infobar_container_) [1] |
592 // |------------------------------------------------------------------|
593 // | Bookmarks (bookmark_bar_view_) [1] |
594 // |------------------------------------------------------------------|
595 // | Contents container (contents_container_) |
596 // | -------------------------------------------------------------- |
597 // | | devtools_web_view_ | |
598 // | |------------------------------------------------------------| |
599 // | | contents_web_view_ | |
600 // | -------------------------------------------------------------- |
601 // |------------------------------------------------------------------|
602 // | Active downloads (download_shelf_) |
603 // --------------------------------------------------------------------
605 // [1] The bookmark bar and info bar are swapped when on the new tab page.
606 // Additionally when the bookmark bar is detached, contents_container_ is
607 // positioned on top of the bar while the tab's contents are placed below
608 // the bar. This allows the find bar to always align with the top of
609 // contents_container_ regardless if there's bookmark or info bars.
611 // The view that manages the tab strip, toolbar, and sometimes the bookmark
612 // bar. Stacked top in the view hiearachy so it can be used to slide out
613 // the top views in immersive fullscreen.
614 TopContainerView* top_container_;
616 // The TabStrip.
617 TabStrip* tabstrip_;
619 // The Toolbar containing the navigation buttons, menus and the address bar.
620 ToolbarView* toolbar_;
622 // The Bookmark Bar View for this window. Lazily created. May be null for
623 // non-tabbed browsers like popups. May not be visible.
624 scoped_ptr<BookmarkBarView> bookmark_bar_view_;
626 // The do-nothing view which controls the z-order of the find bar widget
627 // relative to views which paint into layers and views with an associated
628 // NativeView.
629 View* find_bar_host_view_;
631 // The download shelf view (view at the bottom of the page).
632 scoped_ptr<DownloadShelfView> download_shelf_;
634 // The InfoBarContainerView that contains InfoBars for the current tab.
635 InfoBarContainerView* infobar_container_;
637 // The view that contains the selected WebContents.
638 ContentsWebView* contents_web_view_;
640 // The view that contains devtools window for the selected WebContents.
641 views::WebView* devtools_web_view_;
643 // The view managing the devtools and contents positions.
644 // Handled by ContentsLayoutManager.
645 views::View* contents_container_;
647 // Tracks and stores the last focused view which is not the
648 // devtools_web_view_ or any of its children. Used to restore focus once
649 // the devtools_web_view_ is hidden.
650 scoped_ptr<views::ExternalFocusTracker> devtools_focus_tracker_;
652 // The Status information bubble that appears at the bottom of the window.
653 scoped_ptr<StatusBubbleViews> status_bubble_;
655 // A mapping between accelerators and commands.
656 std::map<ui::Accelerator, int> accelerator_table_;
658 // True if we have already been initialized.
659 bool initialized_;
661 // True when in ProcessFullscreen(). The flag is used to avoid reentrance and
662 // to ignore requests to layout while in ProcessFullscreen() to reduce
663 // jankiness.
664 bool in_process_fullscreen_;
666 scoped_ptr<ExclusiveAccessBubbleViews> exclusive_access_bubble_;
668 #if defined(OS_WIN)
669 // This object is used to perform periodic actions in a worker
670 // thread. It is currently used to monitor hung plugin windows.
671 WorkerThreadTicker ticker_;
673 // This object is initialized with the frame window HWND. This
674 // object is also passed as a tick handler with the ticker_ object.
675 // It is used to periodically monitor for hung plugin windows
676 HungWindowDetector hung_window_detector_;
678 // This object is invoked by hung_window_detector_ when it detects a hung
679 // plugin window.
680 HungPluginAction hung_plugin_action_;
682 // Helper class to listen for completion of first page load.
683 scoped_ptr<LoadCompleteListener> load_complete_listener_;
685 // The custom JumpList for Windows 7.
686 scoped_refptr<JumpList> jumplist_;
687 #endif
689 // The timer used to update frames for the Loading Animation.
690 base::RepeatingTimer<BrowserView> loading_animation_timer_;
692 views::UnhandledKeyboardEventHandler unhandled_keyboard_event_handler_;
694 // Used to measure the loading spinner animation rate.
695 base::TimeTicks last_animation_time_;
697 // If this flag is set then SetFocusToLocationBar() will set focus to the
698 // location bar even if the browser window is not active.
699 bool force_location_bar_focus_;
701 scoped_ptr<ImmersiveModeController> immersive_mode_controller_;
703 scoped_ptr<WebContentsCloseHandler> web_contents_close_handler_;
705 mutable base::WeakPtrFactory<BrowserView> activate_modal_dialog_factory_;
707 DISALLOW_COPY_AND_ASSIGN(BrowserView);
710 #endif // CHROME_BROWSER_UI_VIEWS_FRAME_BROWSER_VIEW_H_