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/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
14 #include "base/timer/timer.h" | 14 #include "base/timer/timer.h" |
15 #include "build/build_config.h" | 15 #include "build/build_config.h" |
16 #include "chrome/browser/devtools/devtools_window.h" | 16 #include "chrome/browser/devtools/devtools_window.h" |
17 #include "chrome/browser/signin/signin_header_helper.h" | 17 #include "chrome/browser/signin/signin_header_helper.h" |
18 #include "chrome/browser/ui/browser.h" | 18 #include "chrome/browser/ui/browser.h" |
19 #include "chrome/browser/ui/browser_window.h" | 19 #include "chrome/browser/ui/browser_window.h" |
| 20 #include "chrome/browser/ui/exclusive_access/exclusive_access_context.h" |
20 #include "chrome/browser/ui/infobar_container_delegate.h" | 21 #include "chrome/browser/ui/infobar_container_delegate.h" |
21 #include "chrome/browser/ui/omnibox/omnibox_popup_model_observer.h" | 22 #include "chrome/browser/ui/omnibox/omnibox_popup_model_observer.h" |
22 #include "chrome/browser/ui/tabs/tab_strip_model_observer.h" | 23 #include "chrome/browser/ui/tabs/tab_strip_model_observer.h" |
| 24 #include "chrome/browser/ui/views/exclusive_access_bubble_views_context.h" |
23 #include "chrome/browser/ui/views/frame/browser_frame.h" | 25 #include "chrome/browser/ui/views/frame/browser_frame.h" |
24 #include "chrome/browser/ui/views/frame/contents_web_view.h" | 26 #include "chrome/browser/ui/views/frame/contents_web_view.h" |
25 #include "chrome/browser/ui/views/frame/immersive_mode_controller.h" | 27 #include "chrome/browser/ui/views/frame/immersive_mode_controller.h" |
26 #include "chrome/browser/ui/views/frame/web_contents_close_handler.h" | 28 #include "chrome/browser/ui/views/frame/web_contents_close_handler.h" |
27 #include "chrome/browser/ui/views/load_complete_listener.h" | 29 #include "chrome/browser/ui/views/load_complete_listener.h" |
28 #include "ui/base/accelerators/accelerator.h" | 30 #include "ui/base/accelerators/accelerator.h" |
29 #include "ui/base/models/simple_menu_model.h" | 31 #include "ui/base/models/simple_menu_model.h" |
30 #include "ui/gfx/native_widget_types.h" | 32 #include "ui/gfx/native_widget_types.h" |
31 #include "ui/views/controls/button/button.h" | 33 #include "ui/views/controls/button/button.h" |
32 #include "ui/views/controls/webview/unhandled_keyboard_event_handler.h" | 34 #include "ui/views/controls/webview/unhandled_keyboard_event_handler.h" |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
78 // including the TabStrip, toolbars, download shelves, the content area etc. | 80 // including the TabStrip, toolbars, download shelves, the content area etc. |
79 // | 81 // |
80 class BrowserView : public BrowserWindow, | 82 class BrowserView : public BrowserWindow, |
81 public TabStripModelObserver, | 83 public TabStripModelObserver, |
82 public ui::AcceleratorProvider, | 84 public ui::AcceleratorProvider, |
83 public views::WidgetDelegate, | 85 public views::WidgetDelegate, |
84 public views::WidgetObserver, | 86 public views::WidgetObserver, |
85 public views::ClientView, | 87 public views::ClientView, |
86 public InfoBarContainerDelegate, | 88 public InfoBarContainerDelegate, |
87 public LoadCompleteListener::Delegate, | 89 public LoadCompleteListener::Delegate, |
88 public OmniboxPopupModelObserver { | 90 public OmniboxPopupModelObserver, |
| 91 public ExclusiveAccessContext, |
| 92 public ExclusiveAccessBubbleViewsContext { |
89 public: | 93 public: |
90 // The browser view's class name. | 94 // The browser view's class name. |
91 static const char kViewClassName[]; | 95 static const char kViewClassName[]; |
92 | 96 |
93 BrowserView(); | 97 BrowserView(); |
94 ~BrowserView() override; | 98 ~BrowserView() override; |
95 | 99 |
96 // Takes ownership of |browser|. | 100 // Takes ownership of |browser|. |
97 void Init(Browser* browser); | 101 void Init(Browser* browser); |
98 | 102 |
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
268 gfx::Rect GetBounds() const override; | 272 gfx::Rect GetBounds() const override; |
269 bool IsMaximized() const override; | 273 bool IsMaximized() const override; |
270 bool IsMinimized() const override; | 274 bool IsMinimized() const override; |
271 void Maximize() override; | 275 void Maximize() override; |
272 void Minimize() override; | 276 void Minimize() override; |
273 void Restore() override; | 277 void Restore() override; |
274 void EnterFullscreen(const GURL& url, | 278 void EnterFullscreen(const GURL& url, |
275 ExclusiveAccessBubbleType bubble_type, | 279 ExclusiveAccessBubbleType bubble_type, |
276 bool with_toolbar) override; | 280 bool with_toolbar) override; |
277 void ExitFullscreen() override; | 281 void ExitFullscreen() override; |
278 void UpdateFullscreenExitBubbleContent( | 282 void UpdateExclusiveAccessExitBubbleContent( |
279 const GURL& url, | 283 const GURL& url, |
280 ExclusiveAccessBubbleType bubble_type) override; | 284 ExclusiveAccessBubbleType bubble_type) override; |
281 bool ShouldHideUIForFullscreen() const override; | 285 bool ShouldHideUIForFullscreen() const override; |
282 bool IsFullscreen() const override; | 286 bool IsFullscreen() const override; |
283 bool IsFullscreenBubbleVisible() const override; | 287 bool IsFullscreenBubbleVisible() const override; |
284 bool SupportsFullscreenWithToolbar() const override; | 288 bool SupportsFullscreenWithToolbar() const override; |
285 void UpdateFullscreenWithToolbar(bool with_toolbar) override; | 289 void UpdateFullscreenWithToolbar(bool with_toolbar) override; |
286 bool IsFullscreenWithToolbar() const override; | 290 bool IsFullscreenWithToolbar() const override; |
287 #if defined(OS_WIN) | 291 #if defined(OS_WIN) |
288 virtual void SetMetroSnapMode(bool enable) override; | 292 void SetMetroSnapMode(bool enable) override; |
289 virtual bool IsInMetroSnapMode() const override; | 293 bool IsInMetroSnapMode() const override; |
290 #endif | 294 #endif // defined(OS_WIN) |
291 LocationBar* GetLocationBar() const override; | 295 LocationBar* GetLocationBar() const override; |
292 void SetFocusToLocationBar(bool select_all) override; | 296 void SetFocusToLocationBar(bool select_all) override; |
293 void UpdateReloadStopState(bool is_loading, bool force) override; | 297 void UpdateReloadStopState(bool is_loading, bool force) override; |
294 void UpdateToolbar(content::WebContents* contents) override; | 298 void UpdateToolbar(content::WebContents* contents) override; |
295 void ResetToolbarTabState(content::WebContents* contents) override; | 299 void ResetToolbarTabState(content::WebContents* contents) override; |
296 void FocusToolbar() override; | 300 void FocusToolbar() override; |
297 void FocusAppMenu() override; | 301 void FocusAppMenu() override; |
298 void FocusBookmarksToolbar() override; | 302 void FocusBookmarksToolbar() override; |
299 void FocusInfobars() override; | 303 void FocusInfobars() override; |
300 void RotatePaneFocus(bool forwards) override; | 304 void RotatePaneFocus(bool forwards) override; |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
354 const gfx::Rect& bounds) override; | 358 const gfx::Rect& bounds) override; |
355 FindBar* CreateFindBar() override; | 359 FindBar* CreateFindBar() override; |
356 web_modal::WebContentsModalDialogHost* GetWebContentsModalDialogHost() | 360 web_modal::WebContentsModalDialogHost* GetWebContentsModalDialogHost() |
357 override; | 361 override; |
358 void ShowAvatarBubbleFromAvatarButton( | 362 void ShowAvatarBubbleFromAvatarButton( |
359 AvatarBubbleMode mode, | 363 AvatarBubbleMode mode, |
360 const signin::ManageAccountsParams& manage_accounts_params) override; | 364 const signin::ManageAccountsParams& manage_accounts_params) override; |
361 int GetRenderViewHeightInsetWithDetachedBookmarkBar() override; | 365 int GetRenderViewHeightInsetWithDetachedBookmarkBar() override; |
362 void ExecuteExtensionCommand(const extensions::Extension* extension, | 366 void ExecuteExtensionCommand(const extensions::Extension* extension, |
363 const extensions::Command& command) override; | 367 const extensions::Command& command) override; |
| 368 ExclusiveAccessContext* GetExclusiveAccessContext() override; |
364 | 369 |
365 BookmarkBarView* GetBookmarkBarView() const; | 370 BookmarkBarView* GetBookmarkBarView() const; |
366 LocationBarView* GetLocationBarView() const; | 371 LocationBarView* GetLocationBarView() const; |
367 views::View* GetTabContentsContainerView() const; | 372 views::View* GetTabContentsContainerView() const; |
368 ToolbarView* GetToolbarView() const; | 373 ToolbarView* GetToolbarView() const; |
369 | 374 |
370 // Overridden from TabStripModelObserver: | 375 // Overridden from TabStripModelObserver: |
371 void TabInsertedAt(content::WebContents* contents, | 376 void TabInsertedAt(content::WebContents* contents, |
372 int index, | 377 int index, |
373 bool foreground) override; | 378 bool foreground) override; |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
431 void ChildPreferredSizeChanged(View* child) override; | 436 void ChildPreferredSizeChanged(View* child) override; |
432 void GetAccessibleState(ui::AXViewState* state) override; | 437 void GetAccessibleState(ui::AXViewState* state) override; |
433 void OnNativeThemeChanged(const ui::NativeTheme* theme) override; | 438 void OnNativeThemeChanged(const ui::NativeTheme* theme) override; |
434 | 439 |
435 // Overridden from ui::AcceleratorTarget: | 440 // Overridden from ui::AcceleratorTarget: |
436 bool AcceleratorPressed(const ui::Accelerator& accelerator) override; | 441 bool AcceleratorPressed(const ui::Accelerator& accelerator) override; |
437 | 442 |
438 // OmniboxPopupModelObserver overrides | 443 // OmniboxPopupModelObserver overrides |
439 void OnOmniboxPopupShownOrHidden() override; | 444 void OnOmniboxPopupShownOrHidden() override; |
440 | 445 |
| 446 // ExclusiveAccessContext overrides |
| 447 Profile* GetProfile() override; |
| 448 content::WebContents* GetActiveWebContents() override; |
| 449 void HideDownloadShelf() override; |
| 450 void UnhideDownloadShelf() override; |
| 451 |
| 452 // ExclusiveAccessBubbleViewsContext overrides |
| 453 ExclusiveAccessManager* GetExclusiveAccessManager() override; |
| 454 bool IsImmersiveModeEnabled() override; |
| 455 views::Widget* GetBubbleAssociatedWidget() override; |
| 456 gfx::Rect GetTopContainerBoundsInScreen() override; |
| 457 |
441 // Testing interface: | 458 // Testing interface: |
442 views::View* GetContentsContainerForTest() { return contents_container_; } | 459 views::View* GetContentsContainerForTest() { return contents_container_; } |
443 views::WebView* GetContentsWebViewForTest() { return contents_web_view_; } | 460 views::WebView* GetContentsWebViewForTest() { return contents_web_view_; } |
444 views::WebView* GetDevToolsWebViewForTest() { return devtools_web_view_; } | 461 views::WebView* GetDevToolsWebViewForTest() { return devtools_web_view_; } |
445 | 462 |
446 private: | 463 private: |
447 // Do not friend BrowserViewLayout. Use the BrowserViewLayoutDelegate | 464 // Do not friend BrowserViewLayout. Use the BrowserViewLayoutDelegate |
448 // interface to keep these two classes decoupled and testable. | 465 // interface to keep these two classes decoupled and testable. |
449 friend class BrowserViewLayoutDelegateImpl; | 466 friend class BrowserViewLayoutDelegateImpl; |
450 FRIEND_TEST_ALL_PREFIXES(BrowserViewTest, BrowserView); | 467 FRIEND_TEST_ALL_PREFIXES(BrowserViewTest, BrowserView); |
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
698 scoped_ptr<ImmersiveModeController> immersive_mode_controller_; | 715 scoped_ptr<ImmersiveModeController> immersive_mode_controller_; |
699 | 716 |
700 scoped_ptr<WebContentsCloseHandler> web_contents_close_handler_; | 717 scoped_ptr<WebContentsCloseHandler> web_contents_close_handler_; |
701 | 718 |
702 mutable base::WeakPtrFactory<BrowserView> activate_modal_dialog_factory_; | 719 mutable base::WeakPtrFactory<BrowserView> activate_modal_dialog_factory_; |
703 | 720 |
704 DISALLOW_COPY_AND_ASSIGN(BrowserView); | 721 DISALLOW_COPY_AND_ASSIGN(BrowserView); |
705 }; | 722 }; |
706 | 723 |
707 #endif // CHROME_BROWSER_UI_VIEWS_FRAME_BROWSER_VIEW_H_ | 724 #endif // CHROME_BROWSER_UI_VIEWS_FRAME_BROWSER_VIEW_H_ |
OLD | NEW |