| 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" |
| (...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 184 chromeos::DBusThreadManager::Get()->GetSessionManagerClient(), | 184 chromeos::DBusThreadManager::Get()->GetSessionManagerClient(), |
| 185 chromeos::DeviceSettingsService::Get(), | 185 chromeos::DeviceSettingsService::Get(), |
| 186 chromeos::CrosSettings::Get(), | 186 chromeos::CrosSettings::Get(), |
| 187 GetBackgroundTaskRunner(), | 187 GetBackgroundTaskRunner(), |
| 188 GetBackgroundTaskRunner(), | 188 GetBackgroundTaskRunner(), |
| 189 GetBackgroundTaskRunner(), | 189 GetBackgroundTaskRunner(), |
| 190 content::BrowserThread::GetMessageLoopProxyForThread( | 190 content::BrowserThread::GetMessageLoopProxyForThread( |
| 191 content::BrowserThread::IO), | 191 content::BrowserThread::IO), |
| 192 request_context)); | 192 request_context)); |
| 193 device_local_account_policy_service_->Connect(device_management_service()); | 193 device_local_account_policy_service_->Connect(device_management_service()); |
| 194 device_cloud_policy_invalidator_.reset(new DeviceCloudPolicyInvalidator); | 194 device_cloud_policy_invalidator_.reset(new DeviceCloudPolicyInvalidator( |
| 195 affiliated_invalidation_service_provider_.get())); |
| 195 | 196 |
| 196 SetTimezoneIfPolicyAvailable(); | 197 SetTimezoneIfPolicyAvailable(); |
| 197 | 198 |
| 198 network_configuration_updater_ = | 199 network_configuration_updater_ = |
| 199 DeviceNetworkConfigurationUpdater::CreateForDevicePolicy( | 200 DeviceNetworkConfigurationUpdater::CreateForDevicePolicy( |
| 200 GetPolicyService(), | 201 GetPolicyService(), |
| 201 chromeos::NetworkHandler::Get() | 202 chromeos::NetworkHandler::Get() |
| 202 ->managed_network_configuration_handler(), | 203 ->managed_network_configuration_handler(), |
| 203 chromeos::NetworkHandler::Get()->network_device_handler(), | 204 chromeos::NetworkHandler::Get()->network_device_handler(), |
| 204 chromeos::CrosSettings::Get()); | 205 chromeos::CrosSettings::Get()); |
| 205 } | 206 } |
| 206 | 207 |
| 207 void BrowserPolicyConnectorChromeOS::PreShutdown() { | 208 void BrowserPolicyConnectorChromeOS::PreShutdown() { |
| 208 // Let the |affiliated_invalidation_service_provider_| unregister itself as an | 209 // Let the |affiliated_invalidation_service_provider_| unregister itself as an |
| 209 // observer of per-Profile InvalidationServices and the device-global | 210 // observer of per-Profile InvalidationServices and the device-global |
| 210 // invalidation::TiclInvalidationService it may have created as an observer of | 211 // invalidation::TiclInvalidationService it may have created as an observer of |
| 211 // the DeviceOAuth2TokenService that is destroyed before Shutdown() is called. | 212 // the DeviceOAuth2TokenService that is destroyed before Shutdown() is called. |
| 212 if (affiliated_invalidation_service_provider_) | 213 if (affiliated_invalidation_service_provider_) |
| 213 affiliated_invalidation_service_provider_->Shutdown(); | 214 affiliated_invalidation_service_provider_->Shutdown(); |
| 214 | |
| 215 // Let the |device_cloud_policy_invalidator_| unregister itself as an | |
| 216 // observer of per-Profile InvalidationServices and the device-global | |
| 217 // invalidation::TiclInvalidationService it may have created as an observer of | |
| 218 // the DeviceOAuth2TokenService that is destroyed before Shutdown() is called. | |
| 219 device_cloud_policy_invalidator_.reset(); | |
| 220 } | 215 } |
| 221 | 216 |
| 222 void BrowserPolicyConnectorChromeOS::Shutdown() { | 217 void BrowserPolicyConnectorChromeOS::Shutdown() { |
| 223 // Verify that PreShutdown() has been called first. | |
| 224 DCHECK(!device_cloud_policy_invalidator_); | |
| 225 | |
| 226 network_configuration_updater_.reset(); | 218 network_configuration_updater_.reset(); |
| 227 | 219 |
| 228 if (device_local_account_policy_service_) | 220 if (device_local_account_policy_service_) |
| 229 device_local_account_policy_service_->Shutdown(); | 221 device_local_account_policy_service_->Shutdown(); |
| 230 | 222 |
| 231 if (device_cloud_policy_initializer_) | 223 if (device_cloud_policy_initializer_) |
| 232 device_cloud_policy_initializer_->Shutdown(); | 224 device_cloud_policy_initializer_->Shutdown(); |
| 233 | 225 |
| 234 if (device_cloud_policy_manager_) | 226 if (device_cloud_policy_manager_) |
| 235 device_cloud_policy_manager_->RemoveDeviceCloudPolicyManagerObserver(this); | 227 device_cloud_policy_manager_->RemoveDeviceCloudPolicyManagerObserver(this); |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 358 consumer_device_management_service_.get(), | 350 consumer_device_management_service_.get(), |
| 359 GetBackgroundTaskRunner(), | 351 GetBackgroundTaskRunner(), |
| 360 install_attributes_.get(), | 352 install_attributes_.get(), |
| 361 state_keys_broker_.get(), | 353 state_keys_broker_.get(), |
| 362 device_cloud_policy_manager_->device_store(), | 354 device_cloud_policy_manager_->device_store(), |
| 363 device_cloud_policy_manager_)); | 355 device_cloud_policy_manager_)); |
| 364 device_cloud_policy_initializer_->Init(); | 356 device_cloud_policy_initializer_->Init(); |
| 365 } | 357 } |
| 366 | 358 |
| 367 } // namespace policy | 359 } // namespace policy |
| OLD | NEW |