Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(174)

Side by Side Diff: chrome/browser/chromeos/policy/browser_policy_connector_chromeos.cc

Issue 608283003: Remove retail mode. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/bind_helpers.h" 9 #include "base/bind_helpers.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
11 #include "base/files/file_path.h" 11 #include "base/files/file_path.h"
12 #include "base/location.h" 12 #include "base/location.h"
13 #include "base/logging.h" 13 #include "base/logging.h"
14 #include "base/message_loop/message_loop.h" 14 #include "base/message_loop/message_loop.h"
15 #include "base/message_loop/message_loop_proxy.h" 15 #include "base/message_loop/message_loop_proxy.h"
16 #include "base/path_service.h" 16 #include "base/path_service.h"
17 #include "base/prefs/pref_registry_simple.h" 17 #include "base/prefs/pref_registry_simple.h"
18 #include "base/sequenced_task_runner.h" 18 #include "base/sequenced_task_runner.h"
19 #include "base/strings/utf_string_conversions.h" 19 #include "base/strings/utf_string_conversions.h"
20 #include "base/threading/sequenced_worker_pool.h" 20 #include "base/threading/sequenced_worker_pool.h"
21 #include "chrome/browser/chromeos/policy/app_pack_updater.h"
22 #include "chrome/browser/chromeos/policy/consumer_management_service.h" 21 #include "chrome/browser/chromeos/policy/consumer_management_service.h"
23 #include "chrome/browser/chromeos/policy/device_cloud_policy_initializer.h" 22 #include "chrome/browser/chromeos/policy/device_cloud_policy_initializer.h"
24 #include "chrome/browser/chromeos/policy/device_cloud_policy_invalidator.h" 23 #include "chrome/browser/chromeos/policy/device_cloud_policy_invalidator.h"
25 #include "chrome/browser/chromeos/policy/device_cloud_policy_manager_chromeos.h" 24 #include "chrome/browser/chromeos/policy/device_cloud_policy_manager_chromeos.h"
26 #include "chrome/browser/chromeos/policy/device_cloud_policy_store_chromeos.h" 25 #include "chrome/browser/chromeos/policy/device_cloud_policy_store_chromeos.h"
27 #include "chrome/browser/chromeos/policy/device_local_account.h" 26 #include "chrome/browser/chromeos/policy/device_local_account.h"
28 #include "chrome/browser/chromeos/policy/device_local_account_policy_service.h" 27 #include "chrome/browser/chromeos/policy/device_local_account_policy_service.h"
29 #include "chrome/browser/chromeos/policy/device_network_configuration_updater.h" 28 #include "chrome/browser/chromeos/policy/device_network_configuration_updater.h"
30 #include "chrome/browser/chromeos/policy/enterprise_install_attributes.h" 29 #include "chrome/browser/chromeos/policy/enterprise_install_attributes.h"
31 #include "chrome/browser/chromeos/policy/server_backed_state_keys_broker.h" 30 #include "chrome/browser/chromeos/policy/server_backed_state_keys_broker.h"
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
191 chromeos::CrosSettings::Get(), 190 chromeos::CrosSettings::Get(),
192 GetBackgroundTaskRunner(), 191 GetBackgroundTaskRunner(),
193 GetBackgroundTaskRunner(), 192 GetBackgroundTaskRunner(),
194 GetBackgroundTaskRunner(), 193 GetBackgroundTaskRunner(),
195 content::BrowserThread::GetMessageLoopProxyForThread( 194 content::BrowserThread::GetMessageLoopProxyForThread(
196 content::BrowserThread::IO), 195 content::BrowserThread::IO),
197 request_context)); 196 request_context));
198 device_local_account_policy_service_->Connect(device_management_service()); 197 device_local_account_policy_service_->Connect(device_management_service());
199 device_cloud_policy_invalidator_.reset(new DeviceCloudPolicyInvalidator); 198 device_cloud_policy_invalidator_.reset(new DeviceCloudPolicyInvalidator);
200 199
201 // request_context is NULL in unit tests.
202 if (request_context.get() && install_attributes_) {
203 app_pack_updater_.reset(
204 new AppPackUpdater(request_context.get(), install_attributes_.get()));
205 }
206
207 SetTimezoneIfPolicyAvailable(); 200 SetTimezoneIfPolicyAvailable();
208 201
209 network_configuration_updater_ = 202 network_configuration_updater_ =
210 DeviceNetworkConfigurationUpdater::CreateForDevicePolicy( 203 DeviceNetworkConfigurationUpdater::CreateForDevicePolicy(
211 GetPolicyService(), 204 GetPolicyService(),
212 chromeos::NetworkHandler::Get() 205 chromeos::NetworkHandler::Get()
213 ->managed_network_configuration_handler(), 206 ->managed_network_configuration_handler(),
214 chromeos::NetworkHandler::Get()->network_device_handler(), 207 chromeos::NetworkHandler::Get()->network_device_handler(),
215 chromeos::CrosSettings::Get()); 208 chromeos::CrosSettings::Get());
216 } 209 }
217 210
218 void BrowserPolicyConnectorChromeOS::PreShutdown() { 211 void BrowserPolicyConnectorChromeOS::PreShutdown() {
219 // Let the |device_cloud_policy_invalidator_| unregister itself as an 212 // Let the |device_cloud_policy_invalidator_| unregister itself as an
220 // observer of per-Profile InvalidationServices and the device-global 213 // observer of per-Profile InvalidationServices and the device-global
221 // invalidation::TiclInvalidationService it may have created as an observer of 214 // invalidation::TiclInvalidationService it may have created as an observer of
222 // the DeviceOAuth2TokenService that is destroyed before Shutdown() is called. 215 // the DeviceOAuth2TokenService that is destroyed before Shutdown() is called.
223 device_cloud_policy_invalidator_.reset(); 216 device_cloud_policy_invalidator_.reset();
224 217
225 // The |consumer_management_service_| may be observing a 218 // The |consumer_management_service_| may be observing a
226 // ProfileOAuth2TokenService and needs to be destroyed before the token 219 // ProfileOAuth2TokenService and needs to be destroyed before the token
227 // service. 220 // service.
228 consumer_management_service_.reset(); 221 consumer_management_service_.reset();
229 } 222 }
230 223
231 void BrowserPolicyConnectorChromeOS::Shutdown() { 224 void BrowserPolicyConnectorChromeOS::Shutdown() {
232 // Verify that PreShutdown() has been called first. 225 // Verify that PreShutdown() has been called first.
233 DCHECK(!device_cloud_policy_invalidator_); 226 DCHECK(!device_cloud_policy_invalidator_);
234 DCHECK(!consumer_management_service_); 227 DCHECK(!consumer_management_service_);
235 228
236 // The AppPackUpdater may be observing the |device_cloud_policy_manager_|.
237 // Delete it first.
238 app_pack_updater_.reset();
239
240 network_configuration_updater_.reset(); 229 network_configuration_updater_.reset();
241 230
242 if (device_local_account_policy_service_) 231 if (device_local_account_policy_service_)
243 device_local_account_policy_service_->Shutdown(); 232 device_local_account_policy_service_->Shutdown();
244 233
245 if (device_cloud_policy_initializer_) 234 if (device_cloud_policy_initializer_)
246 device_cloud_policy_initializer_->Shutdown(); 235 device_cloud_policy_initializer_->Shutdown();
247 236
248 ChromeBrowserPolicyConnector::Shutdown(); 237 ChromeBrowserPolicyConnector::Shutdown();
249 } 238 }
(...skipping 23 matching lines...) Expand all
273 if (install_attributes_ && 262 if (install_attributes_ &&
274 (gaia::ExtractDomainName(gaia::CanonicalizeEmail(user_name)) == 263 (gaia::ExtractDomainName(gaia::CanonicalizeEmail(user_name)) ==
275 install_attributes_->GetDomain() || 264 install_attributes_->GetDomain() ||
276 policy::IsDeviceLocalAccountUser(user_name, NULL))) { 265 policy::IsDeviceLocalAccountUser(user_name, NULL))) {
277 return USER_AFFILIATION_MANAGED; 266 return USER_AFFILIATION_MANAGED;
278 } 267 }
279 268
280 return USER_AFFILIATION_NONE; 269 return USER_AFFILIATION_NONE;
281 } 270 }
282 271
283 AppPackUpdater* BrowserPolicyConnectorChromeOS::GetAppPackUpdater() {
284 return app_pack_updater_.get();
285 }
286
287 void BrowserPolicyConnectorChromeOS::SetUserPolicyDelegate( 272 void BrowserPolicyConnectorChromeOS::SetUserPolicyDelegate(
288 ConfigurationPolicyProvider* user_policy_provider) { 273 ConfigurationPolicyProvider* user_policy_provider) {
289 global_user_cloud_policy_provider_->SetDelegate(user_policy_provider); 274 global_user_cloud_policy_provider_->SetDelegate(user_policy_provider);
290 } 275 }
291 276
292 void BrowserPolicyConnectorChromeOS::SetDeviceCloudPolicyInitializerForTesting( 277 void BrowserPolicyConnectorChromeOS::SetDeviceCloudPolicyInitializerForTesting(
293 scoped_ptr<DeviceCloudPolicyInitializer> initializer) { 278 scoped_ptr<DeviceCloudPolicyInitializer> initializer) {
294 device_cloud_policy_initializer_ = initializer.Pass(); 279 device_cloud_policy_initializer_ = initializer.Pass();
295 } 280 }
296 281
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
338 // This function is invoked by DCPInitializer, so we should release the 323 // This function is invoked by DCPInitializer, so we should release the
339 // initializer after this function returns. 324 // initializer after this function returns.
340 if (device_cloud_policy_initializer_) { 325 if (device_cloud_policy_initializer_) {
341 device_cloud_policy_initializer_->Shutdown(); 326 device_cloud_policy_initializer_->Shutdown();
342 base::MessageLoop::current()->DeleteSoon( 327 base::MessageLoop::current()->DeleteSoon(
343 FROM_HERE, device_cloud_policy_initializer_.release()); 328 FROM_HERE, device_cloud_policy_initializer_.release());
344 } 329 }
345 } 330 }
346 331
347 } // namespace policy 332 } // namespace policy
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698