| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CHROME_BROWSER_UI_VIEWS_FRAME_BROWSER_VIEW_H_ | 5 #ifndef CHROME_BROWSER_UI_VIEWS_FRAME_BROWSER_VIEW_H_ |
| 6 #define CHROME_BROWSER_UI_VIEWS_FRAME_BROWSER_VIEW_H_ | 6 #define CHROME_BROWSER_UI_VIEWS_FRAME_BROWSER_VIEW_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 165 // Accessor for the InfobarContainer. | 165 // Accessor for the InfobarContainer. |
| 166 InfoBarContainerView* infobar_container() { return infobar_container_; } | 166 InfoBarContainerView* infobar_container() { return infobar_container_; } |
| 167 | 167 |
| 168 // Returns true if various window components are visible. | 168 // Returns true if various window components are visible. |
| 169 bool IsTabStripVisible() const; | 169 bool IsTabStripVisible() const; |
| 170 | 170 |
| 171 // Returns true if the profile associated with this Browser window is | 171 // Returns true if the profile associated with this Browser window is |
| 172 // incognito. | 172 // incognito. |
| 173 bool IsOffTheRecord() const; | 173 bool IsOffTheRecord() const; |
| 174 | 174 |
| 175 // Returns the resource ID to use for the OTR icon, which depends on |
| 176 // which layout is being shown and whether we are full-screen. |
| 177 int GetOTRIconResourceID() const; |
| 178 |
| 175 // Returns true if the profile associated with this Browser window is | 179 // Returns true if the profile associated with this Browser window is |
| 176 // a guest session. | 180 // a guest session. |
| 177 bool IsGuestSession() const; | 181 bool IsGuestSession() const; |
| 178 | 182 |
| 179 // Returns true if the non-client view should render an avatar icon. | 183 // Returns true if the non-client view should render an avatar icon. |
| 180 virtual bool ShouldShowAvatar() const; | 184 bool ShouldShowAvatar() const; |
| 181 | |
| 182 // Handle the specified |accelerator| being pressed. | |
| 183 virtual bool AcceleratorPressed(const ui::Accelerator& accelerator) OVERRIDE; | |
| 184 | 185 |
| 185 // Provides the containing frame with the accelerator for the specified | 186 // Provides the containing frame with the accelerator for the specified |
| 186 // command id. This can be used to provide menu item shortcut hints etc. | 187 // command id. This can be used to provide menu item shortcut hints etc. |
| 187 // Returns true if an accelerator was found for the specified |cmd_id|, false | 188 // Returns true if an accelerator was found for the specified |cmd_id|, false |
| 188 // otherwise. | 189 // otherwise. |
| 189 bool GetAccelerator(int cmd_id, ui::Accelerator* accelerator); | 190 bool GetAccelerator(int cmd_id, ui::Accelerator* accelerator); |
| 190 | 191 |
| 191 // Returns true if the specificed |accelerator| is registered with this view. | 192 // Returns true if the specificed |accelerator| is registered with this view. |
| 192 bool IsAcceleratorRegistered(const ui::Accelerator& accelerator); | 193 bool IsAcceleratorRegistered(const ui::Accelerator& accelerator); |
| 193 | 194 |
| (...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 417 virtual SkColor GetInfoBarSeparatorColor() const OVERRIDE; | 418 virtual SkColor GetInfoBarSeparatorColor() const OVERRIDE; |
| 418 virtual void InfoBarContainerStateChanged(bool is_animating) OVERRIDE; | 419 virtual void InfoBarContainerStateChanged(bool is_animating) OVERRIDE; |
| 419 virtual bool DrawInfoBarArrows(int* x) const OVERRIDE; | 420 virtual bool DrawInfoBarArrows(int* x) const OVERRIDE; |
| 420 | 421 |
| 421 // views::SingleSplitViewListener overrides: | 422 // views::SingleSplitViewListener overrides: |
| 422 virtual bool SplitHandleMoved(views::SingleSplitView* sender) OVERRIDE; | 423 virtual bool SplitHandleMoved(views::SingleSplitView* sender) OVERRIDE; |
| 423 | 424 |
| 424 // gfx::SysColorChangeListener overrides: | 425 // gfx::SysColorChangeListener overrides: |
| 425 virtual void OnSysColorChange() OVERRIDE; | 426 virtual void OnSysColorChange() OVERRIDE; |
| 426 | 427 |
| 427 // Returns the resource ID to use for the OTR icon, which depends on | |
| 428 // which layout is being shown and whether we are full-screen. | |
| 429 int GetOTRIconResourceID() const; | |
| 430 | |
| 431 // Overridden from views::View: | 428 // Overridden from views::View: |
| 432 virtual std::string GetClassName() const OVERRIDE; | 429 virtual std::string GetClassName() const OVERRIDE; |
| 433 virtual void Layout() OVERRIDE; | 430 virtual void Layout() OVERRIDE; |
| 434 virtual void PaintChildren(gfx::Canvas* canvas) OVERRIDE; | 431 virtual void PaintChildren(gfx::Canvas* canvas) OVERRIDE; |
| 435 virtual void ViewHierarchyChanged(bool is_add, | 432 virtual void ViewHierarchyChanged(bool is_add, |
| 436 views::View* parent, | 433 views::View* parent, |
| 437 views::View* child) OVERRIDE; | 434 views::View* child) OVERRIDE; |
| 438 virtual void ChildPreferredSizeChanged(View* child) OVERRIDE; | 435 virtual void ChildPreferredSizeChanged(View* child) OVERRIDE; |
| 439 virtual void GetAccessibleState(ui::AccessibleViewState* state) OVERRIDE; | 436 virtual void GetAccessibleState(ui::AccessibleViewState* state) OVERRIDE; |
| 440 | 437 |
| 438 // Overridden from ui::AcceleratorTarget: |
| 439 virtual bool AcceleratorPressed(const ui::Accelerator& accelerator) OVERRIDE; |
| 440 |
| 441 // Testing interface: |
| 441 views::SingleSplitView* GetContentsSplitForTest() { return contents_split_; } | 442 views::SingleSplitView* GetContentsSplitForTest() { return contents_split_; } |
| 442 // TODO(jamescook): Rename |contents_| and |contents_container_|. | 443 ContentsContainer* GetContentsContainerForTest() { |
| 443 ContentsContainer* GetContentsContainerForTest() { return contents_; } | 444 return contents_container_; |
| 444 views::WebView* GetContentsWebViewForTest() { return contents_container_; } | 445 } |
| 445 | 446 views::WebView* GetContentsWebViewForTest() { return contents_web_view_; } |
| 446 protected: | |
| 447 // Appends to |toolbars| a pointer to each AccessiblePaneView that | |
| 448 // can be traversed using F6, in the order they should be traversed. | |
| 449 // Abstracted here so that it can be extended for Chrome OS. | |
| 450 void GetAccessiblePanes(std::vector<views::AccessiblePaneView*>* panes); | |
| 451 | |
| 452 // Browser window related initializations. | |
| 453 void Init(); | |
| 454 | |
| 455 // Callback for the loading animation(s) associated with this view. | |
| 456 void LoadingAnimationCallback(); | |
| 457 | |
| 458 // LoadCompleteListener::Delegate implementation. Creates and initializes the | |
| 459 // |jumplist_| after the first page load. | |
| 460 virtual void OnLoadCompleted() OVERRIDE; | |
| 461 | 447 |
| 462 private: | 448 private: |
| 463 friend class BrowserViewLayout; | 449 friend class BrowserViewLayout; |
| 464 FRIEND_TEST_ALL_PREFIXES(BrowserViewsAccessibilityTest, | 450 FRIEND_TEST_ALL_PREFIXES(BrowserViewsAccessibilityTest, |
| 465 TestAboutChromeViewAccObj); | 451 TestAboutChromeViewAccObj); |
| 466 | 452 |
| 467 enum FullscreenType { | 453 enum FullscreenType { |
| 468 FOR_DESKTOP, | 454 FOR_DESKTOP, |
| 469 FOR_METRO | 455 FOR_METRO |
| 470 }; | 456 }; |
| 471 | 457 |
| 472 // We store this on linux because we must call ProcessFullscreen() | 458 // We store this on linux because we must call ProcessFullscreen() |
| 473 // asynchronously from FullScreenStateChanged() instead of directly from | 459 // asynchronously from FullScreenStateChanged() instead of directly from |
| 474 // EnterFullscreen(). | 460 // EnterFullscreen(). |
| 475 struct PendingFullscreenRequest { | 461 struct PendingFullscreenRequest { |
| 476 PendingFullscreenRequest() | 462 PendingFullscreenRequest() |
| 477 : pending(false), | 463 : pending(false), |
| 478 bubble_type(FEB_TYPE_NONE) {} | 464 bubble_type(FEB_TYPE_NONE) {} |
| 479 | 465 |
| 480 bool pending; | 466 bool pending; |
| 481 GURL url; | 467 GURL url; |
| 482 FullscreenExitBubbleType bubble_type; | 468 FullscreenExitBubbleType bubble_type; |
| 483 }; | 469 }; |
| 484 | 470 |
| 471 // Appends to |toolbars| a pointer to each AccessiblePaneView that |
| 472 // can be traversed using F6, in the order they should be traversed. |
| 473 void GetAccessiblePanes(std::vector<views::AccessiblePaneView*>* panes); |
| 474 |
| 475 // Browser window related initializations. |
| 476 void Init(); |
| 477 |
| 478 // Callback for the loading animation(s) associated with this view. |
| 479 void LoadingAnimationCallback(); |
| 480 |
| 481 // LoadCompleteListener::Delegate implementation. Creates and initializes the |
| 482 // |jumplist_| after the first page load. |
| 483 virtual void OnLoadCompleted() OVERRIDE; |
| 484 |
| 485 // Returns the BrowserViewLayout. | 485 // Returns the BrowserViewLayout. |
| 486 BrowserViewLayout* GetBrowserViewLayout() const; | 486 BrowserViewLayout* GetBrowserViewLayout() const; |
| 487 | 487 |
| 488 // Layout the Status Bubble. | 488 // Layout the Status Bubble. |
| 489 void LayoutStatusBubble(); | 489 void LayoutStatusBubble(); |
| 490 | 490 |
| 491 // Prepare to show the Bookmark Bar for the specified WebContents. | 491 // Prepare to show the Bookmark Bar for the specified WebContents. |
| 492 // Returns true if the Bookmark Bar can be shown (i.e. it's supported for this | 492 // Returns true if the Bookmark Bar can be shown (i.e. it's supported for this |
| 493 // Browser type) and there should be a subsequent re-layout to show it. | 493 // Browser type) and there should be a subsequent re-layout to show it. |
| 494 // |contents| can be NULL. | 494 // |contents| can be NULL. |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 602 // | |------------------------------------------------------------| | | 602 // | |------------------------------------------------------------| | |
| 603 // | | Navigation buttons, address bar, menu (toolbar_) | | | 603 // | | Navigation buttons, address bar, menu (toolbar_) | | |
| 604 // | -------------------------------------------------------------- | | 604 // | -------------------------------------------------------------- | |
| 605 // |------------------------------------------------------------------| | 605 // |------------------------------------------------------------------| |
| 606 // | All infobars (infobar_container_) [1] | | 606 // | All infobars (infobar_container_) [1] | |
| 607 // |------------------------------------------------------------------| | 607 // |------------------------------------------------------------------| |
| 608 // | Bookmarks (bookmark_bar_view_) [1] | | 608 // | Bookmarks (bookmark_bar_view_) [1] | |
| 609 // |------------------------------------------------------------------| | 609 // |------------------------------------------------------------------| |
| 610 // | Debugger splitter (contents_split_) | | 610 // | Debugger splitter (contents_split_) | |
| 611 // | -------------------------------------------------------------- | | 611 // | -------------------------------------------------------------- | |
| 612 // | | Page content (contents_) | | | 612 // | | Page content (contents_container_) | | |
| 613 // | | -------------------------------------------------------- | | | 613 // | | -------------------------------------------------------- | | |
| 614 // | | | contents_container_ and/or | | | | 614 // | | | contents_web_view_ and/or | | | |
| 615 // | | | overlay_controller_->overlay_container_ | | | | 615 // | | | overlay_controller_->overlay_ | | | |
| 616 // | | | | | | | 616 // | | | | | | |
| 617 // | | | | | | | 617 // | | | | | | |
| 618 // | | -------------------------------------------------------- | | | 618 // | | -------------------------------------------------------- | | |
| 619 // | -------------------------------------------------------------- | | 619 // | -------------------------------------------------------------- | |
| 620 // | -------------------------------------------------------------- | | 620 // | -------------------------------------------------------------- | |
| 621 // | | Debugger (devtools_container_) | | | 621 // | | Debugger (devtools_container_) | | |
| 622 // | | | | | 622 // | | | | |
| 623 // | -------------------------------------------------------------- | | 623 // | -------------------------------------------------------------- | |
| 624 // |------------------------------------------------------------------| | 624 // |------------------------------------------------------------------| |
| 625 // | Active downloads (download_shelf_) | | 625 // | Active downloads (download_shelf_) | |
| 626 // -------------------------------------------------------------------- | 626 // -------------------------------------------------------------------- |
| 627 // | 627 // |
| 628 // [1] The bookmark bar and info bar are swapped when on the new tab page. | 628 // [1] The bookmark bar and info bar are swapped when on the new tab page. |
| 629 // Additionally contents_ is positioned on top of the bookmark bar when | 629 // Additionally contents_container_ is positioned on top of the bookmark |
| 630 // the bookmark bar is detached. This is done to allow the | 630 // bar when the bookmark bar is detached. This is done to allow the |
| 631 // overlay_controller_->overlay_container_ to appear over the bookmark | 631 // overlay_controller_->overlay_ to appear over the bookmark bar. |
| 632 // bar. | |
| 633 | 632 |
| 634 // The view that manages the tab strip, toolbar, and sometimes the bookmark | 633 // The view that manages the tab strip, toolbar, and sometimes the bookmark |
| 635 // bar. Stacked in the top of the view hiearachy so it can be used to | 634 // bar. Stacked in the top of the view hiearachy so it can be used to |
| 636 // slide out the top views in immersive fullscreen. | 635 // slide out the top views in immersive fullscreen. |
| 637 TopContainerView* top_container_; | 636 TopContainerView* top_container_; |
| 638 | 637 |
| 639 // The TabStrip. | 638 // The TabStrip. |
| 640 TabStrip* tabstrip_; | 639 TabStrip* tabstrip_; |
| 641 | 640 |
| 642 // The Toolbar containing the navigation buttons, menus and the address bar. | 641 // The Toolbar containing the navigation buttons, menus and the address bar. |
| 643 ToolbarView* toolbar_; | 642 ToolbarView* toolbar_; |
| 644 | 643 |
| 645 // This button sits next to the tabs on the right hand side and it is used | 644 // This button sits next to the tabs on the right hand side and it is used |
| 646 // only in windows metro metro mode to allow the user to flip among browser | 645 // only in windows metro metro mode to allow the user to flip among browser |
| 647 // windows. | 646 // windows. |
| 648 views::Button* window_switcher_button_; | 647 views::Button* window_switcher_button_; |
| 649 | 648 |
| 650 // The Bookmark Bar View for this window. Lazily created. May be NULL for | 649 // The Bookmark Bar View for this window. Lazily created. May be NULL for |
| 651 // non-tabbed browsers like popups. May not be visible. | 650 // non-tabbed browsers like popups. May not be visible. |
| 652 scoped_ptr<BookmarkBarView> bookmark_bar_view_; | 651 scoped_ptr<BookmarkBarView> bookmark_bar_view_; |
| 653 | 652 |
| 654 // The download shelf view (view at the bottom of the page). | 653 // The download shelf view (view at the bottom of the page). |
| 655 scoped_ptr<DownloadShelfView> download_shelf_; | 654 scoped_ptr<DownloadShelfView> download_shelf_; |
| 656 | 655 |
| 657 // The InfoBarContainerView that contains InfoBars for the current tab. | 656 // The InfoBarContainerView that contains InfoBars for the current tab. |
| 658 InfoBarContainerView* infobar_container_; | 657 InfoBarContainerView* infobar_container_; |
| 659 | 658 |
| 660 // The view that contains the selected WebContents. | 659 // The view that contains the selected WebContents. |
| 661 // TODO(jamescook): Rename this to |contents_web_view_| in order to | 660 views::WebView* contents_web_view_; |
| 662 // reduce confusion with ContentsContainer |contents_| below. | |
| 663 views::WebView* contents_container_; | |
| 664 | 661 |
| 665 // The view that contains devtools window for the selected WebContents. | 662 // The view that contains devtools window for the selected WebContents. |
| 666 views::WebView* devtools_container_; | 663 views::WebView* devtools_container_; |
| 667 | 664 |
| 668 // The view managing both the contents_container_ and | 665 // The view managing both the |contents_web_view_| and |
| 669 // overlay_controller_->overlay_container_. | 666 // |overlay_controller_->overlay_|. |
| 670 ContentsContainer* contents_; | 667 ContentsContainer* contents_container_; |
| 671 | 668 |
| 672 // Split view containing the contents container and devtools container. | 669 // Split view containing the contents container and devtools container. |
| 673 views::SingleSplitView* contents_split_; | 670 views::SingleSplitView* contents_split_; |
| 674 | 671 |
| 675 // Side to dock devtools to. | 672 // Side to dock devtools to. |
| 676 DevToolsDockSide devtools_dock_side_; | 673 DevToolsDockSide devtools_dock_side_; |
| 677 | 674 |
| 678 // Docked devtools window instance. NULL when current tab is not inspected | 675 // Docked devtools window instance. NULL when current tab is not inspected |
| 679 // or is inspected with undocked version of DevToolsWindow. | 676 // or is inspected with undocked version of DevToolsWindow. |
| 680 DevToolsWindow* devtools_window_; | 677 DevToolsWindow* devtools_window_; |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 746 gfx::ScopedSysColorChangeListener color_change_listener_; | 743 gfx::ScopedSysColorChangeListener color_change_listener_; |
| 747 | 744 |
| 748 scoped_ptr<InstantOverlayControllerViews> overlay_controller_; | 745 scoped_ptr<InstantOverlayControllerViews> overlay_controller_; |
| 749 | 746 |
| 750 mutable base::WeakPtrFactory<BrowserView> activate_modal_dialog_factory_; | 747 mutable base::WeakPtrFactory<BrowserView> activate_modal_dialog_factory_; |
| 751 | 748 |
| 752 DISALLOW_COPY_AND_ASSIGN(BrowserView); | 749 DISALLOW_COPY_AND_ASSIGN(BrowserView); |
| 753 }; | 750 }; |
| 754 | 751 |
| 755 #endif // CHROME_BROWSER_UI_VIEWS_FRAME_BROWSER_VIEW_H_ | 752 #endif // CHROME_BROWSER_UI_VIEWS_FRAME_BROWSER_VIEW_H_ |
| OLD | NEW |