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

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

Issue 2329303002: Delete obsolete AllowedDeviceModes enrollment parameter. (Closed)
Patch Set: Created 4 years, 3 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/enrollment_handler_chromeos.h" 5 #include "chrome/browser/chromeos/policy/enrollment_handler_chromeos.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/location.h" 10 #include "base/location.h"
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 DeviceCloudPolicyStoreChromeOS* store, 72 DeviceCloudPolicyStoreChromeOS* store,
73 EnterpriseInstallAttributes* install_attributes, 73 EnterpriseInstallAttributes* install_attributes,
74 ServerBackedStateKeysBroker* state_keys_broker, 74 ServerBackedStateKeysBroker* state_keys_broker,
75 chromeos::attestation::AttestationFlow* attestation_flow, 75 chromeos::attestation::AttestationFlow* attestation_flow,
76 std::unique_ptr<CloudPolicyClient> client, 76 std::unique_ptr<CloudPolicyClient> client,
77 scoped_refptr<base::SequencedTaskRunner> background_task_runner, 77 scoped_refptr<base::SequencedTaskRunner> background_task_runner,
78 const EnrollmentConfig& enrollment_config, 78 const EnrollmentConfig& enrollment_config,
79 const std::string& auth_token, 79 const std::string& auth_token,
80 const std::string& client_id, 80 const std::string& client_id,
81 const std::string& requisition, 81 const std::string& requisition,
82 const AllowedDeviceModes& allowed_device_modes,
83 const EnrollmentCallback& completion_callback) 82 const EnrollmentCallback& completion_callback)
84 : store_(store), 83 : store_(store),
85 install_attributes_(install_attributes), 84 install_attributes_(install_attributes),
86 state_keys_broker_(state_keys_broker), 85 state_keys_broker_(state_keys_broker),
87 attestation_flow_(attestation_flow), 86 attestation_flow_(attestation_flow),
88 client_(std::move(client)), 87 client_(std::move(client)),
89 background_task_runner_(background_task_runner), 88 background_task_runner_(background_task_runner),
90 enrollment_config_(enrollment_config), 89 enrollment_config_(enrollment_config),
91 auth_token_(auth_token), 90 auth_token_(auth_token),
92 client_id_(client_id), 91 client_id_(client_id),
93 requisition_(requisition), 92 requisition_(requisition),
94 allowed_device_modes_(allowed_device_modes),
95 completion_callback_(completion_callback), 93 completion_callback_(completion_callback),
96 device_mode_(DEVICE_MODE_NOT_SET), 94 device_mode_(DEVICE_MODE_NOT_SET),
97 skip_robot_auth_(false), 95 skip_robot_auth_(false),
98 enrollment_step_(STEP_PENDING), 96 enrollment_step_(STEP_PENDING),
99 lockbox_init_duration_(0), 97 lockbox_init_duration_(0),
100 weak_ptr_factory_(this) { 98 weak_ptr_factory_(this) {
101 CHECK(!client_->is_registered()); 99 CHECK(!client_->is_registered());
102 CHECK_EQ(DM_STATUS_SUCCESS, client_->status()); 100 CHECK_EQ(DM_STATUS_SUCCESS, client_->status());
103 CHECK((enrollment_config_.mode == EnrollmentConfig::MODE_ATTESTATION || 101 CHECK((enrollment_config_.mode == EnrollmentConfig::MODE_ATTESTATION ||
104 enrollment_config_.mode == 102 enrollment_config_.mode ==
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
177 weak_ptr_factory_.GetWeakPtr())); 175 weak_ptr_factory_.GetWeakPtr()));
178 } 176 }
179 177
180 void EnrollmentHandlerChromeOS::OnRegistrationStateChanged( 178 void EnrollmentHandlerChromeOS::OnRegistrationStateChanged(
181 CloudPolicyClient* client) { 179 CloudPolicyClient* client) {
182 DCHECK_EQ(client_.get(), client); 180 DCHECK_EQ(client_.get(), client);
183 181
184 if (enrollment_step_ == STEP_REGISTRATION && client_->is_registered()) { 182 if (enrollment_step_ == STEP_REGISTRATION && client_->is_registered()) {
185 enrollment_step_ = STEP_POLICY_FETCH, 183 enrollment_step_ = STEP_POLICY_FETCH,
186 device_mode_ = client_->device_mode(); 184 device_mode_ = client_->device_mode();
187 if (device_mode_ == DEVICE_MODE_NOT_SET) 185 if (device_mode_ != policy::DEVICE_MODE_ENTERPRISE) {
Thiemo Nagel 2016/09/11 19:22:41 Mattias, do you remember why the client tolerates
Mattias Nissler (ping if slow) 2016/09/12 07:01:21 Not exactly, but I suspect we wrote the client-sid
188 device_mode_ = DEVICE_MODE_ENTERPRISE;
189 if (!allowed_device_modes_.test(device_mode_)) {
190 LOG(ERROR) << "Bad device mode " << device_mode_; 186 LOG(ERROR) << "Bad device mode " << device_mode_;
191 ReportResult(EnrollmentStatus::ForStatus( 187 ReportResult(EnrollmentStatus::ForStatus(
192 EnrollmentStatus::STATUS_REGISTRATION_BAD_MODE)); 188 EnrollmentStatus::STATUS_REGISTRATION_BAD_MODE));
193 return; 189 return;
194 } 190 }
195 client_->FetchPolicy(); 191 client_->FetchPolicy();
196 } else { 192 } else {
197 LOG(FATAL) << "Registration state changed to " << client_->is_registered() 193 LOG(FATAL) << "Registration state changed to " << client_->is_registered()
198 << " in step " << enrollment_step_ << "."; 194 << " in step " << enrollment_step_ << ".";
199 } 195 }
(...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after
494 << ", validation: " << status.validation_status() 490 << ", validation: " << status.validation_status()
495 << ", store: " << status.store_status() 491 << ", store: " << status.store_status()
496 << ", lock: " << status.lock_status(); 492 << ", lock: " << status.lock_status();
497 } 493 }
498 494
499 if (!callback.is_null()) 495 if (!callback.is_null())
500 callback.Run(status); 496 callback.Run(status);
501 } 497 }
502 498
503 } // namespace policy 499 } // namespace policy
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698