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

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

Issue 2977033002: Mixed Licenses Enrollment (Closed)
Patch Set: Fix last nit Created 3 years, 4 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(
126 const AvailableLicensesCallback& callback) {
127 DCHECK(is_initialized_);
128 DCHECK(enrollment_handler_);
129 enrollment_handler_->CheckAvailableLicenses(callback);
130 }
131
132 void DeviceCloudPolicyInitializer::StartEnrollmentWithLicense(
133 policy::LicenseType license_type) {
134 DCHECK(is_initialized_);
135 DCHECK(enrollment_handler_);
136 DCHECK(license_type != policy::LicenseType::UNKNOWN);
137 enrollment_handler_->StartEnrollmentWithLicense(license_type);
138 }
139
120 EnrollmentConfig DeviceCloudPolicyInitializer::GetPrescribedEnrollmentConfig() 140 EnrollmentConfig DeviceCloudPolicyInitializer::GetPrescribedEnrollmentConfig()
121 const { 141 const {
122 EnrollmentConfig config; 142 EnrollmentConfig config;
123 143
124 // Authentication through the attestation mechanism is controlled by a 144 // Authentication through the attestation mechanism is controlled by a
125 // command line switch that either enables it or forces it (meaning that 145 // command line switch that either enables it or forces it (meaning that
126 // interactive authentication is disabled). 146 // interactive authentication is disabled).
127 switch (DeviceCloudPolicyManagerChromeOS::GetZeroTouchEnrollmentMode()) { 147 switch (DeviceCloudPolicyManagerChromeOS::GetZeroTouchEnrollmentMode()) {
128 case ZeroTouchEnrollmentMode::DISABLED: 148 case ZeroTouchEnrollmentMode::DISABLED:
129 // Only use interactive authentication. 149 // 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))) { 352 if (success && (success = att_signed_data.ParseFromString(signed_data))) {
333 em_signed_data.set_data(att_signed_data.data()); 353 em_signed_data.set_data(att_signed_data.data());
334 em_signed_data.set_signature(att_signed_data.signature()); 354 em_signed_data.set_signature(att_signed_data.signature());
335 em_signed_data.set_extra_data_bytes(att_signed_data.data().size() - 355 em_signed_data.set_extra_data_bytes(att_signed_data.data().size() -
336 data.size()); 356 data.size());
337 } 357 }
338 callback.Run(success, em_signed_data); 358 callback.Run(success, em_signed_data);
339 } 359 }
340 360
341 } // namespace policy 361 } // namespace policy
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698