| 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 */, |
| 66 base::Bind(&TetherHostFetcher::OnRemoteDevicesLoaded, | 67 base::Bind(&TetherHostFetcher::OnRemoteDevicesLoaded, |
| 67 weak_ptr_factory_.GetWeakPtr())); | 68 weak_ptr_factory_.GetWeakPtr())); |
| 68 } | 69 } |
| 69 | 70 |
| 70 void TetherHostFetcher::OnRemoteDevicesLoaded( | 71 void TetherHostFetcher::OnRemoteDevicesLoaded( |
| 71 const cryptauth::RemoteDeviceList& remote_devices) { | 72 const cryptauth::RemoteDeviceList& remote_devices) { |
| 72 // Make a copy of the list before deleting |remote_device_loader_|. | 73 // Make a copy of the list before deleting |remote_device_loader_|. |
| 73 cryptauth::RemoteDeviceList remote_devices_copy = remote_devices; | 74 cryptauth::RemoteDeviceList remote_devices_copy = remote_devices; |
| 74 remote_device_loader_.reset(); | 75 remote_device_loader_.reset(); |
| 75 | 76 |
| (...skipping 23 matching lines...) Expand all Loading... |
| 99 | 100 |
| 100 if (!has_run_callback) { | 101 if (!has_run_callback) { |
| 101 request.single_callback.Run(nullptr); | 102 request.single_callback.Run(nullptr); |
| 102 } | 103 } |
| 103 } | 104 } |
| 104 } | 105 } |
| 105 | 106 |
| 106 } // namespace tether | 107 } // namespace tether |
| 107 | 108 |
| 108 } // namespace chromeos | 109 } // namespace chromeos |
| OLD | NEW |