| Index: chromeos/components/tether/tether_connector.cc
|
| diff --git a/chromeos/components/tether/tether_connector.cc b/chromeos/components/tether/tether_connector.cc
|
| index 02cd147560589b4960b50ff46f56aba88f10dea7..7eb23adf49c332b01d4602a39b2ed32562d96d6e 100644
|
| --- a/chromeos/components/tether/tether_connector.cc
|
| +++ b/chromeos/components/tether/tether_connector.cc
|
| @@ -7,9 +7,12 @@
|
| #include "base/bind.h"
|
| #include "chromeos/components/tether/active_host.h"
|
| #include "chromeos/components/tether/device_id_tether_network_guid_map.h"
|
| +#include "chromeos/components/tether/host_scan_cache.h"
|
| +#include "chromeos/components/tether/notification_presenter.h"
|
| #include "chromeos/components/tether/tether_host_fetcher.h"
|
| #include "chromeos/components/tether/wifi_hotspot_connector.h"
|
| #include "chromeos/network/network_handler.h"
|
| +#include "chromeos/network/network_state.h"
|
| #include "chromeos/network/network_state_handler.h"
|
| #include "components/proximity_auth/logging/logging.h"
|
|
|
| @@ -24,7 +27,9 @@ TetherConnector::TetherConnector(
|
| TetherHostFetcher* tether_host_fetcher,
|
| BleConnectionManager* connection_manager,
|
| TetherHostResponseRecorder* tether_host_response_recorder,
|
| - DeviceIdTetherNetworkGuidMap* device_id_tether_network_guid_map)
|
| + DeviceIdTetherNetworkGuidMap* device_id_tether_network_guid_map,
|
| + HostScanCache* host_scan_cache,
|
| + NotificationPresenter* notification_presenter)
|
| : network_state_handler_(network_state_handler),
|
| wifi_hotspot_connector_(wifi_hotspot_connector),
|
| active_host_(active_host),
|
| @@ -32,6 +37,8 @@ TetherConnector::TetherConnector(
|
| connection_manager_(connection_manager),
|
| tether_host_response_recorder_(tether_host_response_recorder),
|
| device_id_tether_network_guid_map_(device_id_tether_network_guid_map),
|
| + host_scan_cache_(host_scan_cache),
|
| + notification_presenter_(notification_presenter),
|
| weak_ptr_factory_(this) {}
|
|
|
| TetherConnector::~TetherConnector() {
|
| @@ -71,6 +78,13 @@ void TetherConnector::ConnectToNetwork(
|
| device_id_pending_connection_));
|
| }
|
|
|
| + if (host_scan_cache_->DoesHostRequireSetup(tether_network_guid)) {
|
| + const std::string& device_name =
|
| + network_state_handler_->GetNetworkStateFromGuid(tether_network_guid)
|
| + ->name();
|
| + notification_presenter_->NotifySetupRequired(device_name);
|
| + }
|
| +
|
| device_id_pending_connection_ = device_id;
|
| success_callback_ = success_callback;
|
| error_callback_ = error_callback;
|
| @@ -185,6 +199,8 @@ void TetherConnector::OnTetherHostToConnectFetched(
|
|
|
| DCHECK(device_id == tether_host_to_connect->GetDeviceId());
|
|
|
| + // TODO (hansberry): Indicate to ConnectTetheringOperation if first-time setup
|
| + // is required, so that it can adjust its timeout duration.
|
| connect_tethering_operation_ =
|
| ConnectTetheringOperation::Factory::NewInstance(
|
| *tether_host_to_connect, connection_manager_,
|
| @@ -197,6 +213,8 @@ void TetherConnector::SetConnectionFailed(const std::string& error_name) {
|
| DCHECK(!device_id_pending_connection_.empty());
|
| DCHECK(!error_callback_.is_null());
|
|
|
| + notification_presenter_->RemoveSetupRequiredNotification();
|
| +
|
| // Save a copy of the callback before resetting it below.
|
| network_handler::StringResultCallback error_callback = error_callback_;
|
|
|
| @@ -215,6 +233,8 @@ void TetherConnector::SetConnectionSucceeded(
|
| DCHECK(device_id_pending_connection_ == device_id);
|
| DCHECK(!success_callback_.is_null());
|
|
|
| + notification_presenter_->RemoveSetupRequiredNotification();
|
| +
|
| // Save a copy of the callback before resetting it below.
|
| base::Closure success_callback = success_callback_;
|
|
|
|
|