| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/policy/browser_policy_connector.h" | 5 #include "chrome/browser/policy/browser_policy_connector.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/file_path.h" | 10 #include "base/file_path.h" |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 130 // cloud policy on the Desktop requires a refactoring of the cloud provider, | 130 // cloud policy on the Desktop requires a refactoring of the cloud provider, |
| 131 // but for now it just isn't created. | 131 // but for now it just isn't created. |
| 132 CommandLine* command_line = CommandLine::ForCurrentProcess(); | 132 CommandLine* command_line = CommandLine::ForCurrentProcess(); |
| 133 if (command_line->HasSwitch(switches::kDeviceManagementUrl)) { | 133 if (command_line->HasSwitch(switches::kDeviceManagementUrl)) { |
| 134 device_management_service_.reset( | 134 device_management_service_.reset( |
| 135 new DeviceManagementService( | 135 new DeviceManagementService( |
| 136 command_line->GetSwitchValueASCII(switches::kDeviceManagementUrl))); | 136 command_line->GetSwitchValueASCII(switches::kDeviceManagementUrl))); |
| 137 if (!command_line->HasSwitch(switches::kEnableCloudPolicyService)) { | 137 if (!command_line->HasSwitch(switches::kEnableCloudPolicyService)) { |
| 138 managed_cloud_provider_.reset(new CloudPolicyProvider( | 138 managed_cloud_provider_.reset(new CloudPolicyProvider( |
| 139 this, | 139 this, |
| 140 GetChromePolicyDefinitionList(), | |
| 141 POLICY_LEVEL_MANDATORY)); | 140 POLICY_LEVEL_MANDATORY)); |
| 142 recommended_cloud_provider_.reset(new CloudPolicyProvider( | 141 recommended_cloud_provider_.reset(new CloudPolicyProvider( |
| 143 this, | 142 this, |
| 144 GetChromePolicyDefinitionList(), | |
| 145 POLICY_LEVEL_RECOMMENDED)); | 143 POLICY_LEVEL_RECOMMENDED)); |
| 146 } | 144 } |
| 147 } | 145 } |
| 148 | 146 |
| 149 InitializeDevicePolicy(); | 147 InitializeDevicePolicy(); |
| 150 | 148 |
| 151 // Create the AppPackUpdater to start updating the cache. It requires the | 149 // Create the AppPackUpdater to start updating the cache. It requires the |
| 152 // system request context, which isn't available yet; therefore it is | 150 // system request context, which isn't available yet; therefore it is |
| 153 // created only once the loops are running. | 151 // created only once the loops are running. |
| 154 MessageLoop::current()->PostTask( | 152 MessageLoop::current()->PostTask( |
| (...skipping 391 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 546 } | 544 } |
| 547 device_data_store_->set_device_status_collector( | 545 device_data_store_->set_device_status_collector( |
| 548 new DeviceStatusCollector( | 546 new DeviceStatusCollector( |
| 549 g_browser_process->local_state(), | 547 g_browser_process->local_state(), |
| 550 chromeos::system::StatisticsProvider::GetInstance(), | 548 chromeos::system::StatisticsProvider::GetInstance(), |
| 551 NULL)); | 549 NULL)); |
| 552 #endif | 550 #endif |
| 553 } | 551 } |
| 554 | 552 |
| 555 // static | 553 // static |
| 556 ConfigurationPolicyProvider* | 554 ConfigurationPolicyProvider* BrowserPolicyConnector::CreatePlatformProvider() { |
| 557 BrowserPolicyConnector::CreatePlatformProvider() { | 555 #if defined(OS_WIN) |
| 558 const PolicyDefinitionList* policy_list = GetChromePolicyDefinitionList(); | 556 const PolicyDefinitionList* policy_list = GetChromePolicyDefinitionList(); |
| 559 #if defined(OS_WIN) | |
| 560 scoped_ptr<AsyncPolicyLoader> loader(new PolicyLoaderWin(policy_list)); | 557 scoped_ptr<AsyncPolicyLoader> loader(new PolicyLoaderWin(policy_list)); |
| 561 return new AsyncPolicyProvider(policy_list, loader.Pass()); | 558 return new AsyncPolicyProvider(loader.Pass()); |
| 562 #elif defined(OS_MACOSX) | 559 #elif defined(OS_MACOSX) |
| 560 const PolicyDefinitionList* policy_list = GetChromePolicyDefinitionList(); |
| 563 scoped_ptr<AsyncPolicyLoader> loader( | 561 scoped_ptr<AsyncPolicyLoader> loader( |
| 564 new PolicyLoaderMac(policy_list, new MacPreferences())); | 562 new PolicyLoaderMac(policy_list, new MacPreferences())); |
| 565 return new AsyncPolicyProvider(policy_list, loader.Pass()); | 563 return new AsyncPolicyProvider(loader.Pass()); |
| 566 #elif defined(OS_POSIX) | 564 #elif defined(OS_POSIX) |
| 567 FilePath config_dir_path; | 565 FilePath config_dir_path; |
| 568 if (PathService::Get(chrome::DIR_POLICY_FILES, &config_dir_path)) { | 566 if (PathService::Get(chrome::DIR_POLICY_FILES, &config_dir_path)) { |
| 569 scoped_ptr<AsyncPolicyLoader> loader( | 567 scoped_ptr<AsyncPolicyLoader> loader( |
| 570 new ConfigDirPolicyLoader(config_dir_path, POLICY_SCOPE_MACHINE)); | 568 new ConfigDirPolicyLoader(config_dir_path, POLICY_SCOPE_MACHINE)); |
| 571 return new AsyncPolicyProvider(policy_list, loader.Pass()); | 569 return new AsyncPolicyProvider(loader.Pass()); |
| 572 } else { | 570 } else { |
| 573 return NULL; | 571 return NULL; |
| 574 } | 572 } |
| 575 #else | 573 #else |
| 576 return NULL; | 574 return NULL; |
| 577 #endif | 575 #endif |
| 578 } | 576 } |
| 579 | 577 |
| 580 } // namespace policy | 578 } // namespace policy |
| OLD | NEW |