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

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

Issue 2977033002: Mixed Licenses Enrollment (Closed)
Patch Set: Created 3 years, 5 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/device_cloud_policy_initializer.h" 5 #include "chrome/browser/chromeos/policy/device_cloud_policy_initializer.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/bind_helpers.h" 10 #include "base/bind_helpers.h"
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 89
90 void DeviceCloudPolicyInitializer::Shutdown() { 90 void DeviceCloudPolicyInitializer::Shutdown() {
91 DCHECK(is_initialized_); 91 DCHECK(is_initialized_);
92 92
93 device_store_->RemoveObserver(this); 93 device_store_->RemoveObserver(this);
94 enrollment_handler_.reset(); 94 enrollment_handler_.reset();
95 state_keys_update_subscription_.reset(); 95 state_keys_update_subscription_.reset();
96 is_initialized_ = false; 96 is_initialized_ = false;
97 } 97 }
98 98
99 void DeviceCloudPolicyInitializer::StartEnrollment( 99 void DeviceCloudPolicyInitializer::PrepareEnrollment(
100 DeviceManagementService* device_management_service, 100 DeviceManagementService* device_management_service,
101 chromeos::ActiveDirectoryJoinDelegate* ad_join_delegate, 101 chromeos::ActiveDirectoryJoinDelegate* ad_join_delegate,
102 const EnrollmentConfig& enrollment_config, 102 const EnrollmentConfig& enrollment_config,
103 const std::string& auth_token, 103 const std::string& auth_token,
104 const EnrollmentCallback& enrollment_callback) { 104 const EnrollmentCallback& enrollment_callback) {
105 DCHECK(is_initialized_); 105 DCHECK(is_initialized_);
106 DCHECK(!enrollment_handler_); 106 DCHECK(!enrollment_handler_);
107 107
108 manager_->core()->Disconnect(); 108 manager_->core()->Disconnect();
109 109
110 enrollment_handler_.reset(new EnrollmentHandlerChromeOS( 110 enrollment_handler_.reset(new EnrollmentHandlerChromeOS(
111 device_store_, install_attributes_, state_keys_broker_, 111 device_store_, install_attributes_, state_keys_broker_,
112 attestation_flow_.get(), CreateClient(device_management_service), 112 attestation_flow_.get(), CreateClient(device_management_service),
113 background_task_runner_, ad_join_delegate, enrollment_config, auth_token, 113 background_task_runner_, ad_join_delegate, enrollment_config, auth_token,
114 install_attributes_->GetDeviceId(), manager_->GetDeviceRequisition(), 114 install_attributes_->GetDeviceId(), manager_->GetDeviceRequisition(),
115 base::Bind(&DeviceCloudPolicyInitializer::EnrollmentCompleted, 115 base::Bind(&DeviceCloudPolicyInitializer::EnrollmentCompleted,
116 base::Unretained(this), enrollment_callback))); 116 base::Unretained(this), enrollment_callback)));
117 }
118
119 void DeviceCloudPolicyInitializer::StartEnrollment() {
120 DCHECK(is_initialized_);
121 DCHECK(enrollment_handler_);
117 enrollment_handler_->StartEnrollment(); 122 enrollment_handler_->StartEnrollment();
118 } 123 }
119 124
125 void DeviceCloudPolicyInitializer::CheckAvailableLicenses(
emaxx 2017/07/21 12:57:29 This method effectively does nothing now - so is i
Denis Kuznetsov (DE-MUC) 2017/07/25 21:51:06 Done.
126 const LicenseSelectionCallback& callback) {
127 DCHECK(is_initialized_);
128 DCHECK(enrollment_handler_);
129 }
130
131 void DeviceCloudPolicyInitializer::StartEnrollmentWithLicense(
132 policy::LicenseType license_type) {
133 DCHECK(is_initialized_);
134 DCHECK(enrollment_handler_);
135 DCHECK(license_type != policy::LicenseType::UNKNOWN);
136 enrollment_handler_->StartEnrollment();
emaxx 2017/07/21 12:57:30 The license type, received as a parameter, is just
Denis Kuznetsov (DE-MUC) 2017/07/25 21:51:06 Done.
137 }
138
120 EnrollmentConfig DeviceCloudPolicyInitializer::GetPrescribedEnrollmentConfig() 139 EnrollmentConfig DeviceCloudPolicyInitializer::GetPrescribedEnrollmentConfig()
121 const { 140 const {
122 EnrollmentConfig config; 141 EnrollmentConfig config;
123 142
124 // Authentication through the attestation mechanism is controlled by a 143 // Authentication through the attestation mechanism is controlled by a
125 // command line switch that either enables it or forces it (meaning that 144 // command line switch that either enables it or forces it (meaning that
126 // interactive authentication is disabled). 145 // interactive authentication is disabled).
127 switch (DeviceCloudPolicyManagerChromeOS::GetZeroTouchEnrollmentMode()) { 146 switch (DeviceCloudPolicyManagerChromeOS::GetZeroTouchEnrollmentMode()) {
128 case ZeroTouchEnrollmentMode::DISABLED: 147 case ZeroTouchEnrollmentMode::DISABLED:
129 // Only use interactive authentication. 148 // Only use interactive authentication.
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after
332 if (success && (success = att_signed_data.ParseFromString(signed_data))) { 351 if (success && (success = att_signed_data.ParseFromString(signed_data))) {
333 em_signed_data.set_data(att_signed_data.data()); 352 em_signed_data.set_data(att_signed_data.data());
334 em_signed_data.set_signature(att_signed_data.signature()); 353 em_signed_data.set_signature(att_signed_data.signature());
335 em_signed_data.set_extra_data_bytes(att_signed_data.data().size() - 354 em_signed_data.set_extra_data_bytes(att_signed_data.data().size() -
336 data.size()); 355 data.size());
337 } 356 }
338 callback.Run(success, em_signed_data); 357 callback.Run(success, em_signed_data);
339 } 358 }
340 359
341 } // namespace policy 360 } // namespace policy
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698