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 #include "components/proximity_auth/remote_device_loader.h" | 5 #include "components/proximity_auth/remote_device_loader.h" |
6 | 6 |
| 7 #include <utility> |
| 8 |
7 #include "base/base64url.h" | 9 #include "base/base64url.h" |
8 #include "base/bind.h" | 10 #include "base/bind.h" |
9 #include "components/proximity_auth/cryptauth/secure_message_delegate.h" | 11 #include "components/proximity_auth/cryptauth/secure_message_delegate.h" |
10 #include "components/proximity_auth/logging/logging.h" | 12 #include "components/proximity_auth/logging/logging.h" |
11 #include "components/proximity_auth/proximity_auth_pref_manager.h" | 13 #include "components/proximity_auth/proximity_auth_pref_manager.h" |
12 | 14 |
13 namespace proximity_auth { | 15 namespace proximity_auth { |
14 | 16 |
15 RemoteDeviceLoader::RemoteDeviceLoader( | 17 RemoteDeviceLoader::RemoteDeviceLoader( |
16 const std::vector<cryptauth::ExternalDeviceInfo>& unlock_keys, | 18 const std::vector<cryptauth::ExternalDeviceInfo>& unlock_keys, |
17 const std::string& user_id, | 19 const std::string& user_id, |
18 const std::string& user_private_key, | 20 const std::string& user_private_key, |
19 scoped_ptr<SecureMessageDelegate> secure_message_delegate, | 21 scoped_ptr<SecureMessageDelegate> secure_message_delegate, |
20 ProximityAuthPrefManager* pref_manager) | 22 ProximityAuthPrefManager* pref_manager) |
21 : remaining_unlock_keys_(unlock_keys), | 23 : remaining_unlock_keys_(unlock_keys), |
22 user_id_(user_id), | 24 user_id_(user_id), |
23 user_private_key_(user_private_key), | 25 user_private_key_(user_private_key), |
24 secure_message_delegate_(secure_message_delegate.Pass()), | 26 secure_message_delegate_(std::move(secure_message_delegate)), |
25 pref_manager_(pref_manager), | 27 pref_manager_(pref_manager), |
26 weak_ptr_factory_(this) {} | 28 weak_ptr_factory_(this) {} |
27 | 29 |
28 RemoteDeviceLoader::~RemoteDeviceLoader() {} | 30 RemoteDeviceLoader::~RemoteDeviceLoader() {} |
29 | 31 |
30 void RemoteDeviceLoader::Load(const RemoteDeviceCallback& callback) { | 32 void RemoteDeviceLoader::Load(const RemoteDeviceCallback& callback) { |
31 DCHECK(callback_.is_null()); | 33 DCHECK(callback_.is_null()); |
32 callback_ = callback; | 34 callback_ = callback; |
33 PA_LOG(INFO) << "Loading " << remaining_unlock_keys_.size() | 35 PA_LOG(INFO) << "Loading " << remaining_unlock_keys_.size() |
34 << " remote devices"; | 36 << " remote devices"; |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 | 85 |
84 remote_devices_.push_back(RemoteDevice( | 86 remote_devices_.push_back(RemoteDevice( |
85 user_id_, unlock_key.friendly_device_name(), unlock_key.public_key(), | 87 user_id_, unlock_key.friendly_device_name(), unlock_key.public_key(), |
86 bluetooth_type, bluetooth_address, psk, std::string())); | 88 bluetooth_type, bluetooth_address, psk, std::string())); |
87 | 89 |
88 if (!remaining_unlock_keys_.size()) | 90 if (!remaining_unlock_keys_.size()) |
89 callback_.Run(remote_devices_); | 91 callback_.Run(remote_devices_); |
90 } | 92 } |
91 | 93 |
92 } // namespace proximity_auth | 94 } // namespace proximity_auth |
OLD | NEW |