Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(983)

Unified Diff: chrome/browser/chromeos/net/tether_notification_presenter.cc

Issue 2805393002: TetherNotificationPresenter: Connect to a network when the 'Connect' button is pressed. (Closed)
Patch Set: Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/chromeos/net/tether_notification_presenter.cc
diff --git a/chrome/browser/chromeos/net/tether_notification_presenter.cc b/chrome/browser/chromeos/net/tether_notification_presenter.cc
index 13d669541c8176fa648626336c6ffe44e85fb22c..4366573f9381949cdab7da3b99e78c86af47d4b9 100644
--- a/chrome/browser/chromeos/net/tether_notification_presenter.cc
+++ b/chrome/browser/chromeos/net/tether_notification_presenter.cc
@@ -62,11 +62,15 @@ TetherNotificationPresenter::CreateNotification(
}
TetherNotificationPresenter::TetherNotificationPresenter()
- : TetherNotificationPresenter(message_center::MessageCenter::Get()) {}
+ : TetherNotificationPresenter(message_center::MessageCenter::Get(),
+ NetworkConnect::Get()) {}
stevenjb 2017/04/10 19:55:51 We shouldn't provide this extra constructor. We sh
Ryan Hansberry 2017/04/10 22:28:55 Done.
TetherNotificationPresenter::TetherNotificationPresenter(
- message_center::MessageCenter* message_center)
- : message_center_(message_center), weak_ptr_factory_(this) {
+ message_center::MessageCenter* message_center,
+ NetworkConnect* network_connect)
+ : message_center_(message_center),
+ network_connect_(network_connect),
+ weak_ptr_factory_(this) {
message_center_->AddObserver(this);
}
@@ -152,12 +156,11 @@ void TetherNotificationPresenter::OnNotificationButtonClicked(
<< " of notification with ID " << notification_id
<< " was clicked.";
- // Only the "potential hotspot nearby" notification has a button, and it only
- // has one button (index 0).
- DCHECK(std::string(kPotentialHotspotNotificationId) == notification_id);
- DCHECK(0 == button_index);
-
- // TODO(khorimoto): Start a connection.
+ if (notification_id == kPotentialHotspotNotificationId && button_index == 0) {
+ // TODO (hansberry): Only directly start a connection if this is not the
+ // first time the user has connected to a host.
+ network_connect_->ConnectToNetworkId(hotspot_nearby_device_.GetDeviceId());
+ }
}
void TetherNotificationPresenter::ShowNotification(

Powered by Google App Engine
This is Rietveld 408576698