OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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_COCOA_BROWSER_EXCLUSIVE_ACCESS_CONTROLLER_VIEWS_H_ | 5 #ifndef CHROME_BROWSER_UI_COCOA_BROWSER_EXCLUSIVE_ACCESS_CONTROLLER_VIEWS_H_ |
6 #define CHROME_BROWSER_UI_COCOA_BROWSER_EXCLUSIVE_ACCESS_CONTROLLER_VIEWS_H_ | 6 #define CHROME_BROWSER_UI_COCOA_BROWSER_EXCLUSIVE_ACCESS_CONTROLLER_VIEWS_H_ |
7 | 7 |
8 // Note this file has a _views suffix so that it may have an optional runtime | 8 // Note this file has a _views suffix so that it may have an optional runtime |
9 // dependency on toolkit-views UI. | 9 // dependency on toolkit-views UI. |
10 | 10 |
11 #import <CoreGraphics/CoreGraphics.h> | 11 #import <CoreGraphics/CoreGraphics.h> |
12 | 12 |
13 #import "base/mac/scoped_nsobject.h" | 13 #import "base/mac/scoped_nsobject.h" |
14 #include "base/macros.h" | 14 #include "base/macros.h" |
| 15 #include "base/memory/scoped_ptr.h" |
15 #include "chrome/browser/ui/exclusive_access/exclusive_access_context.h" | 16 #include "chrome/browser/ui/exclusive_access/exclusive_access_context.h" |
| 17 #include "chrome/browser/ui/views/exclusive_access_bubble_views_context.h" |
| 18 #include "ui/base/accelerators/accelerator.h" |
16 | 19 |
17 class Browser; | 20 class Browser; |
18 class BrowserWindow; | 21 class BrowserWindow; |
19 @class BrowserWindowController; | 22 @class BrowserWindowController; |
| 23 class ExclusiveAccessBubbleViews; |
20 @class ExclusiveAccessBubbleWindowController; | 24 @class ExclusiveAccessBubbleWindowController; |
21 class GURL; | 25 class GURL; |
22 | 26 |
23 // Component placed into a browser window controller to manage communication | 27 // Component placed into a browser window controller to manage communication |
24 // with the exclusive access bubble, which appears for events such as entering | 28 // with the exclusive access bubble, which appears for events such as entering |
25 // fullscreen. | 29 // fullscreen. |
26 class ExclusiveAccessController : public ExclusiveAccessContext { | 30 class ExclusiveAccessController : public ExclusiveAccessContext, |
| 31 public ui::AcceleratorProvider, |
| 32 public ExclusiveAccessBubbleViewsContext { |
27 public: | 33 public: |
28 ExclusiveAccessController(BrowserWindowController* controller, | 34 ExclusiveAccessController(BrowserWindowController* controller, |
29 Browser* browser); | 35 Browser* browser); |
30 ~ExclusiveAccessController() override; | 36 ~ExclusiveAccessController() override; |
31 | 37 |
32 const GURL& url() const { return url_; } | 38 const GURL& url() const { return url_; } |
33 ExclusiveAccessBubbleType bubble_type() const { return bubble_type_; } | 39 ExclusiveAccessBubbleType bubble_type() const { return bubble_type_; } |
34 ExclusiveAccessBubbleWindowController* cocoa_bubble() { | 40 ExclusiveAccessBubbleWindowController* cocoa_bubble() { |
35 return cocoa_bubble_; | 41 return cocoa_bubble_; |
36 } | 42 } |
(...skipping 19 matching lines...) Expand all Loading... |
56 bool with_toolbar) override; | 62 bool with_toolbar) override; |
57 void ExitFullscreen() override; | 63 void ExitFullscreen() override; |
58 void UpdateExclusiveAccessExitBubbleContent( | 64 void UpdateExclusiveAccessExitBubbleContent( |
59 const GURL& url, | 65 const GURL& url, |
60 ExclusiveAccessBubbleType bubble_type) override; | 66 ExclusiveAccessBubbleType bubble_type) override; |
61 void OnExclusiveAccessUserInput() override; | 67 void OnExclusiveAccessUserInput() override; |
62 content::WebContents* GetActiveWebContents() override; | 68 content::WebContents* GetActiveWebContents() override; |
63 void UnhideDownloadShelf() override; | 69 void UnhideDownloadShelf() override; |
64 void HideDownloadShelf() override; | 70 void HideDownloadShelf() override; |
65 | 71 |
| 72 // ui::AcceleratorProvider: |
| 73 bool GetAcceleratorForCommandId(int command_id, |
| 74 ui::Accelerator* accelerator) override; |
| 75 |
| 76 // ExclusiveAccessBubbleViewsContext: |
| 77 ExclusiveAccessManager* GetExclusiveAccessManager() override; |
| 78 views::Widget* GetBubbleAssociatedWidget() override; |
| 79 ui::AcceleratorProvider* GetAcceleratorProvider() override; |
| 80 gfx::NativeView GetBubbleParentView() const override; |
| 81 gfx::Point GetCursorPointInParent() const override; |
| 82 gfx::Rect GetClientAreaBoundsInScreen() const override; |
| 83 bool IsImmersiveModeEnabled() override; |
| 84 gfx::Rect GetTopContainerBoundsInScreen() override; |
| 85 |
66 private: | 86 private: |
67 BrowserWindow* GetBrowserWindow() const; | 87 BrowserWindow* GetBrowserWindow() const; |
68 | 88 |
69 BrowserWindowController* controller_; // Weak. Owns |this|. | 89 BrowserWindowController* controller_; // Weak. Owns |this|. |
70 Browser* browser_; // Weak. Owned by controller. | 90 Browser* browser_; // Weak. Owned by controller. |
71 | 91 |
72 // When going fullscreen for a tab, we need to store the URL and the | 92 // When going fullscreen for a tab, we need to store the URL and the |
73 // fullscreen type, since we can't show the bubble until | 93 // fullscreen type, since we can't show the bubble until |
74 // -windowDidEnterFullScreen: gets called. | 94 // -windowDidEnterFullScreen: gets called. |
75 GURL url_; | 95 GURL url_; |
76 ExclusiveAccessBubbleType bubble_type_; | 96 ExclusiveAccessBubbleType bubble_type_; |
77 | 97 |
| 98 scoped_ptr<ExclusiveAccessBubbleViews> views_bubble_; |
78 base::scoped_nsobject<ExclusiveAccessBubbleWindowController> cocoa_bubble_; | 99 base::scoped_nsobject<ExclusiveAccessBubbleWindowController> cocoa_bubble_; |
79 | 100 |
80 DISALLOW_COPY_AND_ASSIGN(ExclusiveAccessController); | 101 DISALLOW_COPY_AND_ASSIGN(ExclusiveAccessController); |
81 }; | 102 }; |
82 | 103 |
83 #endif // CHROME_BROWSER_UI_COCOA_BROWSER_EXCLUSIVE_ACCESS_CONTROLLER_VIEWS_H_ | 104 #endif // CHROME_BROWSER_UI_COCOA_BROWSER_EXCLUSIVE_ACCESS_CONTROLLER_VIEWS_H_ |
OLD | NEW |