Chromium Code Reviews| 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 27 matching lines...) Expand all Loading... | |
| 38 #include "chrome/browser/hang_monitor/hung_plugin_action.h" | 38 #include "chrome/browser/hang_monitor/hung_plugin_action.h" |
| 39 #include "chrome/browser/hang_monitor/hung_window_detector.h" | 39 #include "chrome/browser/hang_monitor/hung_window_detector.h" |
| 40 #endif | 40 #endif |
| 41 | 41 |
| 42 // NOTE: For more information about the objects and files in this directory, | 42 // NOTE: For more information about the objects and files in this directory, |
| 43 // view: http://dev.chromium.org/developers/design-documents/browser-window | 43 // view: http://dev.chromium.org/developers/design-documents/browser-window |
| 44 | 44 |
| 45 class BookmarkBarView; | 45 class BookmarkBarView; |
| 46 class Browser; | 46 class Browser; |
| 47 class BrowserViewLayout; | 47 class BrowserViewLayout; |
| 48 class ContentsContainer; | 48 class ContentsLayoutManager; |
| 49 class DownloadShelfView; | 49 class DownloadShelfView; |
| 50 class FullscreenExitBubbleViews; | 50 class FullscreenExitBubbleViews; |
| 51 class InfoBarContainerView; | 51 class InfoBarContainerView; |
| 52 class LocationBarView; | 52 class LocationBarView; |
| 53 class StatusBubbleViews; | 53 class StatusBubbleViews; |
| 54 class SearchViewController; | 54 class SearchViewController; |
| 55 class TabStrip; | 55 class TabStrip; |
| 56 class TabStripModel; | 56 class TabStripModel; |
| 57 class ToolbarView; | 57 class ToolbarView; |
| 58 class TopContainerView; | 58 class TopContainerView; |
| (...skipping 27 matching lines...) Expand all Loading... | |
| 86 // including the TabStrip, toolbars, download shelves, the content area etc. | 86 // including the TabStrip, toolbars, download shelves, the content area etc. |
| 87 // | 87 // |
| 88 class BrowserView : public BrowserWindow, | 88 class BrowserView : public BrowserWindow, |
| 89 public BrowserWindowTesting, | 89 public BrowserWindowTesting, |
| 90 public TabStripModelObserver, | 90 public TabStripModelObserver, |
| 91 public ui::AcceleratorProvider, | 91 public ui::AcceleratorProvider, |
| 92 public views::WidgetDelegate, | 92 public views::WidgetDelegate, |
| 93 public views::WidgetObserver, | 93 public views::WidgetObserver, |
| 94 public views::ClientView, | 94 public views::ClientView, |
| 95 public InfoBarContainer::Delegate, | 95 public InfoBarContainer::Delegate, |
| 96 public views::SingleSplitViewListener, | 96 public views::SingleSplitViewListener, |
|
sky
2013/12/06 17:25:44
I don't believe this is needed anymore. Make sure
dgozman
2013/12/09 13:19:18
Done.
| |
| 97 public gfx::SysColorChangeListener, | 97 public gfx::SysColorChangeListener, |
| 98 public LoadCompleteListener::Delegate, | 98 public LoadCompleteListener::Delegate, |
| 99 public OmniboxPopupModelObserver { | 99 public OmniboxPopupModelObserver { |
| 100 public: | 100 public: |
| 101 // The browser view's class name. | 101 // The browser view's class name. |
| 102 static const char kViewClassName[]; | 102 static const char kViewClassName[]; |
| 103 | 103 |
| 104 BrowserView(); | 104 BrowserView(); |
| 105 virtual ~BrowserView(); | 105 virtual ~BrowserView(); |
| 106 | 106 |
| (...skipping 342 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 449 virtual void ChildPreferredSizeChanged(View* child) OVERRIDE; | 449 virtual void ChildPreferredSizeChanged(View* child) OVERRIDE; |
| 450 virtual void GetAccessibleState(ui::AccessibleViewState* state) OVERRIDE; | 450 virtual void GetAccessibleState(ui::AccessibleViewState* state) OVERRIDE; |
| 451 | 451 |
| 452 // Overridden from ui::AcceleratorTarget: | 452 // Overridden from ui::AcceleratorTarget: |
| 453 virtual bool AcceleratorPressed(const ui::Accelerator& accelerator) OVERRIDE; | 453 virtual bool AcceleratorPressed(const ui::Accelerator& accelerator) OVERRIDE; |
| 454 | 454 |
| 455 // OmniboxPopupModelObserver overrides | 455 // OmniboxPopupModelObserver overrides |
| 456 virtual void OnOmniboxPopupShownOrHidden() OVERRIDE; | 456 virtual void OnOmniboxPopupShownOrHidden() OVERRIDE; |
| 457 | 457 |
| 458 // Testing interface: | 458 // Testing interface: |
| 459 views::SingleSplitView* GetContentsSplitForTest() { return contents_split_; } | 459 views::View* GetContentsContainerForTest() { return contents_container_; } |
| 460 ContentsContainer* GetContentsContainerForTest() { | |
| 461 return contents_container_; | |
| 462 } | |
| 463 views::WebView* GetContentsWebViewForTest() { return contents_web_view_; } | 460 views::WebView* GetContentsWebViewForTest() { return contents_web_view_; } |
| 461 views::WebView* GetDevToolsWebViewForTest() { return devtools_web_view_; } | |
| 464 | 462 |
| 465 private: | 463 private: |
| 466 // Do not friend BrowserViewLayout. Use the BrowserViewLayoutDelegate | 464 // Do not friend BrowserViewLayout. Use the BrowserViewLayoutDelegate |
| 467 // interface to keep these two classes decoupled and testable. | 465 // interface to keep these two classes decoupled and testable. |
| 468 friend class BrowserViewLayoutDelegateImpl; | 466 friend class BrowserViewLayoutDelegateImpl; |
| 469 FRIEND_TEST_ALL_PREFIXES(BrowserViewTest, BrowserView); | 467 FRIEND_TEST_ALL_PREFIXES(BrowserViewTest, BrowserView); |
| 470 FRIEND_TEST_ALL_PREFIXES(BrowserViewsAccessibilityTest, | 468 FRIEND_TEST_ALL_PREFIXES(BrowserViewsAccessibilityTest, |
| 471 TestAboutChromeViewAccObj); | 469 TestAboutChromeViewAccObj); |
| 472 | 470 |
| 473 enum FullscreenType { | 471 enum FullscreenType { |
| (...skipping 11 matching lines...) Expand all Loading... | |
| 485 // Callback for the loading animation(s) associated with this view. | 483 // Callback for the loading animation(s) associated with this view. |
| 486 void LoadingAnimationCallback(); | 484 void LoadingAnimationCallback(); |
| 487 | 485 |
| 488 // LoadCompleteListener::Delegate implementation. Creates and initializes the | 486 // LoadCompleteListener::Delegate implementation. Creates and initializes the |
| 489 // |jumplist_| after the first page load. | 487 // |jumplist_| after the first page load. |
| 490 virtual void OnLoadCompleted() OVERRIDE; | 488 virtual void OnLoadCompleted() OVERRIDE; |
| 491 | 489 |
| 492 // Returns the BrowserViewLayout. | 490 // Returns the BrowserViewLayout. |
| 493 BrowserViewLayout* GetBrowserViewLayout() const; | 491 BrowserViewLayout* GetBrowserViewLayout() const; |
| 494 | 492 |
| 493 // Returns the ContentsLayoutManager. | |
| 494 ContentsLayoutManager* GetContentsLayoutManager() const; | |
| 495 | |
| 495 // Layout the Status Bubble. | 496 // Layout the Status Bubble. |
| 496 void LayoutStatusBubble(); | 497 void LayoutStatusBubble(); |
| 497 | 498 |
| 498 // Prepare to show the Bookmark Bar for the specified WebContents. | 499 // Prepare to show the Bookmark Bar for the specified WebContents. |
| 499 // Returns true if the Bookmark Bar can be shown (i.e. it's supported for this | 500 // Returns true if the Bookmark Bar can be shown (i.e. it's supported for this |
| 500 // Browser type) and there should be a subsequent re-layout to show it. | 501 // Browser type) and there should be a subsequent re-layout to show it. |
| 501 // |contents| can be NULL. | 502 // |contents| can be NULL. |
| 502 bool MaybeShowBookmarkBar(content::WebContents* contents); | 503 bool MaybeShowBookmarkBar(content::WebContents* contents); |
| 503 | 504 |
| 504 // Moves the bookmark bar view to the specified parent, which may be NULL, | 505 // Moves the bookmark bar view to the specified parent, which may be NULL, |
| 505 // |this|, or |top_container_|. Ensures that |top_container_| stays in front | 506 // |this|, or |top_container_|. Ensures that |top_container_| stays in front |
| 506 // of |bookmark_bar_view_|. | 507 // of |bookmark_bar_view_|. |
| 507 void SetBookmarkBarParent(views::View* new_parent); | 508 void SetBookmarkBarParent(views::View* new_parent); |
| 508 | 509 |
| 509 // Prepare to show an Info Bar for the specified WebContents. Returns | 510 // Prepare to show an Info Bar for the specified WebContents. Returns |
| 510 // true if there is an Info Bar to show and one is supported for this Browser | 511 // true if there is an Info Bar to show and one is supported for this Browser |
| 511 // type, and there should be a subsequent re-layout to show it. | 512 // type, and there should be a subsequent re-layout to show it. |
| 512 // |contents| can be NULL. | 513 // |contents| can be NULL. |
| 513 bool MaybeShowInfoBar(content::WebContents* contents); | 514 bool MaybeShowInfoBar(content::WebContents* contents); |
| 514 | 515 |
| 515 // Updates devtools window for given contents. This method will show docked | 516 // Updates devtools window for given contents. This method will show docked |
| 516 // devtools window for inspected |web_contents| that has docked devtools | 517 // devtools window for inspected |web_contents| that has docked devtools |
| 517 // and hide it for NULL or not inspected |web_contents|. It will also make | 518 // and hide it for NULL or not inspected |web_contents|. It will also make |
| 518 // sure devtools window size and position are restored for given tab. | 519 // sure devtools window size and position are restored for given tab. |
| 519 void UpdateDevToolsForContents(content::WebContents* web_contents); | 520 // This method will not update actual DevTools WebContents, if not |
| 520 | 521 // |update_devtools_web_contents|. In this case, manual update is required. |
| 521 // Shows docked devtools. | 522 void UpdateDevToolsForContents(content::WebContents* web_contents, |
| 522 void ShowDevToolsContainer(); | 523 bool update_devtools_web_contents); |
| 523 | |
| 524 // Hides docked devtools. | |
| 525 void HideDevToolsContainer(); | |
| 526 | |
| 527 // Reads split position from the current tab's devtools window and applies | |
| 528 // it to the devtools split. | |
| 529 void UpdateDevToolsSplitPosition(); | |
| 530 | 524 |
| 531 // Updates various optional child Views, e.g. Bookmarks Bar, Info Bar or the | 525 // Updates various optional child Views, e.g. Bookmarks Bar, Info Bar or the |
| 532 // Download Shelf in response to a change notification from the specified | 526 // Download Shelf in response to a change notification from the specified |
| 533 // |contents|. |contents| can be NULL. In this case, all optional UI will be | 527 // |contents|. |contents| can be NULL. In this case, all optional UI will be |
| 534 // removed. | 528 // removed. |
| 535 void UpdateUIForContents(content::WebContents* contents); | 529 void UpdateUIForContents(content::WebContents* contents); |
| 536 | 530 |
| 537 // Invoked to update the necessary things when our fullscreen state changes | 531 // Invoked to update the necessary things when our fullscreen state changes |
| 538 // to |fullscreen|. On Windows this is invoked immediately when we toggle the | 532 // to |fullscreen|. On Windows this is invoked immediately when we toggle the |
| 539 // full screen state. On Linux changing the fullscreen state is async, so we | 533 // full screen state. On Linux changing the fullscreen state is async, so we |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 604 // | -------------------------------------------------------------- | | 598 // | -------------------------------------------------------------- | |
| 605 // | | Tabs (tabstrip_) | | | 599 // | | Tabs (tabstrip_) | | |
| 606 // | |------------------------------------------------------------| | | 600 // | |------------------------------------------------------------| | |
| 607 // | | Navigation buttons, address bar, menu (toolbar_) | | | 601 // | | Navigation buttons, address bar, menu (toolbar_) | | |
| 608 // | -------------------------------------------------------------- | | 602 // | -------------------------------------------------------------- | |
| 609 // |------------------------------------------------------------------| | 603 // |------------------------------------------------------------------| |
| 610 // | All infobars (infobar_container_) [1] | | 604 // | All infobars (infobar_container_) [1] | |
| 611 // |------------------------------------------------------------------| | 605 // |------------------------------------------------------------------| |
| 612 // | Bookmarks (bookmark_bar_view_) [1] | | 606 // | Bookmarks (bookmark_bar_view_) [1] | |
| 613 // |------------------------------------------------------------------| | 607 // |------------------------------------------------------------------| |
| 614 // | Debugger splitter (contents_split_) | | 608 // | Contents container (contents_container_) | |
| 615 // | -------------------------------------------------------------- | | 609 // | -------------------------------------------------------------- | |
| 616 // | | Page content (contents_container_) | | | 610 // | | devtools_web_view_ | | |
| 617 // | | -------------------------------------------------------- | | | 611 // | |------------------------------------------------------------| | |
| 618 // | | | contents_web_view_ | | | | 612 // | | contents_web_view_ | | |
| 619 // | | -------------------------------------------------------- | | | |
| 620 // | -------------------------------------------------------------- | | |
| 621 // | -------------------------------------------------------------- | | |
| 622 // | | Debugger (devtools_container_) | | | |
| 623 // | | | | | |
| 624 // | -------------------------------------------------------------- | | 613 // | -------------------------------------------------------------- | |
| 625 // |------------------------------------------------------------------| | 614 // |------------------------------------------------------------------| |
| 626 // | Active downloads (download_shelf_) | | 615 // | Active downloads (download_shelf_) | |
| 627 // -------------------------------------------------------------------- | 616 // -------------------------------------------------------------------- |
| 628 // | 617 // |
| 629 // [1] The bookmark bar and info bar are swapped when on the new tab page. | 618 // [1] The bookmark bar and info bar are swapped when on the new tab page. |
| 630 // Additionally when the bookmark bar is detached, contents_container_ is | 619 // Additionally when the bookmark bar is detached, contents_container_ is |
| 631 // positioned on top of the bar while the tab's contents are placed below | 620 // positioned on top of the bar while the tab's contents are placed below |
| 632 // the bar. This allows the find bar to always align with the top of | 621 // the bar. This allows the find bar to always align with the top of |
| 633 // contents_container_ regardless if there's bookmark or info bars. | 622 // contents_container_ regardless if there's bookmark or info bars. |
| (...skipping 26 matching lines...) Expand all Loading... | |
| 660 // The download shelf view (view at the bottom of the page). | 649 // The download shelf view (view at the bottom of the page). |
| 661 scoped_ptr<DownloadShelfView> download_shelf_; | 650 scoped_ptr<DownloadShelfView> download_shelf_; |
| 662 | 651 |
| 663 // The InfoBarContainerView that contains InfoBars for the current tab. | 652 // The InfoBarContainerView that contains InfoBars for the current tab. |
| 664 InfoBarContainerView* infobar_container_; | 653 InfoBarContainerView* infobar_container_; |
| 665 | 654 |
| 666 // The view that contains the selected WebContents. | 655 // The view that contains the selected WebContents. |
| 667 views::WebView* contents_web_view_; | 656 views::WebView* contents_web_view_; |
| 668 | 657 |
| 669 // The view that contains devtools window for the selected WebContents. | 658 // The view that contains devtools window for the selected WebContents. |
| 670 views::WebView* devtools_container_; | 659 views::WebView* devtools_web_view_; |
| 671 | 660 |
| 672 // The view managing the |contents_web_view_|. | 661 // The view managing the devtools and contents positions. |
| 673 ContentsContainer* contents_container_; | 662 // Handled by ContentsLayoutManager. |
| 674 | 663 views::View* contents_container_; |
| 675 // Split view containing the contents container and devtools container. | |
| 676 views::SingleSplitView* contents_split_; | |
| 677 | |
| 678 // Side to dock devtools to. | |
| 679 DevToolsDockSide devtools_dock_side_; | |
| 680 | 664 |
| 681 // Docked devtools window instance. NULL when current tab is not inspected | 665 // Docked devtools window instance. NULL when current tab is not inspected |
| 682 // or is inspected with undocked version of DevToolsWindow. | 666 // or is inspected with undocked version of DevToolsWindow. |
| 683 DevToolsWindow* devtools_window_; | 667 DevToolsWindow* devtools_window_; |
| 684 | 668 |
| 685 // Tracks and stores the last focused view which is not the | 669 // Tracks and stores the last focused view which is not the |
| 686 // devtools_container_ or any of its children. Used to restore focus once | 670 // devtools_web_view_ or any of its children. Used to restore focus once |
| 687 // the devtools_container_ is hidden. | 671 // the devtools_web_view_ is hidden. |
| 688 scoped_ptr<views::ExternalFocusTracker> devtools_focus_tracker_; | 672 scoped_ptr<views::ExternalFocusTracker> devtools_focus_tracker_; |
| 689 | 673 |
| 690 // The Status information bubble that appears at the bottom of the window. | 674 // The Status information bubble that appears at the bottom of the window. |
| 691 scoped_ptr<StatusBubbleViews> status_bubble_; | 675 scoped_ptr<StatusBubbleViews> status_bubble_; |
| 692 | 676 |
| 693 // A mapping between accelerators and commands. | 677 // A mapping between accelerators and commands. |
| 694 std::map<ui::Accelerator, int> accelerator_table_; | 678 std::map<ui::Accelerator, int> accelerator_table_; |
| 695 | 679 |
| 696 // True if we have already been initialized. | 680 // True if we have already been initialized. |
| 697 bool initialized_; | 681 bool initialized_; |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 741 scoped_ptr<ScrollEndEffectController> scroll_end_effect_controller_; | 725 scoped_ptr<ScrollEndEffectController> scroll_end_effect_controller_; |
| 742 | 726 |
| 743 gfx::ScopedSysColorChangeListener color_change_listener_; | 727 gfx::ScopedSysColorChangeListener color_change_listener_; |
| 744 | 728 |
| 745 mutable base::WeakPtrFactory<BrowserView> activate_modal_dialog_factory_; | 729 mutable base::WeakPtrFactory<BrowserView> activate_modal_dialog_factory_; |
| 746 | 730 |
| 747 DISALLOW_COPY_AND_ASSIGN(BrowserView); | 731 DISALLOW_COPY_AND_ASSIGN(BrowserView); |
| 748 }; | 732 }; |
| 749 | 733 |
| 750 #endif // CHROME_BROWSER_UI_VIEWS_FRAME_BROWSER_VIEW_H_ | 734 #endif // CHROME_BROWSER_UI_VIEWS_FRAME_BROWSER_VIEW_H_ |
| OLD | NEW |