diff options
author | bauerb@chromium.org <bauerb@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-05-31 14:41:55 +0000 |
---|---|---|
committer | bauerb@chromium.org <bauerb@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-05-31 14:41:55 +0000 |
commit | 21d3a88076587737d437cfd5d0819f0dda10c823 (patch) | |
tree | 621bbcdb56ceacdb3cb286d895fb9711000b7eb8 /chrome/browser/policy | |
parent | cdaf13d1e037f0119bc8724d0907e31a2729b233 (diff) | |
download | chromium_src-21d3a88076587737d437cfd5d0819f0dda10c823.zip chromium_src-21d3a88076587737d437cfd5d0819f0dda10c823.tar.gz chromium_src-21d3a88076587737d437cfd5d0819f0dda10c823.tar.bz2 |
Make PolicyService per-profile.
At the moment, all the policy services are identical, but this will allow us to add different policies per profile.
BUG=128318
TEST=none
Review URL: https://chromiumcodereview.appspot.com/10444008
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@139783 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/policy')
-rw-r--r-- | chrome/browser/policy/browser_policy_connector.cc | 3 | ||||
-rw-r--r-- | chrome/browser/policy/browser_policy_connector.h | 6 | ||||
-rw-r--r-- | chrome/browser/policy/configuration_policy_pref_store.cc | 10 | ||||
-rw-r--r-- | chrome/browser/policy/configuration_policy_pref_store.h | 6 | ||||
-rw-r--r-- | chrome/browser/policy/policy_map.h | 2 | ||||
-rw-r--r-- | chrome/browser/policy/policy_service.h | 2 |
6 files changed, 18 insertions, 11 deletions
diff --git a/chrome/browser/policy/browser_policy_connector.cc b/chrome/browser/policy/browser_policy_connector.cc index 2b9aa22..b3bd15b 100644 --- a/chrome/browser/policy/browser_policy_connector.cc +++ b/chrome/browser/policy/browser_policy_connector.cc @@ -150,7 +150,8 @@ void BrowserPolicyConnector::Init() { #endif } -PolicyService* BrowserPolicyConnector::CreatePolicyService() const { +PolicyService* BrowserPolicyConnector::CreatePolicyService( + Profile* profile) const { // |providers| in decreasing order of priority. PolicyServiceImpl::Providers providers; if (managed_platform_provider_.get()) diff --git a/chrome/browser/policy/browser_policy_connector.h b/chrome/browser/policy/browser_policy_connector.h index 2781a63..2c52472 100644 --- a/chrome/browser/policy/browser_policy_connector.h +++ b/chrome/browser/policy/browser_policy_connector.h @@ -17,6 +17,7 @@ #include "content/public/browser/notification_observer.h" #include "content/public/browser/notification_registrar.h" +class Profile; class TokenService; namespace policy { @@ -45,8 +46,9 @@ class BrowserPolicyConnector : public content::NotificationObserver { // policy system running. void Init(); - // Ownership is transferred to the caller. - PolicyService* CreatePolicyService() const; + // Creates a new policy service for the given profile, or a global one if + // it is NULL. Ownership is transferred to the caller. + PolicyService* CreatePolicyService(Profile* profile) const; // Returns a weak pointer to the CloudPolicySubsystem corresponding to the // device policy managed by this policy connector, or NULL if no such diff --git a/chrome/browser/policy/configuration_policy_pref_store.cc b/chrome/browser/policy/configuration_policy_pref_store.cc index 280a29f..30bdb12 100644 --- a/chrome/browser/policy/configuration_policy_pref_store.cc +++ b/chrome/browser/policy/configuration_policy_pref_store.cc @@ -94,15 +94,17 @@ void ConfigurationPolicyPrefStore::OnPolicyServiceInitialized() { // static ConfigurationPolicyPrefStore* -ConfigurationPolicyPrefStore::CreateMandatoryPolicyPrefStore() { - return new ConfigurationPolicyPrefStore(g_browser_process->policy_service(), +ConfigurationPolicyPrefStore::CreateMandatoryPolicyPrefStore( + PolicyService* policy_service) { + return new ConfigurationPolicyPrefStore(policy_service, POLICY_LEVEL_MANDATORY); } // static ConfigurationPolicyPrefStore* -ConfigurationPolicyPrefStore::CreateRecommendedPolicyPrefStore() { - return new ConfigurationPolicyPrefStore(g_browser_process->policy_service(), +ConfigurationPolicyPrefStore::CreateRecommendedPolicyPrefStore( + PolicyService* policy_service) { + return new ConfigurationPolicyPrefStore(policy_service, POLICY_LEVEL_RECOMMENDED); } diff --git a/chrome/browser/policy/configuration_policy_pref_store.h b/chrome/browser/policy/configuration_policy_pref_store.h index f3d33a4..7b431ec 100644 --- a/chrome/browser/policy/configuration_policy_pref_store.h +++ b/chrome/browser/policy/configuration_policy_pref_store.h @@ -48,11 +48,13 @@ class ConfigurationPolicyPrefStore // Creates a ConfigurationPolicyPrefStore that only provides policies that // have POLICY_LEVEL_MANDATORY level. - static ConfigurationPolicyPrefStore* CreateMandatoryPolicyPrefStore(); + static ConfigurationPolicyPrefStore* CreateMandatoryPolicyPrefStore( + PolicyService* policy_service); // Creates a ConfigurationPolicyPrefStore that only provides policies that // have POLICY_LEVEL_RECOMMENDED level. - static ConfigurationPolicyPrefStore* CreateRecommendedPolicyPrefStore(); + static ConfigurationPolicyPrefStore* CreateRecommendedPolicyPrefStore( + PolicyService* policy_service); private: virtual ~ConfigurationPolicyPrefStore(); diff --git a/chrome/browser/policy/policy_map.h b/chrome/browser/policy/policy_map.h index a90c146..82b95cb 100644 --- a/chrome/browser/policy/policy_map.h +++ b/chrome/browser/policy/policy_map.h @@ -15,8 +15,6 @@ namespace policy { -struct PolicyDefinitionList; - // A mapping of policy names to policy values for a given policy namespace. class PolicyMap { public: diff --git a/chrome/browser/policy/policy_service.h b/chrome/browser/policy/policy_service.h index 94f57ae..93c7f91 100644 --- a/chrome/browser/policy/policy_service.h +++ b/chrome/browser/policy/policy_service.h @@ -32,6 +32,8 @@ enum PolicyDomain { // and register for notifications on policy updates. // // The PolicyService is available from BrowserProcess as a global singleton. +// There is also a PolicyService for browser-wide policies available from +// BrowserProcess as a global singleton. class PolicyService { public: class Observer { |