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

Side by Side Diff: chrome/browser/ui/exclusive_access/exclusive_access_controller_base.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_CONTROLLER_BASE_H_ 5 #ifndef CHROME_BROWSER_UI_EXCLUSIVE_ACCESS_EXCLUSIVE_ACCESS_CONTROLLER_BASE_H_
6 #define CHROME_BROWSER_UI_EXCLUSIVE_ACCESS_EXCLUSIVE_ACCESS_CONTROLLER_BASE_H_ 6 #define CHROME_BROWSER_UI_EXCLUSIVE_ACCESS_EXCLUSIVE_ACCESS_CONTROLLER_BASE_H_
7 7
8 #include "base/basictypes.h" 8 #include "base/basictypes.h"
9 #include "base/memory/weak_ptr.h" 9 #include "base/memory/ref_counted.h"
10 #include "chrome/browser/ui/exclusive_access/exclusive_access_bubble_type.h" 10 #include "chrome/browser/ui/exclusive_access/exclusive_access_bubble_type.h"
11 #include "content/public/browser/notification_observer.h" 11 #include "content/public/browser/notification_observer.h"
12 #include "content/public/browser/notification_registrar.h" 12 #include "content/public/browser/notification_registrar.h"
13 13
14 class Browser;
15 class BrowserWindow;
16 class ExclusiveAccessManager; 14 class ExclusiveAccessManager;
17 class GURL; 15 class GURL;
18 class Profile; 16 class Profile;
19 17
20 namespace content { 18 namespace content {
21 class WebContents; 19 class WebContents;
22 } 20 }
23 21
24 // The base class for the different exclusive access controllers like the 22 // The base class for the different exclusive access controllers like the
25 // FullscreenController, and MouseLockController which controls lifetime for 23 // FullscreenController, and MouseLockController which controls lifetime for
26 // which the resource (screen/mouse) is held exclusively. 24 // which the resource (screen/mouse) is held exclusively.
27 class ExclusiveAccessControllerBase : public content::NotificationObserver { 25 class ExclusiveAccessControllerBase : public content::NotificationObserver {
28 public: 26 public:
29 explicit ExclusiveAccessControllerBase(ExclusiveAccessManager* manager, 27 explicit ExclusiveAccessControllerBase(ExclusiveAccessManager* manager);
30 Browser* browser);
31 ~ExclusiveAccessControllerBase() override; 28 ~ExclusiveAccessControllerBase() override;
32 29
33 GURL GetExclusiveAccessBubbleURL() const; 30 GURL GetExclusiveAccessBubbleURL() const;
34 virtual GURL GetURLForExclusiveAccessBubble() const; 31 virtual GURL GetURLForExclusiveAccessBubble() const;
35 32
36 content::WebContents* exclusive_access_tab() const { 33 content::WebContents* exclusive_access_tab() const {
37 return tab_with_exclusive_access_; 34 return tab_with_exclusive_access_;
38 } 35 }
39 36
40 // Functions implemented by derived classes: 37 // Functions implemented by derived classes:
(...skipping 25 matching lines...) Expand all
66 // access. 63 // access.
67 void Observe(int type, 64 void Observe(int type,
68 const content::NotificationSource& source, 65 const content::NotificationSource& source,
69 const content::NotificationDetails& details) override; 66 const content::NotificationDetails& details) override;
70 67
71 protected: 68 protected:
72 void SetTabWithExclusiveAccess(content::WebContents* tab); 69 void SetTabWithExclusiveAccess(content::WebContents* tab);
73 70
74 ExclusiveAccessManager* exclusive_access_manager() const { return manager_; } 71 ExclusiveAccessManager* exclusive_access_manager() const { return manager_; }
75 72
76 Browser* browser() const { return browser_; }
77
78 Profile* profile() const { return profile_; }
79
80 // Exits exclusive access mode for the tab if currently exclusive. 73 // Exits exclusive access mode for the tab if currently exclusive.
81 virtual void ExitExclusiveAccessIfNecessary() = 0; 74 virtual void ExitExclusiveAccessIfNecessary() = 0;
82 75
83 // Notifies the tab that it has been forced out of exclusive access mode 76 // Notifies the tab that it has been forced out of exclusive access mode
84 // if necessary. 77 // if necessary.
85 virtual void NotifyTabExclusiveAccessLost() = 0; 78 virtual void NotifyTabExclusiveAccessLost() = 0;
86 79
87 private: 80 private:
88 void UpdateNotificationRegistrations(); 81 void UpdateNotificationRegistrations();
89 82
90 ExclusiveAccessManager* const manager_; 83 ExclusiveAccessManager* const manager_;
91 Browser* const browser_;
92 Profile* const profile_;
93 84
94 content::NotificationRegistrar registrar_; 85 content::NotificationRegistrar registrar_;
95 86
96 content::WebContents* tab_with_exclusive_access_; 87 content::WebContents* tab_with_exclusive_access_;
97 88
98 DISALLOW_COPY_AND_ASSIGN(ExclusiveAccessControllerBase); 89 DISALLOW_COPY_AND_ASSIGN(ExclusiveAccessControllerBase);
99 }; 90 };
100 91
101 #endif // CHROME_BROWSER_UI_EXCLUSIVE_ACCESS_EXCLUSIVE_ACCESS_CONTROLLER_BASE_H _ 92 #endif // CHROME_BROWSER_UI_EXCLUSIVE_ACCESS_EXCLUSIVE_ACCESS_CONTROLLER_BASE_H _
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698