1 // Copyright (c) 2011 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 #pragma once 8 9 #include <map> 10 #include <string> 11 #include <vector> 12 13 #include "base/memory/scoped_ptr.h" 14 #include "base/timer.h" 15 #include "build/build_config.h" 16 #include "chrome/browser/tabs/tab_strip_model_observer.h" 17 #include "chrome/browser/ui/browser.h" 18 #include "chrome/browser/ui/browser_window.h" 19 #include "chrome/browser/ui/views/frame/browser_bubble_host.h" 20 #include "chrome/browser/ui/views/frame/browser_frame.h" 21 #include "chrome/browser/ui/views/infobars/infobar_container.h" 22 #include "chrome/browser/ui/views/tab_contents/tab_contents_container.h" 23 #include "chrome/browser/ui/views/tabs/abstract_tab_strip_view.h" 24 #include "chrome/browser/ui/views/unhandled_keyboard_event_handler.h" 25 #include "content/common/notification_registrar.h" 26 #include "ui/base/models/simple_menu_model.h" 27 #include "ui/gfx/native_widget_types.h" 28 #include "views/controls/single_split_view.h" 29 #include "views/window/client_view.h" 30 #include "views/window/window_delegate.h" 31 32 #if defined(OS_WIN) 33 #include "chrome/browser/hang_monitor/hung_plugin_action.h" 34 #include "chrome/browser/hang_monitor/hung_window_detector.h" 35 #include "views/controls/menu/native_menu_win.h" 36 #endif 37 38 // NOTE: For more information about the objects and files in this directory, 39 // view: http://dev.chromium.org/developers/design-documents/browser-window 40 41 class AccessiblePaneView; 42 class BookmarkBarView; 43 class Browser; 44 class BrowserBubble; 45 class BrowserViewLayout; 46 class ContentsContainer; 47 class DownloadShelfView; 48 class EncodingMenuModel; 49 class FullscreenExitBubble; 50 class HtmlDialogUIDelegate; 51 class InfoBarContainerView; 52 class LocationBarView; 53 class SideTabStrip; 54 class StatusBubbleViews; 55 class TabContentsContainer; 56 class TabStripModel; 57 class ToolbarView; 58 class ZoomMenuModel; 59 class Extension; 60 61 #if defined(OS_WIN) 62 class AeroPeekManager; 63 class JumpList; 64 #endif 65 66 namespace views { 67 class ExternalFocusTracker; 68 class Menu; 69 } 70 71 /////////////////////////////////////////////////////////////////////////////// 72 // BrowserView 73 // 74 // A ClientView subclass that provides the contents of a browser window, 75 // including the TabStrip, toolbars, download shelves, the content area etc. 76 // 77 class BrowserView : public BrowserBubbleHost, 78 public BrowserWindow, 79 public BrowserWindowTesting, 80 public NotificationObserver, 81 public TabStripModelObserver, 82 public ui::SimpleMenuModel::Delegate, 83 public views::WindowDelegate, 84 public views::ClientView, 85 public InfoBarContainer::Delegate, 86 public views::SingleSplitView::Observer { 87 public: 88 // The browser view's class name. 89 static const char kViewClassName[]; 90 91 explicit BrowserView(Browser* browser); 92 virtual ~BrowserView(); 93 94 void set_frame(BrowserFrame* frame) { frame_ = frame; } 95 BrowserFrame* frame() const { return frame_; } 96 97 // Returns a pointer to the BrowserView* interface implementation (an 98 // instance of this object, typically) for a given native window, or NULL if 99 // there is no such association. 100 static BrowserView* GetBrowserViewForNativeWindow(gfx::NativeWindow window); 101 102 // Returns a Browser instance of this view. 103 Browser* browser() const { return browser_.get(); } 104 105 // Returns the apparent bounds of the toolbar, in BrowserView coordinates. 106 // These differ from |toolbar_.bounds()| in that they match where the toolbar 107 // background image is drawn -- slightly outside the "true" bounds 108 // horizontally, and, when using vertical tabs, behind the tab column. 109 virtual gfx::Rect GetToolbarBounds() const; 110 111 // Returns the bounds of the content area, in the coordinates of the 112 // BrowserView's parent. 113 gfx::Rect GetClientAreaBounds() const; 114 115 // Returns the constraining bounding box that should be used to lay out the 116 // FindBar within. This is _not_ the size of the find bar, just the bounding 117 // box it should be laid out within. The coordinate system of the returned 118 // rect is in the coordinate system of the frame, since the FindBar is a child 119 // window. 120 gfx::Rect GetFindBarBoundingBox() const; 121 122 // Returns the preferred height of the TabStrip. Used to position the OTR 123 // avatar icon. 124 virtual int GetTabStripHeight() const; 125 126 // Takes some view's origin (relative to this BrowserView) and offsets it such 127 // that it can be used as the source origin for seamlessly tiling the toolbar 128 // background image over that view. 129 gfx::Point OffsetPointForToolbarBackgroundImage( 130 const gfx::Point& point) const; 131 132 // Returns the width of the currently displayed sidebar or 0. 133 int GetSidebarWidth() const; 134 135 // Accessor for the TabStrip. 136 AbstractTabStripView* tabstrip() const { return tabstrip_; } 137 138 // Accessor for the Toolbar. 139 ToolbarView* toolbar() const { return toolbar_; } 140 141 // Returns true if various window components are visible. 142 virtual bool IsTabStripVisible() const; 143 144 // Returns true if the vertical tabstrip is in use. 145 bool UseVerticalTabs() const; 146 147 // Returns true if the profile associated with this Browser window is 148 // incognito. 149 bool IsOffTheRecord() const; 150 151 // Returns true if the non-client view should render the Incognito 152 // avatar icon if the window is incognito. 153 virtual bool ShouldShowOffTheRecordAvatar() const; 154 155 // Handle the specified |accelerator| being pressed. 156 virtual bool AcceleratorPressed(const views::Accelerator& accelerator); 157 158 // Provides the containing frame with the accelerator for the specified 159 // command id. This can be used to provide menu item shortcut hints etc. 160 // Returns true if an accelerator was found for the specified |cmd_id|, false 161 // otherwise. 162 bool GetAccelerator(int cmd_id, ui::Accelerator* accelerator); 163 164 // Shows the next app-modal dialog box, if there is one to be shown, or moves 165 // an existing showing one to the front. Returns true if one was shown or 166 // activated, false if none was shown. 167 bool ActivateAppModalDialog() const; 168 169 // Returns the selected TabContents[Wrapper]. Used by our NonClientView's 170 // TabIconView::TabContentsProvider implementations. 171 // TODO(beng): exposing this here is a bit bogus, since it's only used to 172 // determine loading state. It'd be nicer if we could change this to be 173 // bool IsSelectedTabLoading() const; or something like that. We could even 174 // move it to a WindowDelegate subclass. 175 TabContents* GetSelectedTabContents() const; 176 TabContentsWrapper* GetSelectedTabContentsWrapper() const; 177 178 // Retrieves the icon to use in the frame to indicate an OTR window. 179 SkBitmap GetOTRAvatarIcon(); 180 181 #if defined(OS_WIN) 182 // Called right before displaying the system menu to allow the BrowserView 183 // to add or delete entries. 184 void PrepareToRunSystemMenu(HMENU menu); 185 #endif 186 187 // Returns true if the Browser object associated with this BrowserView is a 188 // normal-type window (i.e. a browser window, not an app or popup). 189 bool IsBrowserTypeNormal() const { 190 return browser_->type() == Browser::TYPE_NORMAL; 191 } 192 193 // Returns true if the Browser object associated with this BrowserView is a 194 // app panel window. 195 bool IsBrowserTypePanel() const { 196 return browser_->type() == Browser::TYPE_APP_PANEL; 197 } 198 199 // Returns true if the Browser object associated with this BrowserView is a 200 // popup window. 201 bool IsBrowserTypePopup() const { 202 return (browser_->type() & Browser::TYPE_POPUP) != 0; 203 } 204 205 // Register preferences specific to this view. 206 static void RegisterBrowserViewPrefs(PrefService* prefs); 207 208 // Returns true if the specified point(BrowserView coordinates) is in 209 // in the window caption area of the browser window. 210 bool IsPositionInWindowCaption(const gfx::Point& point); 211 212 // Returns whether the fullscreen bubble is visible or not. 213 virtual bool IsFullscreenBubbleVisible() const; 214 215 // Invoked from the frame when the full screen state changes. This is only 216 // used on Linux. 217 void FullScreenStateChanged(); 218 219 // Restores the focused view. This is also used to set the initial focus 220 // when a new browser window is created. 221 void RestoreFocus(); 222 223 // Overridden from BrowserWindow: 224 virtual void Show() OVERRIDE; 225 virtual void ShowInactive() OVERRIDE; 226 virtual void SetBounds(const gfx::Rect& bounds) OVERRIDE; 227 virtual void Close() OVERRIDE; 228 virtual void Activate() OVERRIDE; 229 virtual void Deactivate() OVERRIDE; 230 virtual bool IsActive() const OVERRIDE; 231 virtual void FlashFrame() OVERRIDE; 232 virtual gfx::NativeWindow GetNativeHandle() OVERRIDE; 233 virtual BrowserWindowTesting* GetBrowserWindowTesting() OVERRIDE; 234 virtual StatusBubble* GetStatusBubble() OVERRIDE; 235 virtual void ToolbarSizeChanged(bool is_animating) OVERRIDE; 236 virtual void UpdateTitleBar() OVERRIDE; 237 virtual void ShelfVisibilityChanged() OVERRIDE; 238 virtual void UpdateDevTools() OVERRIDE; 239 virtual void UpdateLoadingAnimations(bool should_animate) OVERRIDE; 240 virtual void SetStarredState(bool is_starred) OVERRIDE; 241 virtual gfx::Rect GetRestoredBounds() const OVERRIDE; 242 virtual gfx::Rect GetBounds() const OVERRIDE; 243 virtual bool IsMaximized() const OVERRIDE; 244 virtual void SetFullscreen(bool fullscreen) OVERRIDE; 245 virtual bool IsFullscreen() const OVERRIDE; 246 virtual LocationBar* GetLocationBar() const OVERRIDE; 247 virtual void SetFocusToLocationBar(bool select_all) OVERRIDE; 248 virtual void UpdateReloadStopState(bool is_loading, bool force) OVERRIDE; 249 virtual void UpdateToolbar(TabContentsWrapper* contents, 250 bool should_restore_state) OVERRIDE; 251 virtual void FocusToolbar() OVERRIDE; 252 virtual void FocusAppMenu() OVERRIDE; 253 virtual void FocusBookmarksToolbar() OVERRIDE; 254 virtual void FocusChromeOSStatus() OVERRIDE {} 255 virtual void RotatePaneFocus(bool forwards) OVERRIDE; 256 virtual void DestroyBrowser() OVERRIDE; 257 virtual bool IsBookmarkBarVisible() const OVERRIDE; 258 virtual bool IsBookmarkBarAnimating() const OVERRIDE; 259 virtual bool IsTabStripEditable() const OVERRIDE; 260 virtual bool IsToolbarVisible() const OVERRIDE; 261 virtual void DisableInactiveFrame() OVERRIDE; 262 virtual void ConfirmSetDefaultSearchProvider( 263 TabContents* tab_contents, 264 TemplateURL* template_url, 265 TemplateURLModel* template_url_model) OVERRIDE; 266 virtual void ConfirmAddSearchProvider(const TemplateURL* template_url, 267 Profile* profile) OVERRIDE; 268 virtual void ToggleBookmarkBar() OVERRIDE; 269 virtual void ShowAboutChromeDialog() OVERRIDE; 270 virtual void ShowUpdateChromeDialog() OVERRIDE; 271 virtual void ShowTaskManager() OVERRIDE; 272 virtual void ShowBackgroundPages() OVERRIDE; 273 virtual void ShowBookmarkBubble(const GURL& url, bool already_bookmarked) 274 OVERRIDE; 275 // TODO(beng): Not an override, move somewhere else. 276 void SetDownloadShelfVisible(bool visible); 277 virtual bool IsDownloadShelfVisible() const OVERRIDE; 278 virtual DownloadShelf* GetDownloadShelf() OVERRIDE; 279 virtual void ShowRepostFormWarningDialog(TabContents* tab_contents) OVERRIDE; 280 virtual void ShowCollectedCookiesDialog(TabContents* tab_contents) OVERRIDE; 281 virtual void ShowThemeInstallBubble() OVERRIDE; 282 virtual void ConfirmBrowserCloseWithPendingDownloads() OVERRIDE; 283 virtual void ShowHTMLDialog(HtmlDialogUIDelegate* delegate, 284 gfx::NativeWindow parent_window) OVERRIDE; 285 virtual void UserChangedTheme() OVERRIDE; 286 virtual int GetExtraRenderViewHeight() const OVERRIDE; 287 virtual void TabContentsFocused(TabContents* source) OVERRIDE; 288 virtual void ShowPageInfo(Profile* profile, 289 const GURL& url, 290 const NavigationEntry::SSLStatus& ssl, 291 bool show_history) OVERRIDE; 292 virtual void ShowAppMenu() OVERRIDE; 293 virtual bool PreHandleKeyboardEvent(const NativeWebKeyboardEvent& event, 294 bool* is_keyboard_shortcut) OVERRIDE; 295 virtual void HandleKeyboardEvent(const NativeWebKeyboardEvent& event) 296 OVERRIDE; 297 virtual void ShowCreateWebAppShortcutsDialog(TabContentsWrapper* tab_contents) 298 OVERRIDE; 299 virtual void ShowCreateChromeAppShortcutsDialog( 300 Profile*, const Extension* app) OVERRIDE; 301 virtual void Cut() OVERRIDE; 302 virtual void Copy() OVERRIDE; 303 virtual void Paste() OVERRIDE; 304 virtual void ToggleTabStripMode() OVERRIDE; 305 virtual void PrepareForInstant() OVERRIDE; 306 virtual void ShowInstant(TabContentsWrapper* preview) OVERRIDE; 307 virtual void HideInstant(bool instant_is_active) OVERRIDE; 308 virtual gfx::Rect GetInstantBounds() OVERRIDE; 309 #if defined(OS_CHROMEOS) 310 virtual void ShowKeyboardOverlay(gfx::NativeWindow owning_window) OVERRIDE; 311 #endif 312 313 // Overridden from BrowserWindowTesting: 314 virtual BookmarkBarView* GetBookmarkBarView() const OVERRIDE; 315 virtual LocationBarView* GetLocationBarView() const OVERRIDE; 316 virtual views::View* GetTabContentsContainerView() const OVERRIDE; 317 virtual views::View* GetSidebarContainerView() const OVERRIDE; 318 virtual ToolbarView* GetToolbarView() const OVERRIDE; 319 320 // Overridden from NotificationObserver: 321 virtual void Observe(NotificationType type, 322 const NotificationSource& source, 323 const NotificationDetails& details) OVERRIDE; 324 325 // Overridden from TabStripModelObserver: 326 virtual void TabDetachedAt(TabContentsWrapper* contents, int index) OVERRIDE; 327 virtual void TabDeselected(TabContentsWrapper* contents) OVERRIDE; 328 virtual void TabSelectedAt(TabContentsWrapper* old_contents, 329 TabContentsWrapper* new_contents, 330 int index, 331 bool user_gesture) OVERRIDE; 332 virtual void TabReplacedAt(TabStripModel* tab_strip_model, 333 TabContentsWrapper* old_contents, 334 TabContentsWrapper* new_contents, 335 int index) OVERRIDE; 336 virtual void TabStripEmpty() OVERRIDE; 337 338 // Overridden from ui::SimpleMenuModel::Delegate: 339 virtual bool IsCommandIdChecked(int command_id) const OVERRIDE; 340 virtual bool IsCommandIdEnabled(int command_id) const OVERRIDE; 341 virtual bool GetAcceleratorForCommandId( 342 int command_id, ui::Accelerator* accelerator) OVERRIDE; 343 virtual bool IsItemForCommandIdDynamic(int command_id) const OVERRIDE; 344 virtual string16 GetLabelForCommandId(int command_id) const OVERRIDE; 345 virtual void ExecuteCommand(int command_id) OVERRIDE; 346 347 // Overridden from views::WindowDelegate: 348 virtual bool CanResize() const OVERRIDE; 349 virtual bool CanMaximize() const OVERRIDE; 350 virtual bool CanActivate() const OVERRIDE; 351 virtual bool IsModal() const OVERRIDE; 352 virtual std::wstring GetWindowTitle() const OVERRIDE; 353 virtual std::wstring GetAccessibleWindowTitle() const OVERRIDE; 354 virtual views::View* GetInitiallyFocusedView() OVERRIDE; 355 virtual bool ShouldShowWindowTitle() const OVERRIDE; 356 virtual SkBitmap GetWindowAppIcon() OVERRIDE; 357 virtual SkBitmap GetWindowIcon() OVERRIDE; 358 virtual bool ShouldShowWindowIcon() const OVERRIDE; 359 virtual bool ExecuteWindowsCommand(int command_id) OVERRIDE; 360 virtual std::wstring GetWindowName() const OVERRIDE; 361 virtual void SaveWindowPlacement(const gfx::Rect& bounds, 362 bool maximized) OVERRIDE; 363 virtual bool GetSavedWindowBounds(gfx::Rect* bounds) const OVERRIDE; 364 virtual bool GetSavedMaximizedState(bool* maximized) const OVERRIDE; 365 virtual views::View* GetContentsView() OVERRIDE; 366 virtual views::ClientView* CreateClientView(views::Window* window) OVERRIDE; 367 virtual void OnWindowActivationChanged(bool active) OVERRIDE; 368 virtual void OnWindowBeginUserBoundsChange() OVERRIDE; 369 virtual void OnWidgetMove() OVERRIDE; 370 371 // Overridden from views::ClientView: 372 virtual bool CanClose() OVERRIDE; 373 virtual int NonClientHitTest(const gfx::Point& point) OVERRIDE; 374 virtual gfx::Size GetMinimumSize() OVERRIDE; 375 376 // InfoBarContainer::Delegate overrides 377 virtual SkColor GetInfoBarSeparatorColor() const OVERRIDE; 378 virtual void InfoBarContainerStateChanged(bool is_animating) OVERRIDE; 379 virtual bool DrawInfoBarArrows(int* x) const OVERRIDE; 380 381 // views::SingleSplitView::Observer overrides: 382 virtual bool SplitHandleMoved(views::SingleSplitView* view) OVERRIDE; 383 384 protected: 385 // Appends to |toolbars| a pointer to each AccessiblePaneView that 386 // can be traversed using F6, in the order they should be traversed. 387 // Abstracted here so that it can be extended for Chrome OS. 388 virtual void GetAccessiblePanes( 389 std::vector<AccessiblePaneView*>* panes); 390 391 // Save the current focused view to view storage 392 void SaveFocusedView(); 393 394 int last_focused_view_storage_id() const { 395 return last_focused_view_storage_id_; 396 } 397 398 // Overridden from views::View: 399 virtual std::string GetClassName() const OVERRIDE; 400 virtual void Layout() OVERRIDE; 401 virtual void PaintChildren(gfx::Canvas* canvas) OVERRIDE; 402 virtual void ViewHierarchyChanged(bool is_add, 403 views::View* parent, 404 views::View* child) OVERRIDE; 405 virtual void ChildPreferredSizeChanged(View* child) OVERRIDE; 406 virtual void GetAccessibleState(ui::AccessibleViewState* state) OVERRIDE; 407 408 // Factory Method. 409 // Returns a new LayoutManager for this browser view. A subclass may 410 // override to implement different layout policy. 411 virtual views::LayoutManager* CreateLayoutManager() const; 412 413 // Initializes a new TabStrip for the browser view. This can be performed 414 // multiple times over the life of the browser, and is run when the display 415 // mode for the tabstrip changes from horizontal to vertical. 416 virtual void InitTabStrip(TabStripModel* tab_strip_model); 417 418 // Factory Method. 419 // Returns a new ToolbarView for this browser view. A subclass may 420 // override to implement different layout policy. 421 virtual ToolbarView* CreateToolbar() const; 422 423 // Browser window related initializations. 424 virtual void Init(); 425 426 // Callback for the loading animation(s) associated with this view. 427 virtual void LoadingAnimationCallback(); 428 429 private: 430 friend class BrowserViewLayout; 431 FRIEND_TEST_ALL_PREFIXES(BrowserViewsAccessibilityTest, 432 TestAboutChromeViewAccObj); 433 434 #if defined(OS_WIN) 435 // Creates the system menu. 436 void InitSystemMenu(); 437 #endif 438 439 // Returns the BrowserViewLayout. 440 BrowserViewLayout* GetBrowserViewLayout() const; 441 442 // Layout the Status Bubble. 443 void LayoutStatusBubble(); 444 445 // Prepare to show the Bookmark Bar for the specified TabContents. Returns 446 // true if the Bookmark Bar can be shown (i.e. it's supported for this 447 // Browser type) and there should be a subsequent re-layout to show it. 448 // |contents| can be NULL. 449 bool MaybeShowBookmarkBar(TabContentsWrapper* contents); 450 451 // Prepare to show an Info Bar for the specified TabContents. Returns true 452 // if there is an Info Bar to show and one is supported for this Browser 453 // type, and there should be a subsequent re-layout to show it. 454 // |contents| can be NULL. 455 bool MaybeShowInfoBar(TabContentsWrapper* contents); 456 457 // Updates sidebar UI according to the current tab and sidebar state. 458 void UpdateSidebar(); 459 // Displays active sidebar linked to the |tab_contents| or hides sidebar UI, 460 // if there's no such sidebar. 461 void UpdateSidebarForContents(TabContentsWrapper* tab_contents); 462 463 // Updated devtools window for given contents. 464 void UpdateDevToolsForContents(TabContentsWrapper* tab_contents); 465 466 // Updates various optional child Views, e.g. Bookmarks Bar, Info Bar or the 467 // Download Shelf in response to a change notification from the specified 468 // |contents|. |contents| can be NULL. In this case, all optional UI will be 469 // removed. 470 void UpdateUIForContents(TabContentsWrapper* contents); 471 472 // Updates an optional child View, e.g. Bookmarks Bar, Info Bar, Download 473 // Shelf. If |*old_view| differs from new_view, the old_view is removed and 474 // the new_view is added. This is intended to be used when swapping in/out 475 // child views that are referenced via a field. 476 // Returns true if anything was changed, and a re-Layout is now required. 477 bool UpdateChildViewAndLayout(views::View* new_view, views::View** old_view); 478 479 // Invoked to update the necessary things when our fullscreen state changes 480 // to |fullscreen|. On Windows this is invoked immediately when we toggle the 481 // full screen state. On Linux changing the fullscreen state is async, so we 482 // ask the window to change it's fullscreen state, then when we get 483 // notification that it succeeded this method is invoked. 484 void ProcessFullscreen(bool fullscreen); 485 486 // Copy the accelerator table from the app resources into something we can 487 // use. 488 void LoadAccelerators(); 489 490 #if defined(OS_WIN) 491 // Builds the correct menu for when we have minimal chrome. 492 void BuildSystemMenuForBrowserWindow(); 493 void BuildSystemMenuForAppOrPopupWindow(bool is_app); 494 #endif 495 496 // Retrieves the command id for the specified Windows app command. 497 int GetCommandIDForAppCommandID(int app_command_id) const; 498 499 // Initialize the hung plugin detector. 500 void InitHangMonitor(); 501 502 // Possibly records a user metrics action corresponding to the passed-in 503 // accelerator. Only implemented for Chrome OS, where we're interested in 504 // learning about how frequently the top-row keys are used. 505 void UpdateAcceleratorMetrics(const views::Accelerator& accelerator, 506 int command_id); 507 508 // Invoked from TabSelectedAt or when instant is made active. Is 509 // |change_tab_contents| is true, |new_contents| is added to the view 510 // hierarchy, if |change_tab_contents| is false, it's assumed |new_contents| 511 // has already been added to the view hierarchy. 512 void ProcessTabSelected(TabContentsWrapper* new_contents, 513 bool change_tab_contents); 514 515 // Exposes resize corner size to BrowserViewLayout. 516 gfx::Size GetResizeCornerSize() const; 517 518 // Shows the about chrome modal dialog and returns the Window object. 519 views::Window* DoShowAboutChromeDialog(); 520 521 // Set the value of |toolbar_| and hook it into the views hiearchy 522 void SetToolbar(ToolbarView* toolbar); 523 524 // Last focused view that issued a tab traversal. 525 int last_focused_view_storage_id_; 526 527 // The BrowserFrame that hosts this view. 528 BrowserFrame* frame_; 529 530 // The Browser object we are associated with. 531 scoped_ptr<Browser> browser_; 532 533 // BrowserView layout (LTR one is pictured here). 534 // 535 // -------------------------------------------------------------------------- 536 // | | Tabs (1) | 537 // | |--------------------------------------------------------------| 538 // | | Navigation buttons, menus and the address bar (toolbar_) | 539 // | |--------------------------------------------------------------| 540 // | | All infobars (infobar_container_) * | 541 // | |--------------------------------------------------------------| 542 // | | Bookmarks (bookmark_bar_view_) * | 543 // | |--------------------------------------------------------------| 544 // | |Page content (contents_) || | 545 // | |--------------------------------------|| Sidebar content | 546 // | || contents_container_ and/or ||| (sidebar_container_) | 547 // | || preview_container_ ||| | 548 // | || |(3) | 549 // | Tabs (2)|| ||| | 550 // | || ||| | 551 // | || ||| | 552 // | || ||| | 553 // | |--------------------------------------|| | 554 // | |==(4)=========================================================| 555 // | | | 556 // | | | 557 // | | Debugger (devtools_container_) | 558 // | | | 559 // | | | 560 // | |--------------------------------------------------------------| 561 // | | Active downloads (download_shelf_) | 562 // -------------------------------------------------------------------------- 563 // 564 // (1) - tabstrip_, default position 565 // (2) - tabstrip_, position when side tabs are enabled 566 // (3) - sidebar_split_ 567 // (4) - contents_split_ 568 // 569 // * - The bookmark bar and info bar are swapped when on the new tab page. 570 // Additionally contents_ is positioned on top of the bookmark bar when 571 // the bookmark bar is detached. This is done to allow the 572 // preview_container_ to appear over the bookmark bar. 573 574 // Tool/Info bars that we are currently showing. Used for layout. 575 // active_bookmark_bar_ is either NULL, if the bookmark bar isn't showing, 576 // or is bookmark_bar_view_ if the bookmark bar is showing. 577 views::View* active_bookmark_bar_; 578 579 // The TabStrip. 580 AbstractTabStripView* tabstrip_; 581 582 // The Toolbar containing the navigation buttons, menus and the address bar. 583 ToolbarView* toolbar_; 584 585 // The Bookmark Bar View for this window. Lazily created. 586 scoped_ptr<BookmarkBarView> bookmark_bar_view_; 587 588 // The download shelf view (view at the bottom of the page). 589 scoped_ptr<DownloadShelfView> download_shelf_; 590 591 // The InfoBarContainerView that contains InfoBars for the current tab. 592 InfoBarContainerView* infobar_container_; 593 594 // The view that contains sidebar for the current tab. 595 TabContentsContainer* sidebar_container_; 596 597 // Split view containing the contents container and sidebar container. 598 views::SingleSplitView* sidebar_split_; 599 600 // The view that contains the selected TabContents. 601 TabContentsContainer* contents_container_; 602 603 // The view that contains devtools window for the selected TabContents. 604 TabContentsContainer* devtools_container_; 605 606 // The view that contains instant's TabContents. 607 TabContentsContainer* preview_container_; 608 609 // The view managing both the contents_container_ and preview_container_. 610 ContentsContainer* contents_; 611 612 // Split view containing the contents container and devtools container. 613 views::SingleSplitView* contents_split_; 614 615 // Tracks and stores the last focused view which is not the 616 // devtools_container_ or any of its children. Used to restore focus once 617 // the devtools_container_ is hidden. 618 scoped_ptr<views::ExternalFocusTracker> devtools_focus_tracker_; 619 620 // The Status information bubble that appears at the bottom of the window. 621 scoped_ptr<StatusBubbleViews> status_bubble_; 622 623 // A mapping between accelerators and commands. 624 std::map<views::Accelerator, int> accelerator_table_; 625 626 // True if we have already been initialized. 627 bool initialized_; 628 629 // True if we should ignore requests to layout. This is set while toggling 630 // fullscreen mode on and off to reduce jankiness. 631 bool ignore_layout_; 632 633 scoped_ptr<FullscreenExitBubble> fullscreen_bubble_; 634 635 #if defined(OS_WIN) 636 // The additional items we insert into the system menu. 637 scoped_ptr<views::SystemMenuModel> system_menu_contents_; 638 scoped_ptr<ZoomMenuModel> zoom_menu_contents_; 639 scoped_ptr<EncodingMenuModel> encoding_menu_contents_; 640 // The wrapped system menu itself. 641 scoped_ptr<views::NativeMenuWin> system_menu_; 642 643 // This object is used to perform periodic actions in a worker 644 // thread. It is currently used to monitor hung plugin windows. 645 WorkerThreadTicker ticker_; 646 647 // This object is initialized with the frame window HWND. This 648 // object is also passed as a tick handler with the ticker_ object. 649 // It is used to periodically monitor for hung plugin windows 650 HungWindowDetector hung_window_detector_; 651 652 // This object is invoked by hung_window_detector_ when it detects a hung 653 // plugin window. 654 HungPluginAction hung_plugin_action_; 655 656 // The custom JumpList for Windows 7. 657 scoped_ptr<JumpList> jumplist_; 658 659 // The custom AeroPeek manager for Windows 7. 660 scoped_ptr<AeroPeekManager> aeropeek_manager_; 661 #endif 662 663 // The timer used to update frames for the Loading Animation. 664 base::RepeatingTimer<BrowserView> loading_animation_timer_; 665 666 UnhandledKeyboardEventHandler unhandled_keyboard_event_handler_; 667 668 NotificationRegistrar registrar_; 669 670 // Used to measure the loading spinner animation rate. 671 base::TimeTicks last_animation_time_; 672 673 DISALLOW_COPY_AND_ASSIGN(BrowserView); 674 }; 675 676 #endif // CHROME_BROWSER_UI_VIEWS_FRAME_BROWSER_VIEW_H_ 677