Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(180)

Side by Side Diff: chrome/browser/ui/exclusive_access/exclusive_access_manager.h

Issue 877413004: Refactor away the Browser* dependency in exclusive_access (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix broken mac change Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2015 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2015 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_EXCLUSIVE_ACCESS_EXCLUSIVE_ACCESS_MANAGER_H_ 5 #ifndef CHROME_BROWSER_UI_EXCLUSIVE_ACCESS_EXCLUSIVE_ACCESS_MANAGER_H_
6 #define CHROME_BROWSER_UI_EXCLUSIVE_ACCESS_EXCLUSIVE_ACCESS_MANAGER_H_ 6 #define CHROME_BROWSER_UI_EXCLUSIVE_ACCESS_EXCLUSIVE_ACCESS_MANAGER_H_
7 7
8 #include "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
9 #include "chrome/browser/ui/exclusive_access/exclusive_access_bubble_type.h" 9 #include "chrome/browser/ui/exclusive_access/exclusive_access_bubble_type.h"
10 #include "chrome/browser/ui/exclusive_access/fullscreen_controller.h" 10 #include "chrome/browser/ui/exclusive_access/fullscreen_controller.h"
11 #include "chrome/browser/ui/exclusive_access/mouse_lock_controller.h" 11 #include "chrome/browser/ui/exclusive_access/mouse_lock_controller.h"
12 12
13 class Browser; 13 class ExclusiveAccessContext;
14 class FullscreenController; 14 class FullscreenController;
15 class GURL; 15 class GURL;
16 class MouseLockController; 16 class MouseLockController;
17 17
18 namespace content { 18 namespace content {
19 class WebContents; 19 class WebContents;
20 } 20 }
21 21
22 // This class combines the different exclusive access modes (like fullscreen and 22 // This class combines the different exclusive access modes (like fullscreen and
23 // mouse lock) which are each handled by respective controller. It also updates 23 // mouse lock) which are each handled by respective controller. It also updates
24 // the exit bubble to reflect the combined state. 24 // the exit bubble to reflect the combined state.
25 class ExclusiveAccessManager { 25 class ExclusiveAccessManager {
26 public: 26 public:
27 explicit ExclusiveAccessManager(Browser* browser); 27 explicit ExclusiveAccessManager(
28 ExclusiveAccessContext* exclusive_access_context);
28 ~ExclusiveAccessManager(); 29 ~ExclusiveAccessManager();
29 30
30 FullscreenController* fullscreen_controller() { 31 FullscreenController* fullscreen_controller() {
31 return &fullscreen_controller_; 32 return &fullscreen_controller_;
32 } 33 }
33 34
34 MouseLockController* mouse_lock_controller() { 35 MouseLockController* mouse_lock_controller() {
35 return &mouse_lock_controller_; 36 return &mouse_lock_controller_;
36 } 37 }
37 38
39 ExclusiveAccessContext* context() const { return exclusive_access_context_; }
40
38 ExclusiveAccessBubbleType GetExclusiveAccessExitBubbleType() const; 41 ExclusiveAccessBubbleType GetExclusiveAccessExitBubbleType() const;
39 void UpdateExclusiveAccessExitBubbleContent(); 42 void UpdateExclusiveAccessExitBubbleContent();
40 43
41 GURL GetExclusiveAccessBubbleURL() const; 44 GURL GetExclusiveAccessBubbleURL() const;
42 45
43 // Callbacks //////////////////////////////////////////////////////////////// 46 // Callbacks ////////////////////////////////////////////////////////////////
44 47
45 // Called by Browser::TabDeactivated. 48 // Called by Browser::TabDeactivated.
46 void OnTabDeactivated(content::WebContents* web_contents); 49 void OnTabDeactivated(content::WebContents* web_contents);
47 50
48 // Called by Browser::ActiveTabChanged. 51 // Called by Browser::ActiveTabChanged.
49 void OnTabDetachedFromView(content::WebContents* web_contents); 52 void OnTabDetachedFromView(content::WebContents* web_contents);
50 53
51 // Called by Browser::TabClosingAt. 54 // Called by Browser::TabClosingAt.
52 void OnTabClosing(content::WebContents* web_contents); 55 void OnTabClosing(content::WebContents* web_contents);
53 56
54 // Called by Browser::PreHandleKeyboardEvent 57 // Called by Browser::PreHandleKeyboardEvent
55 bool HandleUserPressedEscape(); 58 bool HandleUserPressedEscape();
56 59
57 // Called by platform ExclusiveAccessExitBubble. 60 // Called by platform ExclusiveAccessExitBubble.
58 void OnAcceptExclusiveAccessPermission(); 61 void OnAcceptExclusiveAccessPermission();
59 void OnDenyExclusiveAccessPermission(); 62 void OnDenyExclusiveAccessPermission();
63 void ExitExclusiveAccess();
60 64
61 private: 65 private:
62 Browser* const browser_; 66 ExclusiveAccessContext* const exclusive_access_context_;
63 FullscreenController fullscreen_controller_; 67 FullscreenController fullscreen_controller_;
64 MouseLockController mouse_lock_controller_; 68 MouseLockController mouse_lock_controller_;
65 69
66 DISALLOW_COPY_AND_ASSIGN(ExclusiveAccessManager); 70 DISALLOW_COPY_AND_ASSIGN(ExclusiveAccessManager);
67 }; 71 };
68 72
69 #endif // CHROME_BROWSER_UI_EXCLUSIVE_ACCESS_EXCLUSIVE_ACCESS_MANAGER_H_ 73 #endif // CHROME_BROWSER_UI_EXCLUSIVE_ACCESS_EXCLUSIVE_ACCESS_MANAGER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698