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

Unified Diff: chrome/browser/policy/cloud/user_cloud_policy_manager_factory.h

Issue 44083005: policy: Remove UserCloudPolicyManagerFactory's dependency on Profile. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased. Created 7 years, 1 month 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/policy/cloud/user_cloud_policy_manager_factory.h
diff --git a/chrome/browser/policy/cloud/user_cloud_policy_manager_factory.h b/chrome/browser/policy/cloud/user_cloud_policy_manager_factory.h
index 281ae5f9406f97f9f4cf45a7a060e5ae10764e1c..5047183f2fad98934f58d4698eea9a769ce07d52 100644
--- a/chrome/browser/policy/cloud/user_cloud_policy_manager_factory.h
+++ b/chrome/browser/policy/cloud/user_cloud_policy_manager_factory.h
@@ -12,12 +12,14 @@
#include "base/memory/singleton.h"
#include "components/browser_context_keyed_service/browser_context_keyed_base_factory.h"
-class Profile;
-
namespace base {
class SequencedTaskRunner;
}
+namespace content {
+class BrowserContext;
+}
+
namespace policy {
class UserCloudPolicyManager;
@@ -29,8 +31,8 @@ class UserCloudPolicyManager;
// UserCloudPolicyManager is handled different than other
// BrowserContextKeyedServices because it is a dependency of PrefService.
// Therefore, lifetime of instances is managed by Profile, Profile startup code
-// invokes CreateForProfile() explicitly, takes ownership, and the instance
-// is only deleted after PrefService destruction.
+// invokes CreateForBrowserContext() explicitly, takes ownership, and the
+// instance is only deleted after PrefService destruction.
//
// TODO(mnissler): Remove the special lifetime management in favor of
// PrefService directly depending on UserCloudPolicyManager once the former has
@@ -41,23 +43,25 @@ class UserCloudPolicyManagerFactory : public BrowserContextKeyedBaseFactory {
// Returns an instance of the UserCloudPolicyManagerFactory singleton.
static UserCloudPolicyManagerFactory* GetInstance();
- // Returns the UserCloudPolicyManager instance associated with |profile|.
- static UserCloudPolicyManager* GetForProfile(Profile* profile);
+ // Returns the UserCloudPolicyManager instance associated with |context|.
+ static UserCloudPolicyManager* GetForBrowserContext(
+ content::BrowserContext* context);
- // Creates an instance for |profile|. Note that the caller is responsible for
- // managing the lifetime of the instance. Subsequent calls to GetForProfile()
- // will return the created instance as long as it lives.
+ // Creates an instance for |context|. Note that the caller is responsible for
+ // managing the lifetime of the instance. Subsequent calls to
+ // GetForBrowserContext() will return the created instance as long as it
+ // lives.
//
// If |force_immediate_load| is true, policy is loaded synchronously from
// UserCloudPolicyStore at startup.
- static scoped_ptr<UserCloudPolicyManager> CreateForOriginalProfile(
- Profile* profile,
+ static scoped_ptr<UserCloudPolicyManager> CreateForOriginalBrowserContext(
+ content::BrowserContext* context,
bool force_immediate_load,
scoped_refptr<base::SequencedTaskRunner> background_task_runner);
- static UserCloudPolicyManager* RegisterForOffTheRecordProfile(
- Profile* original_profile,
- Profile* off_the_record_profile);
+ static UserCloudPolicyManager* RegisterForOffTheRecordBrowserContext(
+ content::BrowserContext* original_context,
+ content::BrowserContext* off_the_record_context);
private:
friend class UserCloudPolicyManager;
@@ -67,16 +71,17 @@ class UserCloudPolicyManagerFactory : public BrowserContextKeyedBaseFactory {
virtual ~UserCloudPolicyManagerFactory();
// See comments for the static versions above.
- UserCloudPolicyManager* GetManagerForProfile(Profile* profile);
+ UserCloudPolicyManager* GetManagerForBrowserContext(
+ content::BrowserContext* context);
- scoped_ptr<UserCloudPolicyManager> CreateManagerForOriginalProfile(
- Profile* profile,
+ scoped_ptr<UserCloudPolicyManager> CreateManagerForOriginalBrowserContext(
+ content::BrowserContext* context,
bool force_immediate_load,
scoped_refptr<base::SequencedTaskRunner> background_task_runner);
- UserCloudPolicyManager* RegisterManagerForOffTheRecordProfile(
- Profile* original_profile,
- Profile* off_the_record_profile);
+ UserCloudPolicyManager* RegisterManagerForOffTheRecordBrowserContext(
+ content::BrowserContext* original_context,
+ content::BrowserContext* off_the_record_context);
// BrowserContextKeyedBaseFactory:
virtual void BrowserContextShutdown(
@@ -86,10 +91,13 @@ class UserCloudPolicyManagerFactory : public BrowserContextKeyedBaseFactory {
virtual void CreateServiceNow(content::BrowserContext* context) OVERRIDE;
// Invoked by UserCloudPolicyManager to register/unregister instances.
- void Register(Profile* profile, UserCloudPolicyManager* instance);
- void Unregister(Profile* profile, UserCloudPolicyManager* instance);
+ void Register(content::BrowserContext* context,
+ UserCloudPolicyManager* instance);
+ void Unregister(content::BrowserContext* context,
+ UserCloudPolicyManager* instance);
- typedef std::map<Profile*, UserCloudPolicyManager*> ManagerMap;
+ typedef std::map<content::BrowserContext*, UserCloudPolicyManager*>
+ ManagerMap;
ManagerMap managers_;

Powered by Google App Engine
This is Rietveld 408576698