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 #ifndef CHROME_BROWSER_CHROMEOS_LOGIN_EASY_UNLOCK_EASY_UNLOCK_KEY_MANAGER_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_LOGIN_EASY_UNLOCK_EASY_UNLOCK_KEY_MANAGER_H_ |
6 #define CHROME_BROWSER_CHROMEOS_LOGIN_EASY_UNLOCK_EASY_UNLOCK_KEY_MANAGER_H_ | 6 #define CHROME_BROWSER_CHROMEOS_LOGIN_EASY_UNLOCK_EASY_UNLOCK_KEY_MANAGER_H_ |
7 | 7 |
8 #include <deque> | 8 #include <deque> |
9 #include <map> | 9 #include <map> |
10 #include <string> | 10 #include <string> |
11 | 11 |
12 #include "base/callback.h" | 12 #include "base/callback.h" |
13 #include "base/macros.h" | 13 #include "base/macros.h" |
14 #include "base/memory/weak_ptr.h" | 14 #include "base/memory/weak_ptr.h" |
15 #include "base/stl_util.h" | 15 #include "base/stl_util.h" |
16 #include "chrome/browser/chromeos/login/easy_unlock/easy_unlock_get_keys_operati
on.h" | 16 #include "chrome/browser/chromeos/login/easy_unlock/easy_unlock_get_keys_operati
on.h" |
17 #include "chrome/browser/chromeos/login/easy_unlock/easy_unlock_refresh_keys_ope
ration.h" | 17 #include "chrome/browser/chromeos/login/easy_unlock/easy_unlock_refresh_keys_ope
ration.h" |
18 #include "chrome/browser/chromeos/login/easy_unlock/easy_unlock_types.h" | 18 #include "chrome/browser/chromeos/login/easy_unlock/easy_unlock_types.h" |
19 | 19 |
| 20 class AccountId; |
| 21 |
20 namespace base { | 22 namespace base { |
21 class DictionaryValue; | 23 class DictionaryValue; |
22 class ListValue; | 24 class ListValue; |
23 } | 25 } |
24 | 26 |
25 namespace chromeos { | 27 namespace chromeos { |
26 | 28 |
27 class UserContext; | 29 class UserContext; |
28 | 30 |
29 // A class to manage Easy unlock cryptohome keys. | 31 // A class to manage Easy unlock cryptohome keys. |
(...skipping 17 matching lines...) Expand all Loading... |
47 // |user_context|. | 49 // |user_context|. |
48 void GetDeviceDataList(const UserContext& user_context, | 50 void GetDeviceDataList(const UserContext& user_context, |
49 const GetDeviceDataListCallback& callback); | 51 const GetDeviceDataListCallback& callback); |
50 | 52 |
51 // Helpers to convert between DeviceData and remote device dictionary. | 53 // Helpers to convert between DeviceData and remote device dictionary. |
52 // DeviceDataToRemoteDeviceDictionary fills the remote device dictionary and | 54 // DeviceDataToRemoteDeviceDictionary fills the remote device dictionary and |
53 // always succeeds. RemoteDeviceDictionaryToDeviceData returns false if the | 55 // always succeeds. RemoteDeviceDictionaryToDeviceData returns false if the |
54 // conversion fails (missing required propery). Note that | 56 // conversion fails (missing required propery). Note that |
55 // EasyUnlockDeviceKeyData contains a sub set of the remote device dictionary. | 57 // EasyUnlockDeviceKeyData contains a sub set of the remote device dictionary. |
56 static void DeviceDataToRemoteDeviceDictionary( | 58 static void DeviceDataToRemoteDeviceDictionary( |
57 const std::string& user_id, | 59 const AccountId& account_id, |
58 const EasyUnlockDeviceKeyData& data, | 60 const EasyUnlockDeviceKeyData& data, |
59 base::DictionaryValue* dict); | 61 base::DictionaryValue* dict); |
60 static bool RemoteDeviceDictionaryToDeviceData( | 62 static bool RemoteDeviceDictionaryToDeviceData( |
61 const base::DictionaryValue& dict, | 63 const base::DictionaryValue& dict, |
62 EasyUnlockDeviceKeyData* data); | 64 EasyUnlockDeviceKeyData* data); |
63 | 65 |
64 // Helpers to convert between EasyUnlockDeviceKeyDataList and remote devices | 66 // Helpers to convert between EasyUnlockDeviceKeyDataList and remote devices |
65 // ListValue. | 67 // ListValue. |
66 static void DeviceDataListToRemoteDeviceList( | 68 static void DeviceDataListToRemoteDeviceList( |
67 const std::string& user_id, | 69 const AccountId& account_id, |
68 const EasyUnlockDeviceKeyDataList& data_list, | 70 const EasyUnlockDeviceKeyDataList& data_list, |
69 base::ListValue* device_list); | 71 base::ListValue* device_list); |
70 static bool RemoteDeviceListToDeviceDataList( | 72 static bool RemoteDeviceListToDeviceDataList( |
71 const base::ListValue& device_list, | 73 const base::ListValue& device_list, |
72 EasyUnlockDeviceKeyDataList* data_list); | 74 EasyUnlockDeviceKeyDataList* data_list); |
73 | 75 |
74 // Gets key label for the given key index. | 76 // Gets key label for the given key index. |
75 static std::string GetKeyLabel(size_t key_index); | 77 static std::string GetKeyLabel(size_t key_index); |
76 | 78 |
77 private: | 79 private: |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
115 scoped_ptr<EasyUnlockGetKeysOperation> pending_read_operation_; | 117 scoped_ptr<EasyUnlockGetKeysOperation> pending_read_operation_; |
116 | 118 |
117 base::WeakPtrFactory<EasyUnlockKeyManager> weak_ptr_factory_; | 119 base::WeakPtrFactory<EasyUnlockKeyManager> weak_ptr_factory_; |
118 | 120 |
119 DISALLOW_COPY_AND_ASSIGN(EasyUnlockKeyManager); | 121 DISALLOW_COPY_AND_ASSIGN(EasyUnlockKeyManager); |
120 }; | 122 }; |
121 | 123 |
122 } // namespace chromeos | 124 } // namespace chromeos |
123 | 125 |
124 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_EASY_UNLOCK_EASY_UNLOCK_KEY_MANAGER_H_ | 126 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_EASY_UNLOCK_EASY_UNLOCK_KEY_MANAGER_H_ |
OLD | NEW |