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 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
144 global_user_cloud_policy_provider_)); | 145 global_user_cloud_policy_provider_)); |
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 ChromeBrowserPolicyConnector::Init(local_state, request_context); | 153 ChromeBrowserPolicyConnector::Init(local_state, request_context); |
153 | 154 |
| 155 affiliated_invalidation_service_provider_.reset( |
| 156 new AffiliatedInvalidationServiceProvider); |
| 157 |
154 const base::CommandLine* command_line = | 158 const base::CommandLine* command_line = |
155 base::CommandLine::ForCurrentProcess(); | 159 base::CommandLine::ForCurrentProcess(); |
156 if (command_line->HasSwitch(chromeos::switches::kEnableConsumerManagement)) { | 160 if (command_line->HasSwitch(chromeos::switches::kEnableConsumerManagement)) { |
157 scoped_ptr<DeviceManagementService::Configuration> configuration( | 161 scoped_ptr<DeviceManagementService::Configuration> configuration( |
158 new DeviceManagementServiceConfiguration( | 162 new DeviceManagementServiceConfiguration( |
159 GetDeviceManagementServerUrlForConsumer())); | 163 GetDeviceManagementServerUrlForConsumer())); |
160 consumer_device_management_service_.reset( | 164 consumer_device_management_service_.reset( |
161 new DeviceManagementService(configuration.Pass())); | 165 new DeviceManagementService(configuration.Pass())); |
162 consumer_device_management_service_->ScheduleInitialization( | 166 consumer_device_management_service_->ScheduleInitialization( |
163 kServiceInitializationStartupDelay); | 167 kServiceInitializationStartupDelay); |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
205 network_configuration_updater_ = | 209 network_configuration_updater_ = |
206 DeviceNetworkConfigurationUpdater::CreateForDevicePolicy( | 210 DeviceNetworkConfigurationUpdater::CreateForDevicePolicy( |
207 GetPolicyService(), | 211 GetPolicyService(), |
208 chromeos::NetworkHandler::Get() | 212 chromeos::NetworkHandler::Get() |
209 ->managed_network_configuration_handler(), | 213 ->managed_network_configuration_handler(), |
210 chromeos::NetworkHandler::Get()->network_device_handler(), | 214 chromeos::NetworkHandler::Get()->network_device_handler(), |
211 chromeos::CrosSettings::Get()); | 215 chromeos::CrosSettings::Get()); |
212 } | 216 } |
213 | 217 |
214 void BrowserPolicyConnectorChromeOS::PreShutdown() { | 218 void BrowserPolicyConnectorChromeOS::PreShutdown() { |
| 219 affiliated_invalidation_service_provider_.reset(); |
215 // Let the |device_cloud_policy_invalidator_| unregister itself as an | 220 // Let the |device_cloud_policy_invalidator_| unregister itself as an |
216 // observer of per-Profile InvalidationServices and the device-global | 221 // observer of per-Profile InvalidationServices and the device-global |
217 // invalidation::TiclInvalidationService it may have created as an observer of | 222 // invalidation::TiclInvalidationService it may have created as an observer of |
218 // the DeviceOAuth2TokenService that is destroyed before Shutdown() is called. | 223 // the DeviceOAuth2TokenService that is destroyed before Shutdown() is called. |
219 device_cloud_policy_invalidator_.reset(); | 224 device_cloud_policy_invalidator_.reset(); |
220 } | 225 } |
221 | 226 |
222 void BrowserPolicyConnectorChromeOS::Shutdown() { | 227 void BrowserPolicyConnectorChromeOS::Shutdown() { |
223 // Verify that PreShutdown() has been called first. | 228 // Verify that PreShutdown() has been called first. |
| 229 DCHECK(!affiliated_invalidation_service_provider_); |
224 DCHECK(!device_cloud_policy_invalidator_); | 230 DCHECK(!device_cloud_policy_invalidator_); |
225 | 231 |
226 network_configuration_updater_.reset(); | 232 network_configuration_updater_.reset(); |
227 | 233 |
228 if (device_local_account_policy_service_) | 234 if (device_local_account_policy_service_) |
229 device_local_account_policy_service_->Shutdown(); | 235 device_local_account_policy_service_->Shutdown(); |
230 | 236 |
231 if (device_cloud_policy_initializer_) | 237 if (device_cloud_policy_initializer_) |
232 device_cloud_policy_initializer_->Shutdown(); | 238 device_cloud_policy_initializer_->Shutdown(); |
233 | 239 |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
338 std::string timezone; | 344 std::string timezone; |
339 if (chromeos::CrosSettings::Get()->GetString(chromeos::kSystemTimezonePolicy, | 345 if (chromeos::CrosSettings::Get()->GetString(chromeos::kSystemTimezonePolicy, |
340 &timezone) && | 346 &timezone) && |
341 !timezone.empty()) { | 347 !timezone.empty()) { |
342 chromeos::system::TimezoneSettings::GetInstance()->SetTimezoneFromID( | 348 chromeos::system::TimezoneSettings::GetInstance()->SetTimezoneFromID( |
343 base::UTF8ToUTF16(timezone)); | 349 base::UTF8ToUTF16(timezone)); |
344 } | 350 } |
345 } | 351 } |
346 | 352 |
347 } // namespace policy | 353 } // namespace policy |
OLD | NEW |