| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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 "chromeos/components/tether/tether_host_fetcher.h" | 5 #include "chromeos/components/tether/tether_host_fetcher.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/memory/ptr_util.h" | 8 #include "base/memory/ptr_util.h" |
| 9 #include "components/cryptauth/cryptauth_device_manager.h" | 9 #include "components/cryptauth/cryptauth_device_manager.h" |
| 10 #include "components/cryptauth/cryptauth_enrollment_manager.h" | 10 #include "components/cryptauth/cryptauth_enrollment_manager.h" |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 // If the loader is already active, there is nothing to do. | 56 // If the loader is already active, there is nothing to do. |
| 57 return; | 57 return; |
| 58 } | 58 } |
| 59 | 59 |
| 60 remote_device_loader_ = cryptauth::RemoteDeviceLoader::Factory::NewInstance( | 60 remote_device_loader_ = cryptauth::RemoteDeviceLoader::Factory::NewInstance( |
| 61 cryptauth_service_->GetCryptAuthDeviceManager()->GetTetherHosts(), | 61 cryptauth_service_->GetCryptAuthDeviceManager()->GetTetherHosts(), |
| 62 cryptauth_service_->GetAccountId(), | 62 cryptauth_service_->GetAccountId(), |
| 63 cryptauth_service_->GetCryptAuthEnrollmentManager()->GetUserPrivateKey(), | 63 cryptauth_service_->GetCryptAuthEnrollmentManager()->GetUserPrivateKey(), |
| 64 cryptauth_service_->CreateSecureMessageDelegate()); | 64 cryptauth_service_->CreateSecureMessageDelegate()); |
| 65 remote_device_loader_->Load( | 65 remote_device_loader_->Load( |
| 66 false /* should_load_beacon_seeds */, | |
| 67 base::Bind(&TetherHostFetcher::OnRemoteDevicesLoaded, | 66 base::Bind(&TetherHostFetcher::OnRemoteDevicesLoaded, |
| 68 weak_ptr_factory_.GetWeakPtr())); | 67 weak_ptr_factory_.GetWeakPtr())); |
| 69 } | 68 } |
| 70 | 69 |
| 71 void TetherHostFetcher::OnRemoteDevicesLoaded( | 70 void TetherHostFetcher::OnRemoteDevicesLoaded( |
| 72 const cryptauth::RemoteDeviceList& remote_devices) { | 71 const cryptauth::RemoteDeviceList& remote_devices) { |
| 73 // Make a copy of the list before deleting |remote_device_loader_|. | 72 // Make a copy of the list before deleting |remote_device_loader_|. |
| 74 cryptauth::RemoteDeviceList remote_devices_copy = remote_devices; | 73 cryptauth::RemoteDeviceList remote_devices_copy = remote_devices; |
| 75 remote_device_loader_.reset(); | 74 remote_device_loader_.reset(); |
| 76 | 75 |
| (...skipping 23 matching lines...) Expand all Loading... |
| 100 | 99 |
| 101 if (!has_run_callback) { | 100 if (!has_run_callback) { |
| 102 request.single_callback.Run(nullptr); | 101 request.single_callback.Run(nullptr); |
| 103 } | 102 } |
| 104 } | 103 } |
| 105 } | 104 } |
| 106 | 105 |
| 107 } // namespace tether | 106 } // namespace tether |
| 108 | 107 |
| 109 } // namespace chromeos | 108 } // namespace chromeos |
| OLD | NEW |