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

Side by Side Diff: chrome/browser/chromeos/login/easy_unlock/easy_unlock_create_keys_operation.cc

Issue 558273002: [NOT FOR REVIEW] easy-signin: Simple click to sign-in. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@easy-signin-data
Patch Set: rebase Created 6 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 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/easy_unlock/easy_unlock_create_keys_oper ation.h" 5 #include "chrome/browser/chromeos/login/easy_unlock/easy_unlock_create_keys_oper ation.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/base64.h" 9 #include "base/base64.h"
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after
337 cryptohome::Identification id(canonicalized); 337 cryptohome::Identification id(canonicalized);
338 const Key* const auth_key = user_context_.GetKey(); 338 const Key* const auth_key = user_context_.GetKey();
339 cryptohome::Authorization auth(auth_key->GetSecret(), auth_key->GetLabel()); 339 cryptohome::Authorization auth(auth_key->GetSecret(), auth_key->GetLabel());
340 cryptohome::HomedirMethods::GetInstance()->AddKeyEx( 340 cryptohome::HomedirMethods::GetInstance()->AddKeyEx(
341 id, 341 id,
342 auth, 342 auth,
343 key_def, 343 key_def,
344 true, // clobber 344 true, // clobber
345 base::Bind(&EasyUnlockCreateKeysOperation::OnKeyCreated, 345 base::Bind(&EasyUnlockCreateKeysOperation::OnKeyCreated,
346 weak_ptr_factory_.GetWeakPtr(), 346 weak_ptr_factory_.GetWeakPtr(),
347 index)); 347 index,
348 user_key));
348 } 349 }
349 350
350 void EasyUnlockCreateKeysOperation::OnKeyCreated( 351 void EasyUnlockCreateKeysOperation::OnKeyCreated(
351 size_t index, 352 size_t index,
353 const Key& user_key,
352 bool success, 354 bool success,
353 cryptohome::MountError return_code) { 355 cryptohome::MountError return_code) {
354 DCHECK_EQ(key_creation_index_, index); 356 DCHECK_EQ(key_creation_index_, index);
355 357
356 if (!success) { 358 if (!success) {
357 LOG(ERROR) << "Easy unlock failed to create key, code=" << return_code; 359 LOG(ERROR) << "Easy unlock failed to create key, code=" << return_code;
358 callback_.Run(false); 360 callback_.Run(false);
359 return; 361 return;
360 } 362 }
361 363
364 // Update user context when the key used for signing in is changed.
365 if (user_context_.GetAuthFlow() == UserContext::AUTH_FLOW_EASY_UNLOCK &&
366 user_context_.GetKey()->GetLabel() ==
367 EasyUnlockKeyManager::GetKeyLabel(key_creation_index_)) {
368 user_context_.SetKey(user_key);
369 }
370
362 ++key_creation_index_; 371 ++key_creation_index_;
363 CreateKeyForDeviceAtIndex(key_creation_index_); 372 CreateKeyForDeviceAtIndex(key_creation_index_);
364 } 373 }
365 374
366 } // namespace chromeos 375 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698