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 "base/bind.h" | 8 #include "base/bind.h" |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
11 #include "base/location.h" | 11 #include "base/location.h" |
12 #include "base/logging.h" | 12 #include "base/logging.h" |
13 #include "base/message_loop/message_loop.h" | 13 #include "base/message_loop/message_loop.h" |
14 #include "base/message_loop/message_loop_proxy.h" | 14 #include "base/message_loop/message_loop_proxy.h" |
15 #include "base/path_service.h" | 15 #include "base/path_service.h" |
16 #include "base/prefs/pref_registry_simple.h" | 16 #include "base/prefs/pref_registry_simple.h" |
17 #include "base/sequenced_task_runner.h" | 17 #include "base/sequenced_task_runner.h" |
18 #include "base/strings/utf_string_conversions.h" | 18 #include "base/strings/utf_string_conversions.h" |
19 #include "base/threading/sequenced_worker_pool.h" | 19 #include "base/threading/sequenced_worker_pool.h" |
| 20 #include "chrome/browser/chromeos/policy/affiliated_invalidation_service_provide
r.h" |
20 #include "chrome/browser/chromeos/policy/consumer_management_service.h" | 21 #include "chrome/browser/chromeos/policy/consumer_management_service.h" |
21 #include "chrome/browser/chromeos/policy/device_cloud_policy_initializer.h" | 22 #include "chrome/browser/chromeos/policy/device_cloud_policy_initializer.h" |
22 #include "chrome/browser/chromeos/policy/device_cloud_policy_invalidator.h" | 23 #include "chrome/browser/chromeos/policy/device_cloud_policy_invalidator.h" |
23 #include "chrome/browser/chromeos/policy/device_cloud_policy_store_chromeos.h" | 24 #include "chrome/browser/chromeos/policy/device_cloud_policy_store_chromeos.h" |
24 #include "chrome/browser/chromeos/policy/device_local_account.h" | 25 #include "chrome/browser/chromeos/policy/device_local_account.h" |
25 #include "chrome/browser/chromeos/policy/device_local_account_policy_service.h" | 26 #include "chrome/browser/chromeos/policy/device_local_account_policy_service.h" |
26 #include "chrome/browser/chromeos/policy/device_network_configuration_updater.h" | 27 #include "chrome/browser/chromeos/policy/device_network_configuration_updater.h" |
27 #include "chrome/browser/chromeos/policy/enrollment_config.h" | 28 #include "chrome/browser/chromeos/policy/enrollment_config.h" |
28 #include "chrome/browser/chromeos/policy/enterprise_install_attributes.h" | 29 #include "chrome/browser/chromeos/policy/enterprise_install_attributes.h" |
29 #include "chrome/browser/chromeos/policy/server_backed_state_keys_broker.h" | 30 #include "chrome/browser/chromeos/policy/server_backed_state_keys_broker.h" |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
145 } | 146 } |
146 | 147 |
147 BrowserPolicyConnectorChromeOS::~BrowserPolicyConnectorChromeOS() {} | 148 BrowserPolicyConnectorChromeOS::~BrowserPolicyConnectorChromeOS() {} |
148 | 149 |
149 void BrowserPolicyConnectorChromeOS::Init( | 150 void BrowserPolicyConnectorChromeOS::Init( |
150 PrefService* local_state, | 151 PrefService* local_state, |
151 scoped_refptr<net::URLRequestContextGetter> request_context) { | 152 scoped_refptr<net::URLRequestContextGetter> request_context) { |
152 local_state_ = local_state; | 153 local_state_ = local_state; |
153 ChromeBrowserPolicyConnector::Init(local_state, request_context); | 154 ChromeBrowserPolicyConnector::Init(local_state, request_context); |
154 | 155 |
| 156 affiliated_invalidation_service_provider_.reset( |
| 157 new AffiliatedInvalidationServiceProvider); |
| 158 |
155 const base::CommandLine* command_line = | 159 const base::CommandLine* command_line = |
156 base::CommandLine::ForCurrentProcess(); | 160 base::CommandLine::ForCurrentProcess(); |
157 if (command_line->HasSwitch(chromeos::switches::kEnableConsumerManagement)) { | 161 if (command_line->HasSwitch(chromeos::switches::kEnableConsumerManagement)) { |
158 scoped_ptr<DeviceManagementService::Configuration> configuration( | 162 scoped_ptr<DeviceManagementService::Configuration> configuration( |
159 new DeviceManagementServiceConfiguration( | 163 new DeviceManagementServiceConfiguration( |
160 GetDeviceManagementServerUrlForConsumer())); | 164 GetDeviceManagementServerUrlForConsumer())); |
161 consumer_device_management_service_.reset( | 165 consumer_device_management_service_.reset( |
162 new DeviceManagementService(configuration.Pass())); | 166 new DeviceManagementService(configuration.Pass())); |
163 consumer_device_management_service_->ScheduleInitialization( | 167 consumer_device_management_service_->ScheduleInitialization( |
164 kServiceInitializationStartupDelay); | 168 kServiceInitializationStartupDelay); |
(...skipping 29 matching lines...) Expand all Loading... |
194 network_configuration_updater_ = | 198 network_configuration_updater_ = |
195 DeviceNetworkConfigurationUpdater::CreateForDevicePolicy( | 199 DeviceNetworkConfigurationUpdater::CreateForDevicePolicy( |
196 GetPolicyService(), | 200 GetPolicyService(), |
197 chromeos::NetworkHandler::Get() | 201 chromeos::NetworkHandler::Get() |
198 ->managed_network_configuration_handler(), | 202 ->managed_network_configuration_handler(), |
199 chromeos::NetworkHandler::Get()->network_device_handler(), | 203 chromeos::NetworkHandler::Get()->network_device_handler(), |
200 chromeos::CrosSettings::Get()); | 204 chromeos::CrosSettings::Get()); |
201 } | 205 } |
202 | 206 |
203 void BrowserPolicyConnectorChromeOS::PreShutdown() { | 207 void BrowserPolicyConnectorChromeOS::PreShutdown() { |
| 208 // Let the |affiliated_invalidation_service_provider_| unregister itself as an |
| 209 // observer of per-Profile InvalidationServices and the device-global |
| 210 // invalidation::TiclInvalidationService it may have created as an observer of |
| 211 // the DeviceOAuth2TokenService that is destroyed before Shutdown() is called. |
| 212 if (affiliated_invalidation_service_provider_) |
| 213 affiliated_invalidation_service_provider_->Shutdown(); |
| 214 |
204 // Let the |device_cloud_policy_invalidator_| unregister itself as an | 215 // Let the |device_cloud_policy_invalidator_| unregister itself as an |
205 // observer of per-Profile InvalidationServices and the device-global | 216 // observer of per-Profile InvalidationServices and the device-global |
206 // invalidation::TiclInvalidationService it may have created as an observer of | 217 // invalidation::TiclInvalidationService it may have created as an observer of |
207 // the DeviceOAuth2TokenService that is destroyed before Shutdown() is called. | 218 // the DeviceOAuth2TokenService that is destroyed before Shutdown() is called. |
208 device_cloud_policy_invalidator_.reset(); | 219 device_cloud_policy_invalidator_.reset(); |
209 } | 220 } |
210 | 221 |
211 void BrowserPolicyConnectorChromeOS::Shutdown() { | 222 void BrowserPolicyConnectorChromeOS::Shutdown() { |
212 // Verify that PreShutdown() has been called first. | 223 // Verify that PreShutdown() has been called first. |
213 DCHECK(!device_cloud_policy_invalidator_); | 224 DCHECK(!device_cloud_policy_invalidator_); |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
347 consumer_device_management_service_.get(), | 358 consumer_device_management_service_.get(), |
348 GetBackgroundTaskRunner(), | 359 GetBackgroundTaskRunner(), |
349 install_attributes_.get(), | 360 install_attributes_.get(), |
350 state_keys_broker_.get(), | 361 state_keys_broker_.get(), |
351 device_cloud_policy_manager_->device_store(), | 362 device_cloud_policy_manager_->device_store(), |
352 device_cloud_policy_manager_)); | 363 device_cloud_policy_manager_)); |
353 device_cloud_policy_initializer_->Init(); | 364 device_cloud_policy_initializer_->Init(); |
354 } | 365 } |
355 | 366 |
356 } // namespace policy | 367 } // namespace policy |
OLD | NEW |