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

Side by Side Diff: chrome/browser/chromeos/login/supervised/supervised_user_login_flow.cc

Issue 1870793002: Convert //chrome/browser/chromeos from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 8 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/login/supervised/supervised_user_login_flow.h" 5 #include "chrome/browser/chromeos/login/supervised/supervised_user_login_flow.h"
6 6
7 #include "base/base64.h" 7 #include "base/base64.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/metrics/histogram.h" 10 #include "base/metrics/histogram.h"
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 LOG(ERROR) << "Incomplete data for password change"; 130 LOG(ERROR) << "Incomplete data for password change";
131 131
132 UMA_HISTOGRAM_ENUMERATION( 132 UMA_HISTOGRAM_ENUMERATION(
133 "ManagedUsers.ChromeOS.PasswordChange", 133 "ManagedUsers.ChromeOS.PasswordChange",
134 SupervisedUserAuthentication::PASSWORD_CHANGE_FAILED_INCOMPLETE_DATA, 134 SupervisedUserAuthentication::PASSWORD_CHANGE_FAILED_INCOMPLETE_DATA,
135 SupervisedUserAuthentication::PASSWORD_CHANGE_RESULT_MAX_VALUE); 135 SupervisedUserAuthentication::PASSWORD_CHANGE_RESULT_MAX_VALUE);
136 Finish(); 136 Finish();
137 return; 137 return;
138 } 138 }
139 base::Base64Decode(base64_signature, &signature); 139 base::Base64Decode(base64_signature, &signature);
140 scoped_ptr<base::DictionaryValue> data_copy(password_data->DeepCopy()); 140 std::unique_ptr<base::DictionaryValue> data_copy(password_data->DeepCopy());
141 cryptohome::KeyDefinition key(password, 141 cryptohome::KeyDefinition key(password,
142 kCryptohomeSupervisedUserKeyLabel, 142 kCryptohomeSupervisedUserKeyLabel,
143 kCryptohomeSupervisedUserKeyPrivileges); 143 kCryptohomeSupervisedUserKeyPrivileges);
144 144
145 authenticator_ = ExtendedAuthenticator::Create(this); 145 authenticator_ = ExtendedAuthenticator::Create(this);
146 SupervisedUserAuthentication::Schema current_schema = 146 SupervisedUserAuthentication::Schema current_schema =
147 auth->GetPasswordSchema(account_id().GetUserEmail()); 147 auth->GetPasswordSchema(account_id().GetUserEmail());
148 148
149 key.revision = revision; 149 key.revision = revision;
150 150
(...skipping 26 matching lines...) Expand all
177 signature, 177 signature,
178 base::Bind(&SupervisedUserLoginFlow::OnPasswordUpdated, 178 base::Bind(&SupervisedUserLoginFlow::OnPasswordUpdated,
179 weak_factory_.GetWeakPtr(), 179 weak_factory_.GetWeakPtr(),
180 Passed(&data_copy))); 180 Passed(&data_copy)));
181 } else { 181 } else {
182 NOTREACHED() << "Unsupported password schema"; 182 NOTREACHED() << "Unsupported password schema";
183 } 183 }
184 } 184 }
185 185
186 void SupervisedUserLoginFlow::OnNewKeyAdded( 186 void SupervisedUserLoginFlow::OnNewKeyAdded(
187 scoped_ptr<base::DictionaryValue> password_data) { 187 std::unique_ptr<base::DictionaryValue> password_data) {
188 VLOG(1) << "New key added"; 188 VLOG(1) << "New key added";
189 SupervisedUserAuthentication* auth = 189 SupervisedUserAuthentication* auth =
190 ChromeUserManager::Get()->GetSupervisedUserManager()->GetAuthentication(); 190 ChromeUserManager::Get()->GetSupervisedUserManager()->GetAuthentication();
191 auth->StorePasswordData(account_id().GetUserEmail(), *password_data.get()); 191 auth->StorePasswordData(account_id().GetUserEmail(), *password_data.get());
192 auth->MarkKeyIncomplete(account_id().GetUserEmail(), true /* incomplete */); 192 auth->MarkKeyIncomplete(account_id().GetUserEmail(), true /* incomplete */);
193 authenticator_->RemoveKey( 193 authenticator_->RemoveKey(
194 context_, 194 context_,
195 kLegacyCryptohomeSupervisedUserKeyLabel, 195 kLegacyCryptohomeSupervisedUserKeyLabel,
196 base::Bind(&SupervisedUserLoginFlow::OnOldKeyRemoved, 196 base::Bind(&SupervisedUserLoginFlow::OnOldKeyRemoved,
197 weak_factory_.GetWeakPtr())); 197 weak_factory_.GetWeakPtr()));
(...skipping 23 matching lines...) Expand all
221 221
222 UMA_HISTOGRAM_ENUMERATION( 222 UMA_HISTOGRAM_ENUMERATION(
223 "ManagedUsers.ChromeOS.PasswordChange", 223 "ManagedUsers.ChromeOS.PasswordChange",
224 SupervisedUserAuthentication:: 224 SupervisedUserAuthentication::
225 PASSWORD_CHANGE_FAILED_AUTHENTICATION_FAILURE, 225 PASSWORD_CHANGE_FAILED_AUTHENTICATION_FAILURE,
226 SupervisedUserAuthentication::PASSWORD_CHANGE_RESULT_MAX_VALUE); 226 SupervisedUserAuthentication::PASSWORD_CHANGE_RESULT_MAX_VALUE);
227 Finish(); 227 Finish();
228 } 228 }
229 229
230 void SupervisedUserLoginFlow::OnPasswordUpdated( 230 void SupervisedUserLoginFlow::OnPasswordUpdated(
231 scoped_ptr<base::DictionaryValue> password_data) { 231 std::unique_ptr<base::DictionaryValue> password_data) {
232 VLOG(1) << "Updated password for supervised user"; 232 VLOG(1) << "Updated password for supervised user";
233 233
234 SupervisedUserAuthentication* auth = 234 SupervisedUserAuthentication* auth =
235 ChromeUserManager::Get()->GetSupervisedUserManager()->GetAuthentication(); 235 ChromeUserManager::Get()->GetSupervisedUserManager()->GetAuthentication();
236 236
237 // Incomplete state is not there in password_data, carry it from old state. 237 // Incomplete state is not there in password_data, carry it from old state.
238 const bool was_incomplete = 238 const bool was_incomplete =
239 auth->HasIncompleteKey(account_id().GetUserEmail()); 239 auth->HasIncompleteKey(account_id().GetUserEmail());
240 auth->StorePasswordData(account_id().GetUserEmail(), *password_data.get()); 240 auth->StorePasswordData(account_id().GetUserEmail(), *password_data.get());
241 if (was_incomplete) 241 if (was_incomplete)
(...skipping 15 matching lines...) Expand all
257 void SupervisedUserLoginFlow::LaunchExtraSteps( 257 void SupervisedUserLoginFlow::LaunchExtraSteps(
258 Profile* profile) { 258 Profile* profile) {
259 profile_ = profile; 259 profile_ = profile;
260 ChromeUserManager::Get()->GetSupervisedUserManager()->LoadSupervisedUserToken( 260 ChromeUserManager::Get()->GetSupervisedUserManager()->LoadSupervisedUserToken(
261 profile, 261 profile,
262 base::Bind(&SupervisedUserLoginFlow::OnSyncSetupDataLoaded, 262 base::Bind(&SupervisedUserLoginFlow::OnSyncSetupDataLoaded,
263 weak_factory_.GetWeakPtr())); 263 weak_factory_.GetWeakPtr()));
264 } 264 }
265 265
266 } // namespace chromeos 266 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698