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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
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 typedef base::Callback<void(const cryptauth::RemoteDeviceList&)> | 65 typedef base::Callback<void(const cryptauth::RemoteDeviceList&)> |
66 RemoteDeviceCallback; | 66 RemoteDeviceCallback; |
67 virtual void Load(const RemoteDeviceCallback& callback); | 67 virtual void Load(const RemoteDeviceCallback& callback); |
Kyle Horimoto
2017/05/04 03:52:51
Can you pass |should_load_beacon_seeds| as a param
Tim Song
2017/05/06 22:53:16
Done.
| |
68 | 68 |
69 void set_should_load_beacon_seeds(bool should_load_beacon_seeds) { | |
70 should_load_beacon_seeds_ = should_load_beacon_seeds; | |
71 } | |
72 | |
69 private: | 73 private: |
70 // Called when the PSK is derived for each device. If the PSKs for all devices | 74 // Called when the PSK is derived for each device. If the PSKs for all devices |
71 // have been derived, then we can invoke |callback_|. | 75 // have been derived, then we can invoke |callback_|. |
72 void OnPSKDerived(const cryptauth::ExternalDeviceInfo& device, | 76 void OnPSKDerived(const cryptauth::ExternalDeviceInfo& device, |
73 const std::string& psk); | 77 const std::string& psk); |
74 | 78 |
79 // True if the loader should include BeaconSeeds in the loaded RemoteDevices. | |
80 bool should_load_beacon_seeds_; | |
81 | |
75 // The remaining devices whose PSK we're waiting on. | 82 // The remaining devices whose PSK we're waiting on. |
76 std::vector<cryptauth::ExternalDeviceInfo> remaining_devices_; | 83 std::vector<cryptauth::ExternalDeviceInfo> remaining_devices_; |
77 | 84 |
78 // The id of the user who the remote devices belong to. | 85 // The id of the user who the remote devices belong to. |
79 const std::string user_id_; | 86 const std::string user_id_; |
80 | 87 |
81 // The private key of the user's local device. | 88 // The private key of the user's local device. |
82 const std::string user_private_key_; | 89 const std::string user_private_key_; |
83 | 90 |
84 // Performs the PSK key derivation. | 91 // Performs the PSK key derivation. |
85 std::unique_ptr<cryptauth::SecureMessageDelegate> secure_message_delegate_; | 92 std::unique_ptr<cryptauth::SecureMessageDelegate> secure_message_delegate_; |
86 | 93 |
87 // Invoked when the RemoteDevices are loaded. | 94 // Invoked when the RemoteDevices are loaded. |
88 RemoteDeviceCallback callback_; | 95 RemoteDeviceCallback callback_; |
89 | 96 |
90 // The collection of RemoteDevices to return. | 97 // The collection of RemoteDevices to return. |
91 cryptauth::RemoteDeviceList remote_devices_; | 98 cryptauth::RemoteDeviceList remote_devices_; |
92 | 99 |
93 base::WeakPtrFactory<RemoteDeviceLoader> weak_ptr_factory_; | 100 base::WeakPtrFactory<RemoteDeviceLoader> weak_ptr_factory_; |
94 | 101 |
95 DISALLOW_COPY_AND_ASSIGN(RemoteDeviceLoader); | 102 DISALLOW_COPY_AND_ASSIGN(RemoteDeviceLoader); |
96 }; | 103 }; |
97 | 104 |
98 } // namespace cryptauth | 105 } // namespace cryptauth |
99 | 106 |
100 #endif // COMPONENTS_CRYPTAUTH_REMOTE_DEVICE_LOADER_H_ | 107 #endif // COMPONENTS_CRYPTAUTH_REMOTE_DEVICE_LOADER_H_ |
OLD | NEW |