diff options
Diffstat (limited to 'chrome/browser/profiles')
-rw-r--r-- | chrome/browser/profiles/off_the_record_profile_impl.cc | 5 | ||||
-rw-r--r-- | chrome/browser/profiles/off_the_record_profile_impl.h | 1 | ||||
-rw-r--r-- | chrome/browser/profiles/profile.h | 7 | ||||
-rw-r--r-- | chrome/browser/profiles/profile_dependency_manager.cc | 5 | ||||
-rw-r--r-- | chrome/browser/profiles/profile_impl.cc | 18 | ||||
-rw-r--r-- | chrome/browser/profiles/profile_impl.h | 10 | ||||
-rw-r--r-- | chrome/browser/profiles/profile_io_data.cc | 1 |
7 files changed, 40 insertions, 7 deletions
diff --git a/chrome/browser/profiles/off_the_record_profile_impl.cc b/chrome/browser/profiles/off_the_record_profile_impl.cc index 94f3bab..ef78264 100644 --- a/chrome/browser/profiles/off_the_record_profile_impl.cc +++ b/chrome/browser/profiles/off_the_record_profile_impl.cc @@ -241,6 +241,11 @@ FaviconService* OffTheRecordProfileImpl::GetFaviconService( return NULL; } +policy::UserCloudPolicyManager* + OffTheRecordProfileImpl::GetUserCloudPolicyManager() { + return profile_->GetUserCloudPolicyManager(); +} + policy::PolicyService* OffTheRecordProfileImpl::GetPolicyService() { return profile_->GetPolicyService(); } diff --git a/chrome/browser/profiles/off_the_record_profile_impl.h b/chrome/browser/profiles/off_the_record_profile_impl.h index 6b09bd4..2ebc061 100644 --- a/chrome/browser/profiles/off_the_record_profile_impl.h +++ b/chrome/browser/profiles/off_the_record_profile_impl.h @@ -49,6 +49,7 @@ class OffTheRecordProfileImpl : public Profile, virtual HistoryService* GetHistoryService(ServiceAccessType sat) OVERRIDE; virtual HistoryService* GetHistoryServiceWithoutCreating() OVERRIDE; virtual FaviconService* GetFaviconService(ServiceAccessType sat) OVERRIDE; + virtual policy::UserCloudPolicyManager* GetUserCloudPolicyManager() OVERRIDE; virtual policy::PolicyService* GetPolicyService() OVERRIDE; virtual PrefService* GetPrefs() OVERRIDE; virtual PrefService* GetOffTheRecordPrefs() OVERRIDE; diff --git a/chrome/browser/profiles/profile.h b/chrome/browser/profiles/profile.h index 37dd180..3912eda 100644 --- a/chrome/browser/profiles/profile.h +++ b/chrome/browser/profiles/profile.h @@ -65,8 +65,8 @@ class FileSystemContext; } namespace history { -class TopSites; class ShortcutsBackend; +class TopSites; } namespace net { @@ -75,6 +75,7 @@ class SSLConfigService; namespace policy { class PolicyService; +class UserCloudPolicyManager; } class Profile : public content::BrowserContext { @@ -249,6 +250,10 @@ class Profile : public content::BrowserContext { // doesn't already exist. virtual HistoryService* GetHistoryServiceWithoutCreating() = 0; + // Returns the UserCloudPolicyManager (if any) that handles this profile's + // connection to the cloud-based management service. + virtual policy::UserCloudPolicyManager* GetUserCloudPolicyManager() = 0; + // Returns the PolicyService that provides policies for this profile. virtual policy::PolicyService* GetPolicyService() = 0; diff --git a/chrome/browser/profiles/profile_dependency_manager.cc b/chrome/browser/profiles/profile_dependency_manager.cc index c070b97..0a30db0 100644 --- a/chrome/browser/profiles/profile_dependency_manager.cc +++ b/chrome/browser/profiles/profile_dependency_manager.cc @@ -60,6 +60,7 @@ #if defined(ENABLE_CONFIGURATION_POLICY) #include "chrome/browser/policy/managed_mode_policy_provider_factory.h" +#include "chrome/browser/policy/user_policy_signin_service_factory.h" #endif #if defined(USE_AURA) @@ -233,6 +234,10 @@ void ProfileDependencyManager::AssertFactoriesBuilt() { PinnedTabServiceFactory::GetInstance(); #endif PluginPrefsFactory::GetInstance(); +#if defined(ENABLE_CONFIGURATION_POLICY) && !defined(OS_CHROMEOS) + // Not used on chromeos because signin happens before the profile is loaded. + policy::UserPolicySigninServiceFactory::GetInstance(); +#endif predictors::AutocompleteActionPredictorFactory::GetInstance(); predictors::PredictorDatabaseFactory::GetInstance(); predictors::ResourcePrefetchPredictorFactory::GetInstance(); diff --git a/chrome/browser/profiles/profile_impl.cc b/chrome/browser/profiles/profile_impl.cc index 34b30d9..bb1f44e 100644 --- a/chrome/browser/profiles/profile_impl.cc +++ b/chrome/browser/profiles/profile_impl.cc @@ -56,6 +56,7 @@ #include "chrome/browser/net/url_fixer_upper.h" #include "chrome/browser/plugin_prefs.h" #include "chrome/browser/policy/policy_service.h" +#include "chrome/browser/policy/user_cloud_policy_manager.h" #include "chrome/browser/prefs/browser_prefs.h" #include "chrome/browser/prefs/scoped_user_pref_update.h" #include "chrome/browser/prerender/prerender_manager_factory.h" @@ -286,10 +287,17 @@ ProfileImpl::ProfileImpl(const FilePath& path, session_restore_enabled_ = !command_line->HasSwitch(switches::kDisableRestoreSessionState); #if defined(ENABLE_CONFIGURATION_POLICY) - policy_service_.reset( - g_browser_process->browser_policy_connector()->CreatePolicyService(this)); + // TODO(atwilson): Change these to ProfileKeyedServices once PrefService is + // a ProfileKeyedService (policy must be initialized before PrefService + // because PrefService depends on policy loading to get overridden pref + // values). + cloud_policy_manager_ = + g_browser_process->browser_policy_connector()->CreateCloudPolicyManager( + this); + policy_service_ = + g_browser_process->browser_policy_connector()->CreatePolicyService(this); #else - policy_service_.reset(new policy::PolicyServiceStub()); + policy_service_.reset(new policy::PolicyServiceStub()); #endif if (create_mode == CREATE_MODE_ASYNCHRONOUS) { prefs_.reset(PrefService::CreatePrefService( @@ -649,6 +657,10 @@ bool ProfileImpl::WasCreatedByVersionOrLater(const std::string& version) { return (profile_version.CompareTo(arg_version) >= 0); } +policy::UserCloudPolicyManager* ProfileImpl::GetUserCloudPolicyManager() { + return cloud_policy_manager_.get(); +} + policy::PolicyService* ProfileImpl::GetPolicyService() { DCHECK(policy_service_.get()); // Should explicitly be initialized. return policy_service_.get(); diff --git a/chrome/browser/profiles/profile_impl.h b/chrome/browser/profiles/profile_impl.h index be96345..cebc882 100644 --- a/chrome/browser/profiles/profile_impl.h +++ b/chrome/browser/profiles/profile_impl.h @@ -87,6 +87,7 @@ class ProfileImpl : public Profile, virtual GAIAInfoUpdateService* GetGAIAInfoUpdateService() OVERRIDE; virtual HistoryService* GetHistoryService(ServiceAccessType sat) OVERRIDE; virtual HistoryService* GetHistoryServiceWithoutCreating() OVERRIDE; + virtual policy::UserCloudPolicyManager* GetUserCloudPolicyManager() OVERRIDE; virtual policy::PolicyService* GetPolicyService() OVERRIDE; virtual PrefService* GetPrefs() OVERRIDE; virtual PrefService* GetOffTheRecordPrefs() OVERRIDE; @@ -186,9 +187,12 @@ class ProfileImpl : public Profile, // that the declaration occurs AFTER things it depends on as destruction // happens in reverse order of declaration. - // |prefs_| depends on |policy_service_|. - // TODO(bauerb): Once |prefs_| is a ProfileKeyedService, |policy_service_| - // should become one as well. + // |prefs_| depends on |policy_service_|, which depends on + // |user_cloud_policy_manager_|. + // TODO(bauerb, mnissler): Once |prefs_| is a ProfileKeyedService, + // |policy_service_| and |user_cloud_policy_manager_| should become + // ProfiledKeyedServices as well. + scoped_ptr<policy::UserCloudPolicyManager> cloud_policy_manager_; scoped_ptr<policy::PolicyService> policy_service_; // Keep |prefs_| on top for destruction order because |extension_prefs_|, diff --git a/chrome/browser/profiles/profile_io_data.cc b/chrome/browser/profiles/profile_io_data.cc index 2c8c08d..d9904ab 100644 --- a/chrome/browser/profiles/profile_io_data.cc +++ b/chrome/browser/profiles/profile_io_data.cc @@ -360,6 +360,7 @@ ProfileIOData::GetIsolatedAppRequestContext( } ExtensionInfoMap* ProfileIOData::GetExtensionInfoMap() const { + DCHECK(extension_info_map_) << "ExtensionSystem not initialized"; return extension_info_map_; } |