| 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; | |
| 27 class GURL; | 26 class GURL; |
| 28 | 27 |
| 29 // Component placed into a browser window controller to manage communication | 28 // Component placed into a browser window controller to manage communication |
| 30 // with the exclusive access bubble, which appears for events such as entering | 29 // with the exclusive access bubble, which appears for events such as entering |
| 31 // fullscreen. | 30 // fullscreen. |
| 32 class ExclusiveAccessController : public ExclusiveAccessContext, | 31 class ExclusiveAccessController : public ExclusiveAccessContext, |
| 33 public ui::AcceleratorProvider, | 32 public ui::AcceleratorProvider, |
| 34 public ExclusiveAccessBubbleViewsContext { | 33 public ExclusiveAccessBubbleViewsContext { |
| 35 public: | 34 public: |
| 36 ExclusiveAccessController(BrowserWindowController* controller, | 35 ExclusiveAccessController(BrowserWindowController* controller, |
| 37 Browser* browser); | 36 Browser* browser); |
| 38 ~ExclusiveAccessController() override; | 37 ~ExclusiveAccessController() override; |
| 39 | 38 |
| 40 const GURL& url() const { return url_; } | 39 const GURL& url() const { return url_; } |
| 41 ExclusiveAccessBubbleType bubble_type() const { return bubble_type_; } | 40 ExclusiveAccessBubbleType bubble_type() const { return bubble_type_; } |
| 42 ExclusiveAccessBubbleWindowController* cocoa_bubble() { | |
| 43 return cocoa_bubble_; | |
| 44 } | |
| 45 | 41 |
| 46 // Shows the bubble once the NSWindow has received -windowDidEnterFullScreen:. | 42 // Shows the bubble once the NSWindow has received -windowDidEnterFullScreen:. |
| 47 void Show(); | 43 void Show(); |
| 48 | 44 |
| 49 // Closes any open bubble. | 45 // Closes any open bubble. |
| 50 void Destroy(); | 46 void Destroy(); |
| 51 | 47 |
| 52 // If showing, position the bubble at the given y-coordinate. | 48 // If showing, position the bubble at the given y-coordinate. |
| 53 void Layout(CGFloat max_y); | 49 void Layout(CGFloat max_y); |
| 54 | 50 |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 91 BrowserWindowController* controller_; // Weak. Owns |this|. | 87 BrowserWindowController* controller_; // Weak. Owns |this|. |
| 92 Browser* browser_; // Weak. Owned by controller. | 88 Browser* browser_; // Weak. Owned by controller. |
| 93 | 89 |
| 94 // When going fullscreen for a tab, we need to store the URL and the | 90 // 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 | 91 // fullscreen type, since we can't show the bubble until |
| 96 // -windowDidEnterFullScreen: gets called. | 92 // -windowDidEnterFullScreen: gets called. |
| 97 GURL url_; | 93 GURL url_; |
| 98 ExclusiveAccessBubbleType bubble_type_; | 94 ExclusiveAccessBubbleType bubble_type_; |
| 99 | 95 |
| 100 std::unique_ptr<ExclusiveAccessBubbleViews> views_bubble_; | 96 std::unique_ptr<ExclusiveAccessBubbleViews> views_bubble_; |
| 101 base::scoped_nsobject<ExclusiveAccessBubbleWindowController> cocoa_bubble_; | |
| 102 | 97 |
| 103 // Used to keep track of the kShowFullscreenToolbar preference. | 98 // Used to keep track of the kShowFullscreenToolbar preference. |
| 104 PrefChangeRegistrar pref_registrar_; | 99 PrefChangeRegistrar pref_registrar_; |
| 105 | 100 |
| 106 DISALLOW_COPY_AND_ASSIGN(ExclusiveAccessController); | 101 DISALLOW_COPY_AND_ASSIGN(ExclusiveAccessController); |
| 107 }; | 102 }; |
| 108 | 103 |
| 109 #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 |