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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
204 network_configuration_updater_ = | 208 network_configuration_updater_ = |
205 DeviceNetworkConfigurationUpdater::CreateForDevicePolicy( | 209 DeviceNetworkConfigurationUpdater::CreateForDevicePolicy( |
206 GetPolicyService(), | 210 GetPolicyService(), |
207 chromeos::NetworkHandler::Get() | 211 chromeos::NetworkHandler::Get() |
208 ->managed_network_configuration_handler(), | 212 ->managed_network_configuration_handler(), |
209 chromeos::NetworkHandler::Get()->network_device_handler(), | 213 chromeos::NetworkHandler::Get()->network_device_handler(), |
210 chromeos::CrosSettings::Get()); | 214 chromeos::CrosSettings::Get()); |
211 } | 215 } |
212 | 216 |
213 void BrowserPolicyConnectorChromeOS::PreShutdown() { | 217 void BrowserPolicyConnectorChromeOS::PreShutdown() { |
| 218 affiliated_invalidation_service_provider_.reset(); |
214 // Let the |device_cloud_policy_invalidator_| unregister itself as an | 219 // Let the |device_cloud_policy_invalidator_| unregister itself as an |
215 // observer of per-Profile InvalidationServices and the device-global | 220 // observer of per-Profile InvalidationServices and the device-global |
216 // invalidation::TiclInvalidationService it may have created as an observer of | 221 // invalidation::TiclInvalidationService it may have created as an observer of |
217 // the DeviceOAuth2TokenService that is destroyed before Shutdown() is called. | 222 // the DeviceOAuth2TokenService that is destroyed before Shutdown() is called. |
218 device_cloud_policy_invalidator_.reset(); | 223 device_cloud_policy_invalidator_.reset(); |
219 } | 224 } |
220 | 225 |
221 void BrowserPolicyConnectorChromeOS::Shutdown() { | 226 void BrowserPolicyConnectorChromeOS::Shutdown() { |
222 // Verify that PreShutdown() has been called first. | 227 // Verify that PreShutdown() has been called first. |
| 228 DCHECK(!affiliated_invalidation_service_provider_); |
223 DCHECK(!device_cloud_policy_invalidator_); | 229 DCHECK(!device_cloud_policy_invalidator_); |
224 | 230 |
225 network_configuration_updater_.reset(); | 231 network_configuration_updater_.reset(); |
226 | 232 |
227 if (device_local_account_policy_service_) | 233 if (device_local_account_policy_service_) |
228 device_local_account_policy_service_->Shutdown(); | 234 device_local_account_policy_service_->Shutdown(); |
229 | 235 |
230 if (device_cloud_policy_initializer_) | 236 if (device_cloud_policy_initializer_) |
231 device_cloud_policy_initializer_->Shutdown(); | 237 device_cloud_policy_initializer_->Shutdown(); |
232 | 238 |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
337 std::string timezone; | 343 std::string timezone; |
338 if (chromeos::CrosSettings::Get()->GetString(chromeos::kSystemTimezonePolicy, | 344 if (chromeos::CrosSettings::Get()->GetString(chromeos::kSystemTimezonePolicy, |
339 &timezone) && | 345 &timezone) && |
340 !timezone.empty()) { | 346 !timezone.empty()) { |
341 chromeos::system::TimezoneSettings::GetInstance()->SetTimezoneFromID( | 347 chromeos::system::TimezoneSettings::GetInstance()->SetTimezoneFromID( |
342 base::UTF8ToUTF16(timezone)); | 348 base::UTF8ToUTF16(timezone)); |
343 } | 349 } |
344 } | 350 } |
345 | 351 |
346 } // namespace policy | 352 } // namespace policy |
OLD | NEW |