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

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, 1 month 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" 21 #include "chrome/browser/chromeos/policy/consumer_enrollment_handler.h"
22 #include "chrome/browser/chromeos/policy/consumer_management_service.h" 22 #include "chrome/browser/chromeos/policy/consumer_management_service.h"
23 #include "chrome/browser/chromeos/policy/device_cloud_policy_initializer.h" 23 #include "chrome/browser/chromeos/policy/device_cloud_policy_initializer.h"
24 #include "chrome/browser/chromeos/policy/device_cloud_policy_invalidator.h" 24 #include "chrome/browser/chromeos/policy/device_cloud_policy_invalidator.h"
25 #include "chrome/browser/chromeos/policy/device_cloud_policy_manager_chromeos.h" 25 #include "chrome/browser/chromeos/policy/device_cloud_policy_manager_chromeos.h"
26 #include "chrome/browser/chromeos/policy/device_cloud_policy_store_chromeos.h" 26 #include "chrome/browser/chromeos/policy/device_cloud_policy_store_chromeos.h"
27 #include "chrome/browser/chromeos/policy/device_local_account.h" 27 #include "chrome/browser/chromeos/policy/device_local_account.h"
28 #include "chrome/browser/chromeos/policy/device_local_account_policy_service.h" 28 #include "chrome/browser/chromeos/policy/device_local_account_policy_service.h"
29 #include "chrome/browser/chromeos/policy/device_network_configuration_updater.h" 29 #include "chrome/browser/chromeos/policy/device_network_configuration_updater.h"
30 #include "chrome/browser/chromeos/policy/enterprise_install_attributes.h" 30 #include "chrome/browser/chromeos/policy/enterprise_install_attributes.h"
31 #include "chrome/browser/chromeos/policy/server_backed_state_keys_broker.h" 31 #include "chrome/browser/chromeos/policy/server_backed_state_keys_broker.h"
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
194 chromeos::CrosSettings::Get(), 194 chromeos::CrosSettings::Get(),
195 GetBackgroundTaskRunner(), 195 GetBackgroundTaskRunner(),
196 GetBackgroundTaskRunner(), 196 GetBackgroundTaskRunner(),
197 GetBackgroundTaskRunner(), 197 GetBackgroundTaskRunner(),
198 content::BrowserThread::GetMessageLoopProxyForThread( 198 content::BrowserThread::GetMessageLoopProxyForThread(
199 content::BrowserThread::IO), 199 content::BrowserThread::IO),
200 request_context)); 200 request_context));
201 device_local_account_policy_service_->Connect(device_management_service()); 201 device_local_account_policy_service_->Connect(device_management_service());
202 device_cloud_policy_invalidator_.reset(new DeviceCloudPolicyInvalidator); 202 device_cloud_policy_invalidator_.reset(new DeviceCloudPolicyInvalidator);
203 203
204 // request_context is NULL in unit tests.
205 if (request_context.get() && install_attributes_) {
206 app_pack_updater_.reset(
207 new AppPackUpdater(request_context.get(), install_attributes_.get()));
208 }
209
210 SetTimezoneIfPolicyAvailable(); 204 SetTimezoneIfPolicyAvailable();
211 205
212 network_configuration_updater_ = 206 network_configuration_updater_ =
213 DeviceNetworkConfigurationUpdater::CreateForDevicePolicy( 207 DeviceNetworkConfigurationUpdater::CreateForDevicePolicy(
214 GetPolicyService(), 208 GetPolicyService(),
215 chromeos::NetworkHandler::Get() 209 chromeos::NetworkHandler::Get()
216 ->managed_network_configuration_handler(), 210 ->managed_network_configuration_handler(),
217 chromeos::NetworkHandler::Get()->network_device_handler(), 211 chromeos::NetworkHandler::Get()->network_device_handler(),
218 chromeos::CrosSettings::Get()); 212 chromeos::CrosSettings::Get());
219 } 213 }
220 214
221 void BrowserPolicyConnectorChromeOS::PreShutdown() { 215 void BrowserPolicyConnectorChromeOS::PreShutdown() {
222 // Let the |device_cloud_policy_invalidator_| unregister itself as an 216 // Let the |device_cloud_policy_invalidator_| unregister itself as an
223 // observer of per-Profile InvalidationServices and the device-global 217 // observer of per-Profile InvalidationServices and the device-global
224 // invalidation::TiclInvalidationService it may have created as an observer of 218 // invalidation::TiclInvalidationService it may have created as an observer of
225 // the DeviceOAuth2TokenService that is destroyed before Shutdown() is called. 219 // the DeviceOAuth2TokenService that is destroyed before Shutdown() is called.
226 device_cloud_policy_invalidator_.reset(); 220 device_cloud_policy_invalidator_.reset();
227 } 221 }
228 222
229 void BrowserPolicyConnectorChromeOS::Shutdown() { 223 void BrowserPolicyConnectorChromeOS::Shutdown() {
230 // Verify that PreShutdown() has been called first. 224 // Verify that PreShutdown() has been called first.
231 DCHECK(!device_cloud_policy_invalidator_); 225 DCHECK(!device_cloud_policy_invalidator_);
232 226
233 // The AppPackUpdater may be observing the |device_cloud_policy_manager_|.
234 // Delete it first.
235 app_pack_updater_.reset();
236
237 network_configuration_updater_.reset(); 227 network_configuration_updater_.reset();
238 228
239 if (device_local_account_policy_service_) 229 if (device_local_account_policy_service_)
240 device_local_account_policy_service_->Shutdown(); 230 device_local_account_policy_service_->Shutdown();
241 231
242 if (device_cloud_policy_initializer_) 232 if (device_cloud_policy_initializer_)
243 device_cloud_policy_initializer_->Shutdown(); 233 device_cloud_policy_initializer_->Shutdown();
244 234
245 ChromeBrowserPolicyConnector::Shutdown(); 235 ChromeBrowserPolicyConnector::Shutdown();
246 } 236 }
(...skipping 23 matching lines...) Expand all
270 if (install_attributes_ && 260 if (install_attributes_ &&
271 (gaia::ExtractDomainName(gaia::CanonicalizeEmail(user_name)) == 261 (gaia::ExtractDomainName(gaia::CanonicalizeEmail(user_name)) ==
272 install_attributes_->GetDomain() || 262 install_attributes_->GetDomain() ||
273 policy::IsDeviceLocalAccountUser(user_name, NULL))) { 263 policy::IsDeviceLocalAccountUser(user_name, NULL))) {
274 return USER_AFFILIATION_MANAGED; 264 return USER_AFFILIATION_MANAGED;
275 } 265 }
276 266
277 return USER_AFFILIATION_NONE; 267 return USER_AFFILIATION_NONE;
278 } 268 }
279 269
280 AppPackUpdater* BrowserPolicyConnectorChromeOS::GetAppPackUpdater() {
281 return app_pack_updater_.get();
282 }
283
284 void BrowserPolicyConnectorChromeOS::SetUserPolicyDelegate( 270 void BrowserPolicyConnectorChromeOS::SetUserPolicyDelegate(
285 ConfigurationPolicyProvider* user_policy_provider) { 271 ConfigurationPolicyProvider* user_policy_provider) {
286 global_user_cloud_policy_provider_->SetDelegate(user_policy_provider); 272 global_user_cloud_policy_provider_->SetDelegate(user_policy_provider);
287 } 273 }
288 274
289 void BrowserPolicyConnectorChromeOS::SetConsumerManagementServiceForTesting( 275 void BrowserPolicyConnectorChromeOS::SetConsumerManagementServiceForTesting(
290 scoped_ptr<ConsumerManagementService> service) { 276 scoped_ptr<ConsumerManagementService> service) {
291 consumer_management_service_ = service.Pass(); 277 consumer_management_service_ = service.Pass();
292 } 278 }
293 279
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
342 // This function is invoked by DCPInitializer, so we should release the 328 // This function is invoked by DCPInitializer, so we should release the
343 // initializer after this function returns. 329 // initializer after this function returns.
344 if (device_cloud_policy_initializer_) { 330 if (device_cloud_policy_initializer_) {
345 device_cloud_policy_initializer_->Shutdown(); 331 device_cloud_policy_initializer_->Shutdown();
346 base::MessageLoop::current()->DeleteSoon( 332 base::MessageLoop::current()->DeleteSoon(
347 FROM_HERE, device_cloud_policy_initializer_.release()); 333 FROM_HERE, device_cloud_policy_initializer_.release());
348 } 334 }
349 } 335 }
350 336
351 } // namespace policy 337 } // namespace policy
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698