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> |
11 | 11 |
12 #include "base/compiler_specific.h" | 12 #include "base/compiler_specific.h" |
13 #include "base/gtest_prod_util.h" | 13 #include "base/gtest_prod_util.h" |
14 #include "base/macros.h" | 14 #include "base/macros.h" |
15 #include "base/memory/scoped_ptr.h" | 15 #include "base/memory/scoped_ptr.h" |
16 #include "base/timer/timer.h" | 16 #include "base/timer/timer.h" |
17 #include "build/build_config.h" | 17 #include "build/build_config.h" |
18 #include "chrome/browser/devtools/devtools_window.h" | 18 #include "chrome/browser/devtools/devtools_window.h" |
19 #include "chrome/browser/extensions/extension_commands_global_registry.h" | |
20 #include "chrome/browser/extensions/extension_keybinding_registry.h" | |
21 #include "chrome/browser/ui/browser.h" | 19 #include "chrome/browser/ui/browser.h" |
22 #include "chrome/browser/ui/browser_window.h" | 20 #include "chrome/browser/ui/browser_window.h" |
23 #include "chrome/browser/ui/exclusive_access/exclusive_access_context.h" | 21 #include "chrome/browser/ui/exclusive_access/exclusive_access_context.h" |
24 #include "chrome/browser/ui/infobar_container_delegate.h" | 22 #include "chrome/browser/ui/infobar_container_delegate.h" |
25 #include "chrome/browser/ui/tabs/tab_strip_model_observer.h" | 23 #include "chrome/browser/ui/tabs/tab_strip_model_observer.h" |
26 #include "chrome/browser/ui/views/exclusive_access_bubble_views_context.h" | 24 #include "chrome/browser/ui/views/exclusive_access_bubble_views_context.h" |
27 #include "chrome/browser/ui/views/extensions/extension_keybinding_registry_views
.h" | |
28 #include "chrome/browser/ui/views/frame/browser_frame.h" | 25 #include "chrome/browser/ui/views/frame/browser_frame.h" |
29 #include "chrome/browser/ui/views/frame/contents_web_view.h" | 26 #include "chrome/browser/ui/views/frame/contents_web_view.h" |
30 #include "chrome/browser/ui/views/frame/immersive_mode_controller.h" | 27 #include "chrome/browser/ui/views/frame/immersive_mode_controller.h" |
31 #include "chrome/browser/ui/views/frame/web_contents_close_handler.h" | 28 #include "chrome/browser/ui/views/frame/web_contents_close_handler.h" |
32 #include "chrome/browser/ui/views/load_complete_listener.h" | 29 #include "chrome/browser/ui/views/load_complete_listener.h" |
33 #include "chrome/browser/ui/views/profiles/signin_view_controller.h" | 30 #include "chrome/browser/ui/views/profiles/signin_view_controller.h" |
34 #include "components/omnibox/browser/omnibox_popup_model_observer.h" | 31 #include "components/omnibox/browser/omnibox_popup_model_observer.h" |
35 #include "ui/base/accelerators/accelerator.h" | 32 #include "ui/base/accelerators/accelerator.h" |
36 #include "ui/base/models/simple_menu_model.h" | 33 #include "ui/base/models/simple_menu_model.h" |
37 #include "ui/gfx/native_widget_types.h" | 34 #include "ui/gfx/native_widget_types.h" |
(...skipping 23 matching lines...) Expand all Loading... |
61 class TabStrip; | 58 class TabStrip; |
62 class ToolbarView; | 59 class ToolbarView; |
63 class TopContainerView; | 60 class TopContainerView; |
64 class WebContentsCloseHandler; | 61 class WebContentsCloseHandler; |
65 | 62 |
66 #if defined(OS_WIN) | 63 #if defined(OS_WIN) |
67 class JumpList; | 64 class JumpList; |
68 #endif | 65 #endif |
69 | 66 |
70 namespace extensions { | 67 namespace extensions { |
71 class ActiveTabPermissionGranter; | |
72 class Command; | |
73 class Extension; | 68 class Extension; |
74 } | 69 } |
75 | 70 |
76 namespace views { | 71 namespace views { |
77 class AccessiblePaneView; | 72 class AccessiblePaneView; |
78 class ExternalFocusTracker; | 73 class ExternalFocusTracker; |
79 class WebView; | 74 class WebView; |
80 } | 75 } |
81 | 76 |
82 /////////////////////////////////////////////////////////////////////////////// | 77 /////////////////////////////////////////////////////////////////////////////// |
83 // BrowserView | 78 // BrowserView |
84 // | 79 // |
85 // A ClientView subclass that provides the contents of a browser window, | 80 // A ClientView subclass that provides the contents of a browser window, |
86 // including the TabStrip, toolbars, download shelves, the content area etc. | 81 // including the TabStrip, toolbars, download shelves, the content area etc. |
87 // | 82 // |
88 class BrowserView : public BrowserWindow, | 83 class BrowserView : public BrowserWindow, |
89 public TabStripModelObserver, | 84 public TabStripModelObserver, |
90 public ui::AcceleratorProvider, | 85 public ui::AcceleratorProvider, |
91 public views::WidgetDelegate, | 86 public views::WidgetDelegate, |
92 public views::WidgetObserver, | 87 public views::WidgetObserver, |
93 public views::ClientView, | 88 public views::ClientView, |
94 public InfoBarContainerDelegate, | 89 public InfoBarContainerDelegate, |
95 public LoadCompleteListener::Delegate, | 90 public LoadCompleteListener::Delegate, |
96 public OmniboxPopupModelObserver, | 91 public OmniboxPopupModelObserver, |
97 public ExclusiveAccessContext, | 92 public ExclusiveAccessContext, |
98 public ExclusiveAccessBubbleViewsContext, | 93 public ExclusiveAccessBubbleViewsContext { |
99 public extensions::ExtensionKeybindingRegistry::Delegate { | |
100 public: | 94 public: |
101 // The browser view's class name. | 95 // The browser view's class name. |
102 static const char kViewClassName[]; | 96 static const char kViewClassName[]; |
103 | 97 |
104 BrowserView(); | 98 BrowserView(); |
105 ~BrowserView() override; | 99 ~BrowserView() override; |
106 | 100 |
107 // Takes ownership of |browser|. | 101 // Takes ownership of |browser|. |
108 void Init(Browser* browser); | 102 void Init(Browser* browser); |
109 | 103 |
(...skipping 355 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
465 // ExclusiveAccessBubbleViewsContext overrides | 459 // ExclusiveAccessBubbleViewsContext overrides |
466 ExclusiveAccessManager* GetExclusiveAccessManager() override; | 460 ExclusiveAccessManager* GetExclusiveAccessManager() override; |
467 views::Widget* GetBubbleAssociatedWidget() override; | 461 views::Widget* GetBubbleAssociatedWidget() override; |
468 ui::AcceleratorProvider* GetAcceleratorProvider() override; | 462 ui::AcceleratorProvider* GetAcceleratorProvider() override; |
469 gfx::NativeView GetBubbleParentView() const override; | 463 gfx::NativeView GetBubbleParentView() const override; |
470 gfx::Point GetCursorPointInParent() const override; | 464 gfx::Point GetCursorPointInParent() const override; |
471 gfx::Rect GetClientAreaBoundsInScreen() const override; | 465 gfx::Rect GetClientAreaBoundsInScreen() const override; |
472 bool IsImmersiveModeEnabled() override; | 466 bool IsImmersiveModeEnabled() override; |
473 gfx::Rect GetTopContainerBoundsInScreen() override; | 467 gfx::Rect GetTopContainerBoundsInScreen() override; |
474 | 468 |
475 // extension::ExtensionKeybindingRegistry::Delegate overrides | |
476 extensions::ActiveTabPermissionGranter* GetActiveTabPermissionGranter() | |
477 override; | |
478 | |
479 // Testing interface: | 469 // Testing interface: |
480 views::View* GetContentsContainerForTest() { return contents_container_; } | 470 views::View* GetContentsContainerForTest() { return contents_container_; } |
481 views::WebView* GetContentsWebViewForTest() { return contents_web_view_; } | 471 views::WebView* GetContentsWebViewForTest() { return contents_web_view_; } |
482 views::WebView* GetDevToolsWebViewForTest() { return devtools_web_view_; } | 472 views::WebView* GetDevToolsWebViewForTest() { return devtools_web_view_; } |
483 | 473 |
484 private: | 474 private: |
485 // Do not friend BrowserViewLayout. Use the BrowserViewLayoutDelegate | 475 // Do not friend BrowserViewLayout. Use the BrowserViewLayoutDelegate |
486 // interface to keep these two classes decoupled and testable. | 476 // interface to keep these two classes decoupled and testable. |
487 friend class BrowserViewLayoutDelegateImpl; | 477 friend class BrowserViewLayoutDelegateImpl; |
488 FRIEND_TEST_ALL_PREFIXES(BrowserViewTest, BrowserView); | 478 FRIEND_TEST_ALL_PREFIXES(BrowserViewTest, BrowserView); |
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
724 // If this flag is set then SetFocusToLocationBar() will set focus to the | 714 // If this flag is set then SetFocusToLocationBar() will set focus to the |
725 // location bar even if the browser window is not active. | 715 // location bar even if the browser window is not active. |
726 bool force_location_bar_focus_; | 716 bool force_location_bar_focus_; |
727 | 717 |
728 scoped_ptr<ImmersiveModeController> immersive_mode_controller_; | 718 scoped_ptr<ImmersiveModeController> immersive_mode_controller_; |
729 | 719 |
730 scoped_ptr<WebContentsCloseHandler> web_contents_close_handler_; | 720 scoped_ptr<WebContentsCloseHandler> web_contents_close_handler_; |
731 | 721 |
732 SigninViewController signin_view_controller_; | 722 SigninViewController signin_view_controller_; |
733 | 723 |
734 // The class that registers for keyboard shortcuts for extension commands. | |
735 scoped_ptr<ExtensionKeybindingRegistryViews> extension_keybinding_registry_; | |
736 | |
737 mutable base::WeakPtrFactory<BrowserView> activate_modal_dialog_factory_; | 724 mutable base::WeakPtrFactory<BrowserView> activate_modal_dialog_factory_; |
738 | 725 |
739 DISALLOW_COPY_AND_ASSIGN(BrowserView); | 726 DISALLOW_COPY_AND_ASSIGN(BrowserView); |
740 }; | 727 }; |
741 | 728 |
742 #endif // CHROME_BROWSER_UI_VIEWS_FRAME_BROWSER_VIEW_H_ | 729 #endif // CHROME_BROWSER_UI_VIEWS_FRAME_BROWSER_VIEW_H_ |
OLD | NEW |