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