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