| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/chromeos/policy/browser_policy_connector_chromeos.h" | 5 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 128 const base::CommandLine* command_line = | 128 const base::CommandLine* command_line = |
| 129 base::CommandLine::ForCurrentProcess(); | 129 base::CommandLine::ForCurrentProcess(); |
| 130 if (command_line->HasSwitch( | 130 if (command_line->HasSwitch( |
| 131 chromeos::switches::kEnableConsumerManagement)) { | 131 chromeos::switches::kEnableConsumerManagement)) { |
| 132 consumer_management_service_.reset( | 132 consumer_management_service_.reset( |
| 133 new ConsumerManagementService( | 133 new ConsumerManagementService( |
| 134 cryptohome_client, | 134 cryptohome_client, |
| 135 chromeos::DeviceSettingsService::Get())); | 135 chromeos::DeviceSettingsService::Get())); |
| 136 } | 136 } |
| 137 | 137 |
| 138 scoped_ptr<DeviceCloudPolicyStoreChromeOS> device_cloud_policy_store( | 138 std::unique_ptr<DeviceCloudPolicyStoreChromeOS> device_cloud_policy_store( |
| 139 new DeviceCloudPolicyStoreChromeOS( | 139 new DeviceCloudPolicyStoreChromeOS( |
| 140 chromeos::DeviceSettingsService::Get(), | 140 chromeos::DeviceSettingsService::Get(), install_attributes_.get(), |
| 141 install_attributes_.get(), | |
| 142 GetBackgroundTaskRunner())); | 141 GetBackgroundTaskRunner())); |
| 143 device_cloud_policy_manager_ = new DeviceCloudPolicyManagerChromeOS( | 142 device_cloud_policy_manager_ = new DeviceCloudPolicyManagerChromeOS( |
| 144 std::move(device_cloud_policy_store), | 143 std::move(device_cloud_policy_store), |
| 145 base::ThreadTaskRunnerHandle::Get(), state_keys_broker_.get()); | 144 base::ThreadTaskRunnerHandle::Get(), state_keys_broker_.get()); |
| 146 AddPolicyProvider( | 145 AddPolicyProvider(std::unique_ptr<ConfigurationPolicyProvider>( |
| 147 scoped_ptr<ConfigurationPolicyProvider>(device_cloud_policy_manager_)); | 146 device_cloud_policy_manager_)); |
| 148 } | 147 } |
| 149 | 148 |
| 150 global_user_cloud_policy_provider_ = new ProxyPolicyProvider(); | 149 global_user_cloud_policy_provider_ = new ProxyPolicyProvider(); |
| 151 AddPolicyProvider(scoped_ptr<ConfigurationPolicyProvider>( | 150 AddPolicyProvider(std::unique_ptr<ConfigurationPolicyProvider>( |
| 152 global_user_cloud_policy_provider_)); | 151 global_user_cloud_policy_provider_)); |
| 153 } | 152 } |
| 154 | 153 |
| 155 BrowserPolicyConnectorChromeOS::~BrowserPolicyConnectorChromeOS() {} | 154 BrowserPolicyConnectorChromeOS::~BrowserPolicyConnectorChromeOS() {} |
| 156 | 155 |
| 157 void BrowserPolicyConnectorChromeOS::Init( | 156 void BrowserPolicyConnectorChromeOS::Init( |
| 158 PrefService* local_state, | 157 PrefService* local_state, |
| 159 scoped_refptr<net::URLRequestContextGetter> request_context) { | 158 scoped_refptr<net::URLRequestContextGetter> request_context) { |
| 160 local_state_ = local_state; | 159 local_state_ = local_state; |
| 161 ChromeBrowserPolicyConnector::Init(local_state, request_context); | 160 ChromeBrowserPolicyConnector::Init(local_state, request_context); |
| 162 | 161 |
| 163 affiliated_invalidation_service_provider_.reset( | 162 affiliated_invalidation_service_provider_.reset( |
| 164 new AffiliatedInvalidationServiceProviderImpl); | 163 new AffiliatedInvalidationServiceProviderImpl); |
| 165 | 164 |
| 166 const base::CommandLine* command_line = | 165 const base::CommandLine* command_line = |
| 167 base::CommandLine::ForCurrentProcess(); | 166 base::CommandLine::ForCurrentProcess(); |
| 168 if (command_line->HasSwitch(chromeos::switches::kEnableConsumerManagement)) { | 167 if (command_line->HasSwitch(chromeos::switches::kEnableConsumerManagement)) { |
| 169 scoped_ptr<DeviceManagementService::Configuration> configuration( | 168 std::unique_ptr<DeviceManagementService::Configuration> configuration( |
| 170 new DeviceManagementServiceConfiguration( | 169 new DeviceManagementServiceConfiguration( |
| 171 GetDeviceManagementServerUrlForConsumer())); | 170 GetDeviceManagementServerUrlForConsumer())); |
| 172 consumer_device_management_service_.reset( | 171 consumer_device_management_service_.reset( |
| 173 new DeviceManagementService(std::move(configuration))); | 172 new DeviceManagementService(std::move(configuration))); |
| 174 consumer_device_management_service_->ScheduleInitialization( | 173 consumer_device_management_service_->ScheduleInitialization( |
| 175 kServiceInitializationStartupDelay); | 174 kServiceInitializationStartupDelay); |
| 176 } | 175 } |
| 177 | 176 |
| 178 if (device_cloud_policy_manager_) { | 177 if (device_cloud_policy_manager_) { |
| 179 // Note: for now the |device_cloud_policy_manager_| is using the global | 178 // Note: for now the |device_cloud_policy_manager_| is using the global |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 285 | 284 |
| 286 return EnrollmentConfig(); | 285 return EnrollmentConfig(); |
| 287 } | 286 } |
| 288 | 287 |
| 289 void BrowserPolicyConnectorChromeOS::SetUserPolicyDelegate( | 288 void BrowserPolicyConnectorChromeOS::SetUserPolicyDelegate( |
| 290 ConfigurationPolicyProvider* user_policy_provider) { | 289 ConfigurationPolicyProvider* user_policy_provider) { |
| 291 global_user_cloud_policy_provider_->SetDelegate(user_policy_provider); | 290 global_user_cloud_policy_provider_->SetDelegate(user_policy_provider); |
| 292 } | 291 } |
| 293 | 292 |
| 294 void BrowserPolicyConnectorChromeOS::SetConsumerManagementServiceForTesting( | 293 void BrowserPolicyConnectorChromeOS::SetConsumerManagementServiceForTesting( |
| 295 scoped_ptr<ConsumerManagementService> service) { | 294 std::unique_ptr<ConsumerManagementService> service) { |
| 296 consumer_management_service_ = std::move(service); | 295 consumer_management_service_ = std::move(service); |
| 297 } | 296 } |
| 298 | 297 |
| 299 void BrowserPolicyConnectorChromeOS::SetDeviceCloudPolicyInitializerForTesting( | 298 void BrowserPolicyConnectorChromeOS::SetDeviceCloudPolicyInitializerForTesting( |
| 300 scoped_ptr<DeviceCloudPolicyInitializer> initializer) { | 299 std::unique_ptr<DeviceCloudPolicyInitializer> initializer) { |
| 301 device_cloud_policy_initializer_ = std::move(initializer); | 300 device_cloud_policy_initializer_ = std::move(initializer); |
| 302 } | 301 } |
| 303 | 302 |
| 304 // static | 303 // static |
| 305 void BrowserPolicyConnectorChromeOS::SetInstallAttributesForTesting( | 304 void BrowserPolicyConnectorChromeOS::SetInstallAttributesForTesting( |
| 306 EnterpriseInstallAttributes* attributes) { | 305 EnterpriseInstallAttributes* attributes) { |
| 307 DCHECK(!g_testing_install_attributes); | 306 DCHECK(!g_testing_install_attributes); |
| 308 g_testing_install_attributes = attributes; | 307 g_testing_install_attributes = attributes; |
| 309 } | 308 } |
| 310 | 309 |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 381 device_cloud_policy_manager_->device_store()->policy(); | 380 device_cloud_policy_manager_->device_store()->policy(); |
| 382 if (policy_data) { | 381 if (policy_data) { |
| 383 affiliation_ids.insert(policy_data->device_affiliation_ids().begin(), | 382 affiliation_ids.insert(policy_data->device_affiliation_ids().begin(), |
| 384 policy_data->device_affiliation_ids().end()); | 383 policy_data->device_affiliation_ids().end()); |
| 385 } | 384 } |
| 386 } | 385 } |
| 387 return affiliation_ids; | 386 return affiliation_ids; |
| 388 } | 387 } |
| 389 | 388 |
| 390 } // namespace policy | 389 } // namespace policy |
| OLD | NEW |