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/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/logging.h" | 9 #include "base/logging.h" |
10 #include "base/prefs/pref_service.h" | 10 #include "base/prefs/pref_service.h" |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
90 | 90 |
91 device_store_->RemoveObserver(this); | 91 device_store_->RemoveObserver(this); |
92 enrollment_handler_.reset(); | 92 enrollment_handler_.reset(); |
93 state_keys_update_subscription_.reset(); | 93 state_keys_update_subscription_.reset(); |
94 is_initialized_ = false; | 94 is_initialized_ = false; |
95 } | 95 } |
96 | 96 |
97 void DeviceCloudPolicyInitializer::StartEnrollment( | 97 void DeviceCloudPolicyInitializer::StartEnrollment( |
98 ManagementMode management_mode, | 98 ManagementMode management_mode, |
99 DeviceManagementService* device_management_service, | 99 DeviceManagementService* device_management_service, |
100 chromeos::OwnerSettingsServiceChromeOS* owner_settings_service, | |
100 const std::string& auth_token, | 101 const std::string& auth_token, |
101 bool is_auto_enrollment, | 102 bool is_auto_enrollment, |
102 const AllowedDeviceModes& allowed_device_modes, | 103 const AllowedDeviceModes& allowed_device_modes, |
103 const EnrollmentCallback& enrollment_callback) { | 104 const EnrollmentCallback& enrollment_callback) { |
104 DCHECK(is_initialized_); | 105 DCHECK(is_initialized_); |
105 DCHECK(!enrollment_handler_); | 106 DCHECK(!enrollment_handler_); |
106 | 107 |
107 manager_->core()->Disconnect(); | 108 manager_->core()->Disconnect(); |
108 enrollment_handler_.reset(new EnrollmentHandlerChromeOS( | 109 enrollment_handler_.reset(new EnrollmentHandlerChromeOS( |
109 device_store_, | 110 device_store_, install_attributes_, state_keys_broker_, |
davidyu
2014/12/03 16:06:04
Put each parameter at its own line.
| |
110 install_attributes_, | 111 device_settings_service_, owner_settings_service, |
111 state_keys_broker_, | 112 CreateClient(device_management_service), background_task_runner_, |
112 device_settings_service_, | 113 auth_token, install_attributes_->GetDeviceId(), is_auto_enrollment, |
113 CreateClient(device_management_service), | 114 manager_->GetDeviceRequisition(), allowed_device_modes, management_mode, |
114 background_task_runner_, | |
115 auth_token, | |
116 install_attributes_->GetDeviceId(), | |
117 is_auto_enrollment, | |
118 manager_->GetDeviceRequisition(), | |
119 allowed_device_modes, | |
120 management_mode, | |
121 base::Bind(&DeviceCloudPolicyInitializer::EnrollmentCompleted, | 115 base::Bind(&DeviceCloudPolicyInitializer::EnrollmentCompleted, |
122 base::Unretained(this), | 116 base::Unretained(this), enrollment_callback))); |
123 enrollment_callback))); | |
124 enrollment_handler_->StartEnrollment(); | 117 enrollment_handler_->StartEnrollment(); |
125 } | 118 } |
126 | 119 |
127 bool DeviceCloudPolicyInitializer::ShouldAutoStartEnrollment() const { | 120 bool DeviceCloudPolicyInitializer::ShouldAutoStartEnrollment() const { |
128 const RestoreMode restore_mode = GetRestoreMode(); | 121 const RestoreMode restore_mode = GetRestoreMode(); |
129 if (restore_mode == RESTORE_MODE_REENROLLMENT_REQUESTED || | 122 if (restore_mode == RESTORE_MODE_REENROLLMENT_REQUESTED || |
130 restore_mode == RESTORE_MODE_REENROLLMENT_ENFORCED) { | 123 restore_mode == RESTORE_MODE_REENROLLMENT_ENFORCED) { |
131 return true; | 124 return true; |
132 } | 125 } |
133 | 126 |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
240 if (!manager_->core()->service()) | 233 if (!manager_->core()->service()) |
241 manager_->StartConnection(client.Pass(), install_attributes_); | 234 manager_->StartConnection(client.Pass(), install_attributes_); |
242 | 235 |
243 if (!on_connected_callback_.is_null()) { | 236 if (!on_connected_callback_.is_null()) { |
244 on_connected_callback_.Run(); | 237 on_connected_callback_.Run(); |
245 on_connected_callback_.Reset(); | 238 on_connected_callback_.Reset(); |
246 } | 239 } |
247 } | 240 } |
248 | 241 |
249 } // namespace policy | 242 } // namespace policy |
OLD | NEW |