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

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

Issue 769703003: SetManagementSettings() is moved to OwnerSettingsServiceChromeOS. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Failing test fixed. Created 6 years 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/device_cloud_policy_initializer.h" 5 #include "chrome/browser/chromeos/policy/device_cloud_policy_initializer.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/callback.h" 9 #include "base/callback.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 89
90 device_store_->RemoveObserver(this); 90 device_store_->RemoveObserver(this);
91 enrollment_handler_.reset(); 91 enrollment_handler_.reset();
92 state_keys_update_subscription_.reset(); 92 state_keys_update_subscription_.reset();
93 is_initialized_ = false; 93 is_initialized_ = false;
94 } 94 }
95 95
96 void DeviceCloudPolicyInitializer::StartEnrollment( 96 void DeviceCloudPolicyInitializer::StartEnrollment(
97 ManagementMode management_mode, 97 ManagementMode management_mode,
98 DeviceManagementService* device_management_service, 98 DeviceManagementService* device_management_service,
99 chromeos::OwnerSettingsServiceChromeOS* owner_settings_service,
99 const std::string& auth_token, 100 const std::string& auth_token,
100 const AllowedDeviceModes& allowed_device_modes, 101 const AllowedDeviceModes& allowed_device_modes,
101 const EnrollmentCallback& enrollment_callback) { 102 const EnrollmentCallback& enrollment_callback) {
102 DCHECK(is_initialized_); 103 DCHECK(is_initialized_);
103 DCHECK(!enrollment_handler_); 104 DCHECK(!enrollment_handler_);
104 105
105 manager_->core()->Disconnect(); 106 manager_->core()->Disconnect();
106 enrollment_handler_.reset(new EnrollmentHandlerChromeOS( 107 enrollment_handler_.reset(new EnrollmentHandlerChromeOS(
107 device_store_, 108 device_store_, install_attributes_, state_keys_broker_,
108 install_attributes_, 109 device_settings_service_, owner_settings_service,
109 state_keys_broker_, 110 CreateClient(device_management_service), background_task_runner_,
110 device_settings_service_, 111 auth_token, install_attributes_->GetDeviceId(),
111 CreateClient(device_management_service), 112 manager_->GetDeviceRequisition(), allowed_device_modes, management_mode,
112 background_task_runner_,
113 auth_token,
114 install_attributes_->GetDeviceId(),
115 manager_->GetDeviceRequisition(),
116 allowed_device_modes,
117 management_mode,
118 base::Bind(&DeviceCloudPolicyInitializer::EnrollmentCompleted, 113 base::Bind(&DeviceCloudPolicyInitializer::EnrollmentCompleted,
119 base::Unretained(this), 114 base::Unretained(this), enrollment_callback)));
120 enrollment_callback)));
121 enrollment_handler_->StartEnrollment(); 115 enrollment_handler_->StartEnrollment();
122 } 116 }
123 117
124 bool DeviceCloudPolicyInitializer::ShouldAutoStartEnrollment() const { 118 bool DeviceCloudPolicyInitializer::ShouldAutoStartEnrollment() const {
125 const RestoreMode restore_mode = GetRestoreMode(); 119 const RestoreMode restore_mode = GetRestoreMode();
126 if (restore_mode == RESTORE_MODE_REENROLLMENT_REQUESTED || 120 if (restore_mode == RESTORE_MODE_REENROLLMENT_REQUESTED ||
127 restore_mode == RESTORE_MODE_REENROLLMENT_ENFORCED) { 121 restore_mode == RESTORE_MODE_REENROLLMENT_ENFORCED) {
128 return true; 122 return true;
129 } 123 }
130 124
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
232 StartConnection(CreateClient(service)); 226 StartConnection(CreateClient(service));
233 } 227 }
234 228
235 void DeviceCloudPolicyInitializer::StartConnection( 229 void DeviceCloudPolicyInitializer::StartConnection(
236 scoped_ptr<CloudPolicyClient> client) { 230 scoped_ptr<CloudPolicyClient> client) {
237 if (!manager_->core()->service()) 231 if (!manager_->core()->service())
238 manager_->StartConnection(client.Pass(), install_attributes_); 232 manager_->StartConnection(client.Pass(), install_attributes_);
239 } 233 }
240 234
241 } // namespace policy 235 } // namespace policy
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698