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

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: Remove extra constructor. 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..c79555077742ee2073a7fe70dc3cc392b7a5d93e 100644
--- a/chrome/browser/chromeos/net/tether_notification_presenter.cc
+++ b/chrome/browser/chromeos/net/tether_notification_presenter.cc
@@ -61,12 +61,12 @@ TetherNotificationPresenter::CreateNotification(
rich_notification_data, nullptr);
}
-TetherNotificationPresenter::TetherNotificationPresenter()
- : TetherNotificationPresenter(message_center::MessageCenter::Get()) {}
-
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 +152,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