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

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

Issue 2861583002: [CrOS Tether] Open the Tether settings page when a tether notification body is clicked. (Closed)
Patch Set: stevenjb@ comments. 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 c79555077742ee2073a7fe70dc3cc392b7a5d93e..3d3bf513ead790c06776273ee4884eb48b287ca6 100644
--- a/chrome/browser/chromeos/net/tether_notification_presenter.cc
+++ b/chrome/browser/chromeos/net/tether_notification_presenter.cc
@@ -8,6 +8,7 @@
#include "base/memory/ptr_util.h"
#include "base/strings/string16.h"
#include "base/strings/utf_string_conversions.h"
+#include "chrome/browser/ui/chrome_pages.h"
#include "chrome/grit/generated_resources.h"
#include "components/proximity_auth/logging/logging.h"
#include "ui/base/l10n/l10n_util.h"
@@ -20,6 +21,24 @@ namespace chromeos {
namespace tether {
+namespace {
+
+const char kTetherSettingsSubpage[] = "networks?type=Tether";
+
+class SettingsUiDelegateImpl
+ : public TetherNotificationPresenter::SettingsUiDelegate {
+ public:
+ SettingsUiDelegateImpl() {}
+ ~SettingsUiDelegateImpl() override {}
+
+ void ShowSettingsSubPageForProfile(Profile* profile,
+ const std::string& sub_page) override {
+ chrome::ShowSettingsSubPageForProfile(profile, sub_page);
+ }
+};
+
+} // namespace
+
// static
constexpr const char TetherNotificationPresenter::kTetherNotifierId[] =
"cros_tether_notification_ids.notifier_id";
@@ -62,10 +81,13 @@ TetherNotificationPresenter::CreateNotification(
}
TetherNotificationPresenter::TetherNotificationPresenter(
+ Profile* profile,
message_center::MessageCenter* message_center,
NetworkConnect* network_connect)
- : message_center_(message_center),
+ : profile_(profile),
+ message_center_(message_center),
network_connect_(network_connect),
+ settings_ui_delegate_(base::WrapUnique(new SettingsUiDelegateImpl())),
weak_ptr_factory_(this) {
message_center_->AddObserver(this);
}
@@ -141,8 +163,8 @@ void TetherNotificationPresenter::RemoveConnectionToHostFailedNotification() {
void TetherNotificationPresenter::OnNotificationClicked(
const std::string& notification_id) {
PA_LOG(INFO) << "Notification with ID " << notification_id << " was clicked.";
-
- // TODO(khorimoto): Open the settings page.
+ settings_ui_delegate_->ShowSettingsSubPageForProfile(profile_,
+ kTetherSettingsSubpage);
}
void TetherNotificationPresenter::OnNotificationButtonClicked(
@@ -153,12 +175,15 @@ void TetherNotificationPresenter::OnNotificationButtonClicked(
<< " was clicked.";
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::SetSettingsUiDelegateForTesting(
+ std::unique_ptr<SettingsUiDelegate> settings_ui_delegate) {
+ settings_ui_delegate_ = std::move(settings_ui_delegate);
+}
+
void TetherNotificationPresenter::ShowNotification(
std::unique_ptr<message_center::Notification> notification) {
std::string notification_id = notification->id();

Powered by Google App Engine
This is Rietveld 408576698