OLD | NEW |
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_get_keys_operati
on.h" | 5 #include "chrome/browser/chromeos/login/easy_unlock/easy_unlock_get_keys_operati
on.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
11 #include "chrome/browser/chromeos/login/easy_unlock/easy_unlock_key_manager.h" | 11 #include "chrome/browser/chromeos/login/easy_unlock/easy_unlock_key_manager.h" |
12 #include "components/signin/core/account_id/account_id.h" | |
13 #include "google_apis/gaia/gaia_auth_util.h" | 12 #include "google_apis/gaia/gaia_auth_util.h" |
14 | 13 |
15 namespace chromeos { | 14 namespace chromeos { |
16 | 15 |
17 EasyUnlockGetKeysOperation::EasyUnlockGetKeysOperation( | 16 EasyUnlockGetKeysOperation::EasyUnlockGetKeysOperation( |
18 const UserContext& user_context, | 17 const UserContext& user_context, |
19 const GetKeysCallback& callback) | 18 const GetKeysCallback& callback) |
20 : user_context_(user_context), | 19 : user_context_(user_context), |
21 callback_(callback), | 20 callback_(callback), |
22 key_index_(0), | 21 key_index_(0), |
23 weak_ptr_factory_(this) { | 22 weak_ptr_factory_(this) { |
24 } | 23 } |
25 | 24 |
26 EasyUnlockGetKeysOperation::~EasyUnlockGetKeysOperation() { | 25 EasyUnlockGetKeysOperation::~EasyUnlockGetKeysOperation() { |
27 } | 26 } |
28 | 27 |
29 void EasyUnlockGetKeysOperation::Start() { | 28 void EasyUnlockGetKeysOperation::Start() { |
30 // TODO(xiyuan): Use ListKeyEx. | 29 // TODO(xiyuan): Use ListKeyEx. |
31 key_index_ = 0; | 30 key_index_ = 0; |
32 GetKeyData(); | 31 GetKeyData(); |
33 } | 32 } |
34 | 33 |
35 void EasyUnlockGetKeysOperation::GetKeyData() { | 34 void EasyUnlockGetKeysOperation::GetKeyData() { |
36 const std::string canonicalized = | 35 std::string canonicalized = |
37 gaia::CanonicalizeEmail(user_context_.GetAccountId().GetUserEmail()); | 36 gaia::CanonicalizeEmail(user_context_.GetUserID()); |
38 cryptohome::Identification id(canonicalized); | 37 cryptohome::Identification id(canonicalized); |
39 cryptohome::HomedirMethods::GetInstance()->GetKeyDataEx( | 38 cryptohome::HomedirMethods::GetInstance()->GetKeyDataEx( |
40 id, | 39 id, |
41 EasyUnlockKeyManager::GetKeyLabel(key_index_), | 40 EasyUnlockKeyManager::GetKeyLabel(key_index_), |
42 base::Bind(&EasyUnlockGetKeysOperation::OnGetKeyData, | 41 base::Bind(&EasyUnlockGetKeysOperation::OnGetKeyData, |
43 weak_ptr_factory_.GetWeakPtr())); | 42 weak_ptr_factory_.GetWeakPtr())); |
44 | 43 |
45 } | 44 } |
46 | 45 |
47 void EasyUnlockGetKeysOperation::OnGetKeyData( | 46 void EasyUnlockGetKeysOperation::OnGetKeyData( |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 << entry.name; | 99 << entry.name; |
101 } | 100 } |
102 } | 101 } |
103 devices_.push_back(device); | 102 devices_.push_back(device); |
104 | 103 |
105 ++key_index_; | 104 ++key_index_; |
106 GetKeyData(); | 105 GetKeyData(); |
107 } | 106 } |
108 | 107 |
109 } // namespace chromeos | 108 } // namespace chromeos |
OLD | NEW |