| Index: chrome/browser/policy/cloud/user_cloud_policy_manager_factory.cc
|
| diff --git a/chrome/browser/policy/cloud/user_cloud_policy_manager_factory.cc b/chrome/browser/policy/cloud/user_cloud_policy_manager_factory.cc
|
| index 3ac8cb2ad66241a0ff0a3043d69666fc5de20381..275d7cf1676d47f6a66870ef521b2e1ed210cc4e 100644
|
| --- a/chrome/browser/policy/cloud/user_cloud_policy_manager_factory.cc
|
| +++ b/chrome/browser/policy/cloud/user_cloud_policy_manager_factory.cc
|
| @@ -10,7 +10,6 @@
|
| #include "chrome/browser/policy/cloud/cloud_external_data_manager.h"
|
| #include "chrome/browser/policy/cloud/user_cloud_policy_manager.h"
|
| #include "chrome/browser/policy/cloud/user_cloud_policy_store.h"
|
| -#include "chrome/browser/profiles/profile.h"
|
| #include "components/browser_context_keyed_service/browser_context_dependency_manager.h"
|
| #include "content/public/browser/browser_context.h"
|
|
|
| @@ -22,28 +21,28 @@ UserCloudPolicyManagerFactory* UserCloudPolicyManagerFactory::GetInstance() {
|
| }
|
|
|
| // static
|
| -UserCloudPolicyManager* UserCloudPolicyManagerFactory::GetForProfile(
|
| - Profile* profile) {
|
| - return GetInstance()->GetManagerForProfile(profile);
|
| +UserCloudPolicyManager* UserCloudPolicyManagerFactory::GetForBrowserContext(
|
| + content::BrowserContext* context) {
|
| + return GetInstance()->GetManagerForBrowserContext(context);
|
| }
|
|
|
| // static
|
| scoped_ptr<UserCloudPolicyManager>
|
| -UserCloudPolicyManagerFactory::CreateForOriginalProfile(
|
| - Profile* profile,
|
| +UserCloudPolicyManagerFactory::CreateForOriginalBrowserContext(
|
| + content::BrowserContext* context,
|
| bool force_immediate_load,
|
| scoped_refptr<base::SequencedTaskRunner> background_task_runner) {
|
| - return GetInstance()->CreateManagerForOriginalProfile(
|
| - profile, force_immediate_load, background_task_runner);
|
| + return GetInstance()->CreateManagerForOriginalBrowserContext(
|
| + context, force_immediate_load, background_task_runner);
|
| }
|
|
|
| // static
|
| UserCloudPolicyManager*
|
| -UserCloudPolicyManagerFactory::RegisterForOffTheRecordProfile(
|
| - Profile* original_profile,
|
| - Profile* off_the_record_profile) {
|
| - return GetInstance()->RegisterManagerForOffTheRecordProfile(
|
| - original_profile, off_the_record_profile);
|
| +UserCloudPolicyManagerFactory::RegisterForOffTheRecordBrowserContext(
|
| + content::BrowserContext* original_context,
|
| + content::BrowserContext* off_the_record_context) {
|
| + return GetInstance()->RegisterManagerForOffTheRecordBrowserContext(
|
| + original_context, off_the_record_context);
|
| }
|
|
|
|
|
| @@ -54,25 +53,26 @@ UserCloudPolicyManagerFactory::UserCloudPolicyManagerFactory()
|
|
|
| UserCloudPolicyManagerFactory::~UserCloudPolicyManagerFactory() {}
|
|
|
| -UserCloudPolicyManager* UserCloudPolicyManagerFactory::GetManagerForProfile(
|
| +UserCloudPolicyManager*
|
| +UserCloudPolicyManagerFactory::GetManagerForBrowserContext(
|
| content::BrowserContext* context) {
|
| - // Get the manager for the original profile, since the PolicyService is
|
| - // also shared between the incognito Profile and the original Profile.
|
| + // Get the manager for the original context, since the PolicyService is shared
|
| + // between the incognito context and the original context.
|
| ManagerMap::const_iterator it = managers_.find(context);
|
| return it != managers_.end() ? it->second : NULL;
|
| }
|
|
|
| scoped_ptr<UserCloudPolicyManager>
|
| -UserCloudPolicyManagerFactory::CreateManagerForOriginalProfile(
|
| - Profile* profile,
|
| +UserCloudPolicyManagerFactory::CreateManagerForOriginalBrowserContext(
|
| + content::BrowserContext* context,
|
| bool force_immediate_load,
|
| scoped_refptr<base::SequencedTaskRunner> background_task_runner) {
|
| scoped_ptr<UserCloudPolicyStore> store(
|
| - UserCloudPolicyStore::Create(profile, background_task_runner));
|
| + UserCloudPolicyStore::Create(context, background_task_runner));
|
| if (force_immediate_load)
|
| store->LoadImmediately();
|
| scoped_ptr<UserCloudPolicyManager> manager(
|
| - new UserCloudPolicyManager(profile,
|
| + new UserCloudPolicyManager(context,
|
| store.Pass(),
|
| scoped_ptr<CloudExternalDataManager>(),
|
| base::MessageLoopProxy::current()));
|
| @@ -81,11 +81,12 @@ UserCloudPolicyManagerFactory::CreateManagerForOriginalProfile(
|
| }
|
|
|
| UserCloudPolicyManager*
|
| -UserCloudPolicyManagerFactory::RegisterManagerForOffTheRecordProfile(
|
| - Profile* original_profile,
|
| - Profile* off_the_record_profile) {
|
| - UserCloudPolicyManager* manager = GetManagerForProfile(original_profile);
|
| - Register(off_the_record_profile, manager);
|
| +UserCloudPolicyManagerFactory::RegisterManagerForOffTheRecordBrowserContext(
|
| + content::BrowserContext* original_context,
|
| + content::BrowserContext* off_the_record_context) {
|
| + UserCloudPolicyManager* manager =
|
| + GetManagerForBrowserContext(original_context);
|
| + Register(off_the_record_context, manager);
|
| return manager;
|
| }
|
|
|
| @@ -93,7 +94,7 @@ void UserCloudPolicyManagerFactory::BrowserContextShutdown(
|
| content::BrowserContext* context) {
|
| if (context->IsOffTheRecord())
|
| return;
|
| - UserCloudPolicyManager* manager = GetManagerForProfile(context);
|
| + UserCloudPolicyManager* manager = GetManagerForBrowserContext(context);
|
| if (manager)
|
| manager->Shutdown();
|
| }
|
|
|