Chromium Code Reviews| Index: chromeos/components/tether/host_scanner.cc |
| diff --git a/chromeos/components/tether/host_scanner.cc b/chromeos/components/tether/host_scanner.cc |
| index 7296d8471e40a6c5c646736b973cf6ff3a5c5d20..39f9b3e98a4a21f69b5c84acedb574a073008b0d 100644 |
| --- a/chromeos/components/tether/host_scanner.cc |
| +++ b/chromeos/components/tether/host_scanner.cc |
| @@ -6,6 +6,7 @@ |
| #include "base/bind.h" |
| #include "chromeos/components/tether/tether_host_fetcher.h" |
| +#include "chromeos/network/network_state.h" |
| #include "components/cryptauth/remote_device_loader.h" |
| namespace chromeos { |
| @@ -15,10 +16,14 @@ namespace tether { |
| HostScanner::HostScanner( |
| TetherHostFetcher* tether_host_fetcher, |
| BleConnectionManager* connection_manager, |
| - HostScanDevicePrioritizer* host_scan_device_prioritizer) |
| + HostScanDevicePrioritizer* host_scan_device_prioritizer, |
| + NetworkStateHandler* network_state_handler, |
| + NotificationPresenter* notification_presenter) |
| : tether_host_fetcher_(tether_host_fetcher), |
| connection_manager_(connection_manager), |
| host_scan_device_prioritizer_(host_scan_device_prioritizer), |
| + network_state_handler_(network_state_handler), |
| + notification_presenter_(notification_presenter), |
| is_fetching_hosts_(false), |
| weak_ptr_factory_(this) {} |
| @@ -60,7 +65,21 @@ void HostScanner::OnTetherAvailabilityResponse( |
| bool is_final_scan_result) { |
| most_recent_scan_results_ = scanned_device_list_so_far; |
| - // TODO(hansberry): Hook up to networking code. |
| + if (!scanned_device_list_so_far.empty()) { |
| + if (scanned_device_list_so_far.size() == 1) { |
|
Kyle Horimoto
2017/04/07 01:08:07
nit: Do the UI stuff after the networks have been
Ryan Hansberry
2017/04/07 01:25:04
Done.
|
| + notification_presenter_->NotifyPotentialHotspotNearby( |
| + scanned_device_list_so_far.at(0).remote_device); |
| + } else { |
| + notification_presenter_->NotifyMultiplePotentialHotspotsNearby(); |
| + } |
| + |
| + // TODO (hansberry): Clear out old scanned hosts from NetworkStateHandler. |
|
Kyle Horimoto
2017/04/07 01:08:08
You'll also need a TODO for adding the device info
Ryan Hansberry
2017/04/07 01:25:04
Done.
|
| + for (auto scanned_device_info : scanned_device_list_so_far) { |
| + cryptauth::RemoteDevice remote_device = scanned_device_info.remote_device; |
| + network_state_handler_->AddTetherNetworkState(remote_device.GetDeviceId(), |
| + remote_device.name); |
| + } |
| + } |
| if (is_final_scan_result) { |
| // If the final scan result has been received, the operation is finished. |