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

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

Issue 1557693002: Convert Pass()→std::move() in //chrome/browser/chromeos/policy (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 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>
8
7 #include "base/bind.h" 9 #include "base/bind.h"
8 #include "base/logging.h" 10 #include "base/logging.h"
9 #include "base/message_loop/message_loop.h" 11 #include "base/message_loop/message_loop.h"
10 #include "chrome/browser/browser_process.h" 12 #include "chrome/browser/browser_process.h"
11 #include "chrome/browser/chromeos/login/enrollment/auto_enrollment_controller.h" 13 #include "chrome/browser/chromeos/login/enrollment/auto_enrollment_controller.h"
12 #include "chrome/browser/chromeos/ownership/owner_settings_service_chromeos.h" 14 #include "chrome/browser/chromeos/ownership/owner_settings_service_chromeos.h"
13 #include "chrome/browser/chromeos/policy/device_cloud_policy_store_chromeos.h" 15 #include "chrome/browser/chromeos/policy/device_cloud_policy_store_chromeos.h"
14 #include "chrome/browser/chromeos/policy/enrollment_status_chromeos.h" 16 #include "chrome/browser/chromeos/policy/enrollment_status_chromeos.h"
15 #include "chrome/browser/chromeos/policy/proto/chrome_device_policy.pb.h" 17 #include "chrome/browser/chromeos/policy/proto/chrome_device_policy.pb.h"
16 #include "chrome/browser/chromeos/policy/server_backed_state_keys_broker.h" 18 #include "chrome/browser/chromeos/policy/server_backed_state_keys_broker.h"
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 const std::string& auth_token, 72 const std::string& auth_token,
71 const std::string& client_id, 73 const std::string& client_id,
72 const std::string& requisition, 74 const std::string& requisition,
73 const AllowedDeviceModes& allowed_device_modes, 75 const AllowedDeviceModes& allowed_device_modes,
74 ManagementMode management_mode, 76 ManagementMode management_mode,
75 const EnrollmentCallback& completion_callback) 77 const EnrollmentCallback& completion_callback)
76 : store_(store), 78 : store_(store),
77 install_attributes_(install_attributes), 79 install_attributes_(install_attributes),
78 state_keys_broker_(state_keys_broker), 80 state_keys_broker_(state_keys_broker),
79 owner_settings_service_(owner_settings_service), 81 owner_settings_service_(owner_settings_service),
80 client_(client.Pass()), 82 client_(std::move(client)),
81 background_task_runner_(background_task_runner), 83 background_task_runner_(background_task_runner),
82 enrollment_config_(enrollment_config), 84 enrollment_config_(enrollment_config),
83 auth_token_(auth_token), 85 auth_token_(auth_token),
84 client_id_(client_id), 86 client_id_(client_id),
85 requisition_(requisition), 87 requisition_(requisition),
86 allowed_device_modes_(allowed_device_modes), 88 allowed_device_modes_(allowed_device_modes),
87 management_mode_(management_mode), 89 management_mode_(management_mode),
88 completion_callback_(completion_callback), 90 completion_callback_(completion_callback),
89 device_mode_(DEVICE_MODE_NOT_SET), 91 device_mode_(DEVICE_MODE_NOT_SET),
90 skip_robot_auth_(false), 92 skip_robot_auth_(false),
(...skipping 18 matching lines...) Expand all
109 void EnrollmentHandlerChromeOS::StartEnrollment() { 111 void EnrollmentHandlerChromeOS::StartEnrollment() {
110 CHECK_EQ(STEP_PENDING, enrollment_step_); 112 CHECK_EQ(STEP_PENDING, enrollment_step_);
111 enrollment_step_ = STEP_STATE_KEYS; 113 enrollment_step_ = STEP_STATE_KEYS;
112 state_keys_broker_->RequestStateKeys( 114 state_keys_broker_->RequestStateKeys(
113 base::Bind(&EnrollmentHandlerChromeOS::HandleStateKeysResult, 115 base::Bind(&EnrollmentHandlerChromeOS::HandleStateKeysResult,
114 weak_ptr_factory_.GetWeakPtr())); 116 weak_ptr_factory_.GetWeakPtr()));
115 } 117 }
116 118
117 scoped_ptr<CloudPolicyClient> EnrollmentHandlerChromeOS::ReleaseClient() { 119 scoped_ptr<CloudPolicyClient> EnrollmentHandlerChromeOS::ReleaseClient() {
118 Stop(); 120 Stop();
119 return client_.Pass(); 121 return std::move(client_);
120 } 122 }
121 123
122 void EnrollmentHandlerChromeOS::OnPolicyFetched(CloudPolicyClient* client) { 124 void EnrollmentHandlerChromeOS::OnPolicyFetched(CloudPolicyClient* client) {
123 DCHECK_EQ(client_.get(), client); 125 DCHECK_EQ(client_.get(), client);
124 CHECK_EQ(STEP_POLICY_FETCH, enrollment_step_); 126 CHECK_EQ(STEP_POLICY_FETCH, enrollment_step_);
125 127
126 enrollment_step_ = STEP_VALIDATION; 128 enrollment_step_ = STEP_VALIDATION;
127 129
128 // Validate the policy. 130 // Validate the policy.
129 const em::PolicyFetchResponse* policy = client_->GetPolicyFor( 131 const em::PolicyFetchResponse* policy = client_->GetPolicyFor(
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
270 } else { 272 } else {
271 // Do nothing. StartRegistration() will be called again from OnStoreLoaded() 273 // Do nothing. StartRegistration() will be called again from OnStoreLoaded()
272 // after the CloudPolicyStore has initialized. 274 // after the CloudPolicyStore has initialized.
273 } 275 }
274 } 276 }
275 277
276 void EnrollmentHandlerChromeOS::HandlePolicyValidationResult( 278 void EnrollmentHandlerChromeOS::HandlePolicyValidationResult(
277 DeviceCloudPolicyValidator* validator) { 279 DeviceCloudPolicyValidator* validator) {
278 CHECK_EQ(STEP_VALIDATION, enrollment_step_); 280 CHECK_EQ(STEP_VALIDATION, enrollment_step_);
279 if (validator->success()) { 281 if (validator->success()) {
280 policy_ = validator->policy().Pass(); 282 policy_ = std::move(validator->policy());
281 username_ = validator->policy_data()->username(); 283 username_ = validator->policy_data()->username();
282 device_id_ = validator->policy_data()->device_id(); 284 device_id_ = validator->policy_data()->device_id();
283 request_token_ = validator->policy_data()->request_token(); 285 request_token_ = validator->policy_data()->request_token();
284 enrollment_step_ = STEP_ROBOT_AUTH_FETCH; 286 enrollment_step_ = STEP_ROBOT_AUTH_FETCH;
285 client_->FetchRobotAuthCodes(auth_token_); 287 client_->FetchRobotAuthCodes(auth_token_);
286 } else { 288 } else {
287 ReportResult(EnrollmentStatus::ForValidationError(validator->status())); 289 ReportResult(EnrollmentStatus::ForValidationError(validator->status()));
288 } 290 }
289 } 291 }
290 292
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after
488 << ", validation: " << status.validation_status() 490 << ", validation: " << status.validation_status()
489 << ", store: " << status.store_status() 491 << ", store: " << status.store_status()
490 << ", lock: " << status.lock_status(); 492 << ", lock: " << status.lock_status();
491 } 493 }
492 494
493 if (!callback.is_null()) 495 if (!callback.is_null())
494 callback.Run(status); 496 callback.Run(status);
495 } 497 }
496 498
497 } // namespace policy 499 } // namespace policy
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698