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

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: Rename toggle fullscreen function 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* exclusive_access_context() {
miu 2015/02/26 20:07:57 Method should be const.
miu 2015/02/26 20:07:57 This seems to be causing a ton of 3+ line statemen
Sriram 2015/02/26 23:58:03 Done.
Sriram 2015/02/26 23:58:03 Done.
40 return exclusive_access_context_;
41 }
42
38 ExclusiveAccessBubbleType GetExclusiveAccessExitBubbleType() const; 43 ExclusiveAccessBubbleType GetExclusiveAccessExitBubbleType() const;
39 void UpdateExclusiveAccessExitBubbleContent(); 44 void UpdateExclusiveAccessExitBubbleContent();
40 45
41 GURL GetExclusiveAccessBubbleURL() const; 46 GURL GetExclusiveAccessBubbleURL() const;
42 47
43 // Callbacks //////////////////////////////////////////////////////////////// 48 // Callbacks ////////////////////////////////////////////////////////////////
44 49
45 // Called by Browser::TabDeactivated. 50 // Called by Browser::TabDeactivated.
46 void OnTabDeactivated(content::WebContents* web_contents); 51 void OnTabDeactivated(content::WebContents* web_contents);
47 52
48 // Called by Browser::ActiveTabChanged. 53 // Called by Browser::ActiveTabChanged.
49 void OnTabDetachedFromView(content::WebContents* web_contents); 54 void OnTabDetachedFromView(content::WebContents* web_contents);
50 55
51 // Called by Browser::TabClosingAt. 56 // Called by Browser::TabClosingAt.
52 void OnTabClosing(content::WebContents* web_contents); 57 void OnTabClosing(content::WebContents* web_contents);
53 58
54 // Called by Browser::PreHandleKeyboardEvent 59 // Called by Browser::PreHandleKeyboardEvent
55 bool HandleUserPressedEscape(); 60 bool HandleUserPressedEscape();
56 61
57 // Called by platform ExclusiveAccessExitBubble. 62 // Called by platform ExclusiveAccessExitBubble.
58 void OnAcceptExclusiveAccessPermission(); 63 void OnAcceptExclusiveAccessPermission();
59 void OnDenyExclusiveAccessPermission(); 64 void OnDenyExclusiveAccessPermission();
65 void ExitExclusiveAccess();
60 66
61 private: 67 private:
62 Browser* const browser_; 68 ExclusiveAccessContext* exclusive_access_context_;
miu 2015/02/26 20:07:57 ExclusiveAccessContext* const ...;
Sriram 2015/02/26 23:58:03 Done.
63 FullscreenController fullscreen_controller_; 69 FullscreenController fullscreen_controller_;
64 MouseLockController mouse_lock_controller_; 70 MouseLockController mouse_lock_controller_;
65 71
66 DISALLOW_COPY_AND_ASSIGN(ExclusiveAccessManager); 72 DISALLOW_COPY_AND_ASSIGN(ExclusiveAccessManager);
67 }; 73 };
68 74
69 #endif // CHROME_BROWSER_UI_EXCLUSIVE_ACCESS_EXCLUSIVE_ACCESS_MANAGER_H_ 75 #endif // CHROME_BROWSER_UI_EXCLUSIVE_ACCESS_EXCLUSIVE_ACCESS_MANAGER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698