Chromium Code Reviews| Index: chrome/browser/policy/browser_policy_connector.cc |
| diff --git a/chrome/browser/policy/browser_policy_connector.cc b/chrome/browser/policy/browser_policy_connector.cc |
| index 2949dacfc1a73171b53028a10a4f1e3be6102e1f..6bc884f2e32a8fe37103b221839be3fe0ec9f987 100644 |
| --- a/chrome/browser/policy/browser_policy_connector.cc |
| +++ b/chrome/browser/policy/browser_policy_connector.cc |
| @@ -34,6 +34,7 @@ |
| #include "chrome/common/chrome_paths.h" |
| #include "chrome/common/chrome_switches.h" |
| #include "chrome/common/pref_names.h" |
| +#include "components/policy/core/common/policy_schema.h" |
| #include "content/public/browser/browser_thread.h" |
| #include "google_apis/gaia/gaia_auth_util.h" |
| #include "google_apis/gaia/gaia_constants.h" |
| @@ -94,7 +95,6 @@ const char kDefaultDeviceManagementServerUrl[] = |
| // Used in BrowserPolicyConnector::SetPolicyProviderForTesting. |
| ConfigurationPolicyProvider* g_testing_provider = NULL; |
| - |
| #if defined(OS_MACOSX) && !defined(OS_IOS) |
| base::FilePath GetManagedPolicyPath() { |
| // This constructs the path to the plist file in which Mac OS X stores the |
| @@ -159,6 +159,13 @@ BrowserPolicyConnector::BrowserPolicyConnector() |
| install_attributes_.get())); |
| } |
| #endif |
| + |
| + std::vector<ConfigurationPolicyProvider*> providers; |
| +#if defined(OS_CHROMEOS) |
| + providers.push_back(&global_user_cloud_policy_provider_); |
| +#endif |
| + policy_service_ = CreatePolicyService(providers); |
| + platform_provider_->InitialLoad(); |
| } |
| BrowserPolicyConnector::~BrowserPolicyConnector() { |
| @@ -273,13 +280,6 @@ void BrowserPolicyConnector::Shutdown() { |
| } |
| PolicyService* BrowserPolicyConnector::GetPolicyService() { |
| - if (!policy_service_) { |
| - std::vector<ConfigurationPolicyProvider*> providers; |
| -#if defined(OS_CHROMEOS) |
| - providers.push_back(&global_user_cloud_policy_provider_); |
| -#endif |
| - policy_service_ = CreatePolicyService(providers); |
| - } |
| return policy_service_.get(); |
| } |
| @@ -323,9 +323,16 @@ scoped_ptr<PolicyService> BrowserPolicyConnector::CreatePolicyService( |
| std::back_inserter(providers)); |
| } |
| scoped_ptr<PolicyService> service(new PolicyServiceImpl(providers)); |
| + |
| + // Create the global descriptor. |
| scoped_refptr<PolicyDomainDescriptor> descriptor = new PolicyDomainDescriptor( |
| POLICY_DOMAIN_CHROME); |
| - service->RegisterPolicyDomain(descriptor); |
| + std::string err; |
| + scoped_ptr<PolicySchema> schema = PolicySchema::Parse(kPolicyJsonSchema, |
| + &err); |
| + CHECK(err == "") << err; |
|
Joao da Silva
2013/09/11 13:32:02
CHECK(schema) << err
|
| + descriptor->RegisterComponent("", schema.Pass()); |
| + service->InitialRegisterPolicyDomain(descriptor); |
| return service.Pass(); |
| } |