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 #include <memory> | 13 #include <memory> |
14 | 14 |
15 #import "base/mac/scoped_nsobject.h" | 15 #import "base/mac/scoped_nsobject.h" |
16 #include "base/macros.h" | 16 #include "base/macros.h" |
17 #include "chrome/browser/ui/exclusive_access/exclusive_access_context.h" | 17 #include "chrome/browser/ui/exclusive_access/exclusive_access_context.h" |
18 #include "chrome/browser/ui/views/exclusive_access_bubble_views_context.h" | 18 #include "chrome/browser/ui/views/exclusive_access_bubble_views_context.h" |
19 #include "components/prefs/pref_change_registrar.h" | 19 #include "components/prefs/pref_change_registrar.h" |
20 #include "ui/base/accelerators/accelerator.h" | 20 #include "ui/base/accelerators/accelerator.h" |
21 | 21 |
22 class Browser; | 22 class Browser; |
23 class BrowserWindow; | 23 class BrowserWindow; |
24 @class BrowserWindowController; | 24 @class BrowserWindowController; |
25 class ExclusiveAccessBubbleViews; | 25 class ExclusiveAccessBubbleViews; |
26 @class ExclusiveAccessBubbleWindowController; | 26 @class ExclusiveAccessBubbleWindowController; |
27 class GURL; | 27 class GURL; |
| 28 class NewBackShortcutBubble; |
28 | 29 |
29 // Component placed into a browser window controller to manage communication | 30 // Component placed into a browser window controller to manage communication |
30 // with the exclusive access bubble, which appears for events such as entering | 31 // with subtle notification bubbles, which appear for events such as entering |
31 // fullscreen. | 32 // fullscreen. |
32 class ExclusiveAccessController : public ExclusiveAccessContext, | 33 class ExclusiveAccessController : public ExclusiveAccessContext, |
33 public ui::AcceleratorProvider, | 34 public ui::AcceleratorProvider, |
34 public ExclusiveAccessBubbleViewsContext { | 35 public ExclusiveAccessBubbleViewsContext { |
35 public: | 36 public: |
36 ExclusiveAccessController(BrowserWindowController* controller, | 37 ExclusiveAccessController(BrowserWindowController* controller, |
37 Browser* browser); | 38 Browser* browser); |
38 ~ExclusiveAccessController() override; | 39 ~ExclusiveAccessController() override; |
39 | 40 |
40 const GURL& url() const { return url_; } | 41 const GURL& url() const { return url_; } |
41 ExclusiveAccessBubbleType bubble_type() const { return bubble_type_; } | 42 ExclusiveAccessBubbleType bubble_type() const { return bubble_type_; } |
42 ExclusiveAccessBubbleWindowController* cocoa_bubble() { | 43 ExclusiveAccessBubbleWindowController* cocoa_bubble() { |
43 return cocoa_bubble_; | 44 return cocoa_bubble_; |
44 } | 45 } |
45 | 46 |
46 // Shows the bubble once the NSWindow has received -windowDidEnterFullScreen:. | 47 // Shows the bubble once the NSWindow has received -windowDidEnterFullScreen:. |
47 void Show(); | 48 void Show(); |
48 | 49 |
| 50 // Shows the new Back shortcut bubble. |
| 51 void ShowNewBackShortcutBubble(bool forward); |
| 52 |
49 // Closes any open bubble. | 53 // Closes any open bubble. |
50 void Destroy(); | 54 void Destroy(); |
51 | 55 |
52 // If showing, position the bubble at the given y-coordinate. | 56 // If showing, position the bubble at the given y-coordinate. |
53 void Layout(CGFloat max_y); | 57 void Layout(CGFloat max_y); |
54 | 58 |
55 // ExclusiveAccessContext: | 59 // ExclusiveAccessContext: |
56 Profile* GetProfile() override; | 60 Profile* GetProfile() override; |
57 bool IsFullscreen() const override; | 61 bool IsFullscreen() const override; |
58 bool SupportsFullscreenWithToolbar() const override; | 62 bool SupportsFullscreenWithToolbar() const override; |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
93 | 97 |
94 // When going fullscreen for a tab, we need to store the URL and the | 98 // When going fullscreen for a tab, we need to store the URL and the |
95 // fullscreen type, since we can't show the bubble until | 99 // fullscreen type, since we can't show the bubble until |
96 // -windowDidEnterFullScreen: gets called. | 100 // -windowDidEnterFullScreen: gets called. |
97 GURL url_; | 101 GURL url_; |
98 ExclusiveAccessBubbleType bubble_type_; | 102 ExclusiveAccessBubbleType bubble_type_; |
99 | 103 |
100 std::unique_ptr<ExclusiveAccessBubbleViews> views_bubble_; | 104 std::unique_ptr<ExclusiveAccessBubbleViews> views_bubble_; |
101 base::scoped_nsobject<ExclusiveAccessBubbleWindowController> cocoa_bubble_; | 105 base::scoped_nsobject<ExclusiveAccessBubbleWindowController> cocoa_bubble_; |
102 | 106 |
| 107 // This class also manages the new Back shortcut bubble (which functions the |
| 108 // same way as ExclusiveAccessBubbleViews). |
| 109 std::unique_ptr<NewBackShortcutBubble> new_back_shortcut_bubble_; |
| 110 |
103 // Used to keep track of the kShowFullscreenToolbar preference. | 111 // Used to keep track of the kShowFullscreenToolbar preference. |
104 PrefChangeRegistrar pref_registrar_; | 112 PrefChangeRegistrar pref_registrar_; |
105 | 113 |
106 DISALLOW_COPY_AND_ASSIGN(ExclusiveAccessController); | 114 DISALLOW_COPY_AND_ASSIGN(ExclusiveAccessController); |
107 }; | 115 }; |
108 | 116 |
109 #endif // CHROME_BROWSER_UI_COCOA_BROWSER_EXCLUSIVE_ACCESS_CONTROLLER_VIEWS_H_ | 117 #endif // CHROME_BROWSER_UI_COCOA_BROWSER_EXCLUSIVE_ACCESS_CONTROLLER_VIEWS_H_ |
OLD | NEW |