OLD | NEW |
---|---|
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 COMPONENTS_CRYPTAUTH_REMOTE_DEVICE_LOADER_H_ | 5 #ifndef COMPONENTS_CRYPTAUTH_REMOTE_DEVICE_LOADER_H_ |
6 #define COMPONENTS_CRYPTAUTH_REMOTE_DEVICE_LOADER_H_ | 6 #define COMPONENTS_CRYPTAUTH_REMOTE_DEVICE_LOADER_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
55 RemoteDeviceLoader( | 55 RemoteDeviceLoader( |
56 const std::vector<cryptauth::ExternalDeviceInfo>& device_info_list, | 56 const std::vector<cryptauth::ExternalDeviceInfo>& device_info_list, |
57 const std::string& user_id, | 57 const std::string& user_id, |
58 const std::string& user_private_key, | 58 const std::string& user_private_key, |
59 std::unique_ptr<cryptauth::SecureMessageDelegate> | 59 std::unique_ptr<cryptauth::SecureMessageDelegate> |
60 secure_message_delegate); | 60 secure_message_delegate); |
61 | 61 |
62 virtual ~RemoteDeviceLoader(); | 62 virtual ~RemoteDeviceLoader(); |
63 | 63 |
64 // Loads the RemoteDevice objects. |callback| will be invoked upon completion. | 64 // Loads the RemoteDevice objects. |callback| will be invoked upon completion. |
65 // For space condierations, BeaconSeeds will only be loaded if | |
Ryan Hansberry
2017/05/09 02:32:19
considerations*
Tim Song
2017/05/10 21:58:08
Done.
| |
66 // |should_load_beacon_seeds| is true. | |
65 typedef base::Callback<void(const cryptauth::RemoteDeviceList&)> | 67 typedef base::Callback<void(const cryptauth::RemoteDeviceList&)> |
66 RemoteDeviceCallback; | 68 RemoteDeviceCallback; |
67 virtual void Load(const RemoteDeviceCallback& callback); | 69 virtual void Load(bool should_load_beacon_seeds, |
70 const RemoteDeviceCallback& callback); | |
68 | 71 |
69 private: | 72 private: |
70 // Called when the PSK is derived for each device. If the PSKs for all devices | 73 // Called when the PSK is derived for each device. If the PSKs for all devices |
71 // have been derived, then we can invoke |callback_|. | 74 // have been derived, then we can invoke |callback_|. |
72 void OnPSKDerived(const cryptauth::ExternalDeviceInfo& device, | 75 void OnPSKDerived(const cryptauth::ExternalDeviceInfo& device, |
73 const std::string& psk); | 76 const std::string& psk); |
74 | 77 |
78 // True if the loader should include BeaconSeeds in the loaded RemoteDevices. | |
79 bool should_load_beacon_seeds_; | |
80 | |
75 // The remaining devices whose PSK we're waiting on. | 81 // The remaining devices whose PSK we're waiting on. |
76 std::vector<cryptauth::ExternalDeviceInfo> remaining_devices_; | 82 std::vector<cryptauth::ExternalDeviceInfo> remaining_devices_; |
77 | 83 |
78 // The id of the user who the remote devices belong to. | 84 // The id of the user who the remote devices belong to. |
79 const std::string user_id_; | 85 const std::string user_id_; |
80 | 86 |
81 // The private key of the user's local device. | 87 // The private key of the user's local device. |
82 const std::string user_private_key_; | 88 const std::string user_private_key_; |
83 | 89 |
84 // Performs the PSK key derivation. | 90 // Performs the PSK key derivation. |
85 std::unique_ptr<cryptauth::SecureMessageDelegate> secure_message_delegate_; | 91 std::unique_ptr<cryptauth::SecureMessageDelegate> secure_message_delegate_; |
86 | 92 |
87 // Invoked when the RemoteDevices are loaded. | 93 // Invoked when the RemoteDevices are loaded. |
88 RemoteDeviceCallback callback_; | 94 RemoteDeviceCallback callback_; |
89 | 95 |
90 // The collection of RemoteDevices to return. | 96 // The collection of RemoteDevices to return. |
91 cryptauth::RemoteDeviceList remote_devices_; | 97 cryptauth::RemoteDeviceList remote_devices_; |
92 | 98 |
93 base::WeakPtrFactory<RemoteDeviceLoader> weak_ptr_factory_; | 99 base::WeakPtrFactory<RemoteDeviceLoader> weak_ptr_factory_; |
94 | 100 |
95 DISALLOW_COPY_AND_ASSIGN(RemoteDeviceLoader); | 101 DISALLOW_COPY_AND_ASSIGN(RemoteDeviceLoader); |
96 }; | 102 }; |
97 | 103 |
98 } // namespace cryptauth | 104 } // namespace cryptauth |
99 | 105 |
100 #endif // COMPONENTS_CRYPTAUTH_REMOTE_DEVICE_LOADER_H_ | 106 #endif // COMPONENTS_CRYPTAUTH_REMOTE_DEVICE_LOADER_H_ |
OLD | NEW |