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

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: Removed file which did not belong in this CL. 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..bc10b32fc5333841e1e5995b4d0ad7ce03dbdc8f 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,12 @@ namespace chromeos {
namespace tether {
+namespace {
+
+const char kTetherSettingsSubpage[] = "networks?type=Tether";
+
+} // namespace
+
// static
constexpr const char TetherNotificationPresenter::kTetherNotifierId[] =
"cros_tether_notification_ids.notifier_id";
@@ -61,11 +68,24 @@ TetherNotificationPresenter::CreateNotification(
rich_notification_data, nullptr);
}
+TetherNotificationPresenter::SettingsUiDelegate::SettingsUiDelegate() {}
+
+TetherNotificationPresenter::SettingsUiDelegate::~SettingsUiDelegate() {}
+
+void TetherNotificationPresenter::SettingsUiDelegate::
+ ShowSettingsSubPageForProfile(Profile* profile,
+ const std::string& sub_page) {
+ chrome::ShowSettingsSubPageForProfile(profile, sub_page);
+}
+
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 SettingsUiDelegate())),
weak_ptr_factory_(this) {
message_center_->AddObserver(this);
}
@@ -141,8 +161,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 +173,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