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

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

Issue 1693383003: ChromeOS cryptohome should be able to use gaia id as user identifier. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed unit tests. Created 4 years, 9 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_remove_keys_oper ation.h" 5 #include "chrome/browser/chromeos/login/easy_unlock/easy_unlock_remove_keys_oper ation.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "chrome/browser/chromeos/login/easy_unlock/easy_unlock_key_manager.h" 8 #include "chrome/browser/chromeos/login/easy_unlock/easy_unlock_key_manager.h"
9 #include "chromeos/cryptohome/homedir_methods.h" 9 #include "chromeos/cryptohome/homedir_methods.h"
10 #include "chromeos/cryptohome/system_salt_getter.h" 10 #include "chromeos/cryptohome/system_salt_getter.h"
(...skipping 29 matching lines...) Expand all
40 } 40 }
41 41
42 void EasyUnlockRemoveKeysOperation::OnGetSystemSalt( 42 void EasyUnlockRemoveKeysOperation::OnGetSystemSalt(
43 const std::string& system_salt) { 43 const std::string& system_salt) {
44 user_context_.GetKey()->Transform(Key::KEY_TYPE_SALTED_SHA256_TOP_HALF, 44 user_context_.GetKey()->Transform(Key::KEY_TYPE_SALTED_SHA256_TOP_HALF,
45 system_salt); 45 system_salt);
46 RemoveKey(); 46 RemoveKey();
47 } 47 }
48 48
49 void EasyUnlockRemoveKeysOperation::RemoveKey() { 49 void EasyUnlockRemoveKeysOperation::RemoveKey() {
50 const std::string canonicalized = 50 cryptohome::Identification id(user_context_.GetAccountId());
51 gaia::CanonicalizeEmail(user_context_.GetAccountId().GetUserEmail());
52 cryptohome::Identification id(canonicalized);
53 const Key* const auth_key = user_context_.GetKey(); 51 const Key* const auth_key = user_context_.GetKey();
54 cryptohome::Authorization auth(auth_key->GetSecret(), auth_key->GetLabel()); 52 cryptohome::Authorization auth(auth_key->GetSecret(), auth_key->GetLabel());
55 53
56 // TODO(xiyuan): Use ListKeyEx and delete by label instead of by index. 54 // TODO(xiyuan): Use ListKeyEx and delete by label instead of by index.
57 cryptohome::HomedirMethods::GetInstance()->RemoveKeyEx( 55 cryptohome::HomedirMethods::GetInstance()->RemoveKeyEx(
58 id, 56 id,
59 auth, 57 auth,
60 EasyUnlockKeyManager::GetKeyLabel(key_index_), 58 EasyUnlockKeyManager::GetKeyLabel(key_index_),
61 base::Bind(&EasyUnlockRemoveKeysOperation::OnKeyRemoved, 59 base::Bind(&EasyUnlockRemoveKeysOperation::OnKeyRemoved,
62 weak_ptr_factory_.GetWeakPtr())); 60 weak_ptr_factory_.GetWeakPtr()));
(...skipping 13 matching lines...) Expand all
76 if (return_code == cryptohome::MOUNT_ERROR_KEY_FAILURE) { 74 if (return_code == cryptohome::MOUNT_ERROR_KEY_FAILURE) {
77 callback_.Run(true); 75 callback_.Run(true);
78 } else { 76 } else {
79 LOG(ERROR) << "Easy unlock remove keys operation failed, code=" 77 LOG(ERROR) << "Easy unlock remove keys operation failed, code="
80 << return_code; 78 << return_code;
81 callback_.Run(false); 79 callback_.Run(false);
82 } 80 }
83 } 81 }
84 82
85 } // namespace chromeos 83 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698