OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 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 | 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 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <map> | 9 #include <map> |
10 #include <string> | 10 #include <string> |
11 #include <vector> | 11 #include <vector> |
12 | 12 |
13 #include "base/scoped_ptr.h" | 13 #include "base/scoped_ptr.h" |
14 #include "base/timer.h" | 14 #include "base/timer.h" |
15 #include "build/build_config.h" | 15 #include "build/build_config.h" |
16 #include "chrome/browser/browser_window.h" | 16 #include "chrome/browser/browser_window.h" |
17 #include "chrome/browser/tabs/tab_strip_model_observer.h" | 17 #include "chrome/browser/tabs/tab_strip_model_observer.h" |
18 #include "chrome/browser/ui/browser.h" | 18 #include "chrome/browser/ui/browser.h" |
| 19 #include "chrome/browser/ui/views/sidebar/sidebar_tab_strip_controller.h" |
19 #include "chrome/browser/ui/views/frame/browser_bubble_host.h" | 20 #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/frame/browser_frame.h" |
21 #include "chrome/browser/ui/views/infobars/infobar_container.h" | 22 #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/tab_contents/tab_contents_container.h" |
23 #include "chrome/browser/ui/views/tabs/base_tab_strip.h" | 24 #include "chrome/browser/ui/views/tabs/base_tab_strip.h" |
24 #include "chrome/browser/ui/views/tabs/tab_strip.h" | 25 #include "chrome/browser/ui/views/tabs/tab_strip.h" |
25 #include "chrome/browser/ui/views/unhandled_keyboard_event_handler.h" | 26 #include "chrome/browser/ui/views/unhandled_keyboard_event_handler.h" |
26 #include "chrome/common/notification_registrar.h" | 27 #include "chrome/common/notification_registrar.h" |
27 #include "ui/base/models/simple_menu_model.h" | 28 #include "ui/base/models/simple_menu_model.h" |
28 #include "ui/gfx/native_widget_types.h" | 29 #include "ui/gfx/native_widget_types.h" |
29 #include "views/controls/single_split_view.h" | 30 #include "views/controls/single_split_view.h" |
30 #include "views/window/client_view.h" | 31 #include "views/window/client_view.h" |
31 #include "views/window/window_delegate.h" | 32 #include "views/window/window_delegate.h" |
32 | 33 |
33 #if defined(OS_WIN) | 34 #if defined(OS_WIN) |
34 #include "chrome/browser/hang_monitor/hung_plugin_action.h" | 35 #include "chrome/browser/hang_monitor/hung_plugin_action.h" |
35 #include "chrome/browser/hang_monitor/hung_window_detector.h" | 36 #include "chrome/browser/hang_monitor/hung_window_detector.h" |
36 #include "views/controls/menu/native_menu_win.h" | 37 #include "views/controls/menu/native_menu_win.h" |
37 #endif | 38 #endif |
38 | 39 |
39 // NOTE: For more information about the objects and files in this directory, | 40 // NOTE: For more information about the objects and files in this directory, |
40 // view: http://dev.chromium.org/developers/design-documents/browser-window | 41 // view: http://dev.chromium.org/developers/design-documents/browser-window |
41 | 42 |
42 class AccessiblePaneView; | 43 class AccessiblePaneView; |
43 class BookmarkBarView; | 44 class BookmarkBarView; |
44 class Browser; | 45 class Browser; |
45 class BrowserBubble; | 46 class BrowserBubble; |
| 47 class BrowserSidebarTabStripController; |
46 class BrowserViewLayout; | 48 class BrowserViewLayout; |
47 class ContentsContainer; | 49 class ContentsContainer; |
48 class DownloadShelfView; | 50 class DownloadShelfView; |
49 class EncodingMenuModel; | 51 class EncodingMenuModel; |
50 class FullscreenExitBubble; | 52 class FullscreenExitBubble; |
51 class HtmlDialogUIDelegate; | 53 class HtmlDialogUIDelegate; |
52 class InfoBarContainer; | 54 class InfoBarContainer; |
53 class LocationBarView; | 55 class LocationBarView; |
| 56 class SidebarTabStripHost; |
54 class SideTabStrip; | 57 class SideTabStrip; |
55 class StatusBubbleViews; | 58 class StatusBubbleViews; |
56 class TabContentsContainer; | 59 class TabContentsContainer; |
57 class TabStripModel; | 60 class TabStripModel; |
58 class ToolbarView; | 61 class ToolbarView; |
59 class ZoomMenuModel; | 62 class ZoomMenuModel; |
60 class Extension; | 63 class Extension; |
61 | 64 |
| 65 struct SidebarChangedDetails; |
| 66 |
62 #if defined(OS_WIN) | 67 #if defined(OS_WIN) |
63 class AeroPeekManager; | 68 class AeroPeekManager; |
64 class JumpList; | 69 class JumpList; |
65 #endif | 70 #endif |
66 | 71 |
67 namespace views { | 72 namespace views { |
68 class ExternalFocusTracker; | 73 class ExternalFocusTracker; |
69 class Menu; | 74 class Menu; |
70 } | 75 } |
71 | 76 |
72 /////////////////////////////////////////////////////////////////////////////// | 77 /////////////////////////////////////////////////////////////////////////////// |
73 // BrowserView | 78 // BrowserView |
74 // | 79 // |
75 // A ClientView subclass that provides the contents of a browser window, | 80 // A ClientView subclass that provides the contents of a browser window, |
76 // including the TabStrip, toolbars, download shelves, the content area etc. | 81 // including the TabStrip, toolbars, download shelves, the content area etc. |
77 // | 82 // |
78 class BrowserView : public BrowserBubbleHost, | 83 class BrowserView : public BrowserBubbleHost, |
79 public BrowserWindow, | 84 public BrowserWindow, |
80 public BrowserWindowTesting, | 85 public BrowserWindowTesting, |
81 public NotificationObserver, | 86 public NotificationObserver, |
82 public TabStripModelObserver, | 87 public TabStripModelObserver, |
83 public ui::SimpleMenuModel::Delegate, | 88 public ui::SimpleMenuModel::Delegate, |
84 public views::WindowDelegate, | 89 public views::WindowDelegate, |
85 public views::ClientView, | 90 public views::ClientView, |
86 public InfoBarContainer::Delegate, | 91 public InfoBarContainer::Delegate, |
87 public views::SingleSplitView::Observer { | 92 public views::SingleSplitView::Observer, |
| 93 public SidebarTabStripController::Delegate { |
88 public: | 94 public: |
89 // The browser view's class name. | 95 // The browser view's class name. |
90 static const char kViewClassName[]; | 96 static const char kViewClassName[]; |
91 | 97 |
92 // Explicitly sets how windows are shown. Use a value of -1 to give the | 98 // Explicitly sets how windows are shown. Use a value of -1 to give the |
93 // default behavior. This is used during testing and not generally useful | 99 // default behavior. This is used during testing and not generally useful |
94 // otherwise. | 100 // otherwise. |
95 static void SetShowState(int state); | 101 static void SetShowState(int state); |
96 | 102 |
97 explicit BrowserView(Browser* browser); | 103 explicit BrowserView(Browser* browser); |
(...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
391 virtual bool CanClose(); | 397 virtual bool CanClose(); |
392 virtual int NonClientHitTest(const gfx::Point& point); | 398 virtual int NonClientHitTest(const gfx::Point& point); |
393 virtual gfx::Size GetMinimumSize(); | 399 virtual gfx::Size GetMinimumSize(); |
394 | 400 |
395 // InfoBarContainer::Delegate overrides | 401 // InfoBarContainer::Delegate overrides |
396 virtual void InfoBarContainerSizeChanged(bool is_animating); | 402 virtual void InfoBarContainerSizeChanged(bool is_animating); |
397 | 403 |
398 // views::SingleSplitView::Observer overrides: | 404 // views::SingleSplitView::Observer overrides: |
399 virtual bool SplitHandleMoved(views::SingleSplitView* view); | 405 virtual bool SplitHandleMoved(views::SingleSplitView* view); |
400 | 406 |
| 407 // SidebarTabStripController::Delegate overrides |
| 408 virtual void OnSidebarTabStripBoundsChanged(bool is_animating); |
| 409 |
401 protected: | 410 protected: |
402 // Appends to |toolbars| a pointer to each AccessiblePaneView that | 411 // Appends to |toolbars| a pointer to each AccessiblePaneView that |
403 // can be traversed using F6, in the order they should be traversed. | 412 // can be traversed using F6, in the order they should be traversed. |
404 // Abstracted here so that it can be extended for Chrome OS. | 413 // Abstracted here so that it can be extended for Chrome OS. |
405 virtual void GetAccessiblePanes( | 414 virtual void GetAccessiblePanes( |
406 std::vector<AccessiblePaneView*>* panes); | 415 std::vector<AccessiblePaneView*>* panes); |
407 | 416 |
408 // Save the current focused view to view storage | 417 // Save the current focused view to view storage |
409 void SaveFocusedView(); | 418 void SaveFocusedView(); |
410 | 419 |
(...skipping 14 matching lines...) Expand all Loading... |
425 // Factory Methods. | 434 // Factory Methods. |
426 // Returns a new LayoutManager for this browser view. A subclass may | 435 // Returns a new LayoutManager for this browser view. A subclass may |
427 // override to implemnet different layout pocily. | 436 // override to implemnet different layout pocily. |
428 virtual views::LayoutManager* CreateLayoutManager() const; | 437 virtual views::LayoutManager* CreateLayoutManager() const; |
429 | 438 |
430 // Initializes a new TabStrip for the browser view. This can be performed | 439 // Initializes a new TabStrip for the browser view. This can be performed |
431 // multiple times over the life of the browser, and is run when the display | 440 // multiple times over the life of the browser, and is run when the display |
432 // mode for the tabstrip changes from horizontal to vertical. | 441 // mode for the tabstrip changes from horizontal to vertical. |
433 virtual void InitTabStrip(TabStripModel* tab_strip_model); | 442 virtual void InitTabStrip(TabStripModel* tab_strip_model); |
434 | 443 |
| 444 virtual void InitSidebarTabStrip(); |
| 445 |
435 // Browser window related initializations. | 446 // Browser window related initializations. |
436 virtual void Init(); | 447 virtual void Init(); |
437 | 448 |
438 private: | 449 private: |
439 friend class BrowserViewLayout; | 450 friend class BrowserViewLayout; |
440 | 451 |
441 #if defined(OS_WIN) | 452 #if defined(OS_WIN) |
442 // Creates the system menu. | 453 // Creates the system menu. |
443 void InitSystemMenu(); | 454 void InitSystemMenu(); |
444 #endif | 455 #endif |
(...skipping 15 matching lines...) Expand all Loading... |
460 // |contents| can be NULL. | 471 // |contents| can be NULL. |
461 bool MaybeShowBookmarkBar(TabContentsWrapper* contents); | 472 bool MaybeShowBookmarkBar(TabContentsWrapper* contents); |
462 | 473 |
463 // Prepare to show an Info Bar for the specified TabContents. Returns true | 474 // Prepare to show an Info Bar for the specified TabContents. Returns true |
464 // if there is an Info Bar to show and one is supported for this Browser | 475 // if there is an Info Bar to show and one is supported for this Browser |
465 // type, and there should be a subsequent re-layout to show it. | 476 // type, and there should be a subsequent re-layout to show it. |
466 // |contents| can be NULL. | 477 // |contents| can be NULL. |
467 bool MaybeShowInfoBar(TabContentsWrapper* contents); | 478 bool MaybeShowInfoBar(TabContentsWrapper* contents); |
468 | 479 |
469 // Updates sidebar UI according to the current tab and sidebar state. | 480 // Updates sidebar UI according to the current tab and sidebar state. |
470 void UpdateSidebar(); | 481 void UpdateSidebar(SidebarChangedDetails* details); |
471 // Displays active sidebar linked to the |tab_contents| or hides sidebar UI, | 482 // Displays active sidebar linked to the |tab| or hides sidebar UI, |
472 // if there's no such sidebar. | 483 // if there's none. |
473 void UpdateSidebarForContents(TabContentsWrapper* tab_contents); | 484 void UpdateSidebarForContents(TabContentsWrapper* tab); |
474 | 485 |
475 // Updated devtools window for given contents. | 486 // Updated devtools window for given contents. |
476 void UpdateDevToolsForContents(TabContentsWrapper* tab_contents); | 487 void UpdateDevToolsForContents(TabContentsWrapper* tab_contents); |
477 | 488 |
478 // Updates various optional child Views, e.g. Bookmarks Bar, Info Bar or the | 489 // Updates various optional child Views, e.g. Bookmarks Bar, Info Bar or the |
479 // Download Shelf in response to a change notification from the specified | 490 // Download Shelf in response to a change notification from the specified |
480 // |contents|. |contents| can be NULL. In this case, all optional UI will be | 491 // |contents|. |contents| can be NULL. In this case, all optional UI will be |
481 // removed. | 492 // removed. |
482 void UpdateUIForContents(TabContentsWrapper* contents); | 493 void UpdateUIForContents(TabContentsWrapper* contents); |
483 | 494 |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
599 | 610 |
600 // The InfoBarContainer that contains InfoBars for the current tab. | 611 // The InfoBarContainer that contains InfoBars for the current tab. |
601 InfoBarContainer* infobar_container_; | 612 InfoBarContainer* infobar_container_; |
602 | 613 |
603 // The view that contains sidebar for the current tab. | 614 // The view that contains sidebar for the current tab. |
604 TabContentsContainer* sidebar_container_; | 615 TabContentsContainer* sidebar_container_; |
605 | 616 |
606 // Split view containing the contents container and sidebar container. | 617 // Split view containing the contents container and sidebar container. |
607 views::SingleSplitView* sidebar_split_; | 618 views::SingleSplitView* sidebar_split_; |
608 | 619 |
| 620 // The SidebarTabStrip. |
| 621 BrowserSidebarTabStripController* sidebar_tabstrip_controller_; |
| 622 scoped_ptr<SidebarTabStripHost> sidebar_tabstrip_host_; |
| 623 |
609 // The view that contains the selected TabContents. | 624 // The view that contains the selected TabContents. |
610 TabContentsContainer* contents_container_; | 625 TabContentsContainer* contents_container_; |
611 | 626 |
612 // The view that contains devtools window for the selected TabContents. | 627 // The view that contains devtools window for the selected TabContents. |
613 TabContentsContainer* devtools_container_; | 628 TabContentsContainer* devtools_container_; |
614 | 629 |
615 // The view that contains instant's TabContents. | 630 // The view that contains instant's TabContents. |
616 TabContentsContainer* preview_container_; | 631 TabContentsContainer* preview_container_; |
617 | 632 |
618 // The view managing both the contents_container_ and preview_container_. | 633 // The view managing both the contents_container_ and preview_container_. |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
673 base::RepeatingTimer<BrowserView> loading_animation_timer_; | 688 base::RepeatingTimer<BrowserView> loading_animation_timer_; |
674 | 689 |
675 UnhandledKeyboardEventHandler unhandled_keyboard_event_handler_; | 690 UnhandledKeyboardEventHandler unhandled_keyboard_event_handler_; |
676 | 691 |
677 NotificationRegistrar registrar_; | 692 NotificationRegistrar registrar_; |
678 | 693 |
679 DISALLOW_COPY_AND_ASSIGN(BrowserView); | 694 DISALLOW_COPY_AND_ASSIGN(BrowserView); |
680 }; | 695 }; |
681 | 696 |
682 #endif // CHROME_BROWSER_UI_VIEWS_FRAME_BROWSER_VIEW_H_ | 697 #endif // CHROME_BROWSER_UI_VIEWS_FRAME_BROWSER_VIEW_H_ |
OLD | NEW |