Commit 33747113 authored by Jordy Greenblatt's avatar Jordy Greenblatt Committed by Commit Bot

[CrOS MultiDevice] Handle remaining notification clicks.

In addition to the existing behavior of handling clicks on the 'new
user' notification by opening setup flow, we want clicks on the 'host
switched' and 'chromebook added' notifications to open the settings
subpage. This CL adds a ShowConnectedDevicesSettings to the system tray
mojo service and has those notification clicks call it.

Bug: 876928
Change-Id: I5f49275abb5e24d3973385af5720376de967852b
Reviewed-on: https://chromium-review.googlesource.com/1239113Reviewed-by: default avatarJames Cook <jamescook@chromium.org>
Reviewed-by: default avatarTom Sepez <tsepez@chromium.org>
Reviewed-by: default avatarKyle Horimoto <khorimoto@chromium.org>
Commit-Queue: Jeremy Klein <jlklein@chromium.org>
Cr-Commit-Position: refs/heads/master@{#593361}
parent 370e13d1
......@@ -61,16 +61,12 @@ void MultiDeviceNotificationPresenter::OpenUiDelegate::
Shell::Get()->system_tray_model()->client_ptr()->ShowMultiDeviceSetup();
}
void MultiDeviceNotificationPresenter::OpenUiDelegate::
OpenChangeConnectedPhoneSettings() {
// TODO(jordynass): Open the "Settings/Connected Devices/Change Device"
// subpage once it has been implemented
}
void MultiDeviceNotificationPresenter::OpenUiDelegate::
OpenConnectedDevicesSettings() {
// TODO(jordynass): Open the "Settings/Connected Devices" subpage once it
// has been implemented
Shell::Get()
->system_tray_model()
->client_ptr()
->ShowConnectedDevicesSettings();
}
// static
......@@ -207,8 +203,9 @@ void MultiDeviceNotificationPresenter::OnNotificationClicked() {
open_ui_delegate_->OpenMultiDeviceSetupUi();
break;
case Status::kExistingUserHostSwitchedNotificationVisible:
open_ui_delegate_->OpenChangeConnectedPhoneSettings();
break;
// Clicks on the 'host switched' and 'Chromebook added' notifications have
// the same effect, i.e. opening the Settings subpage.
FALLTHROUGH;
case Status::kExistingUserNewChromebookNotificationVisible:
open_ui_delegate_->OpenConnectedDevicesSettings();
break;
......
......@@ -80,7 +80,6 @@ class ASH_EXPORT MultiDeviceNotificationPresenter
public:
virtual ~OpenUiDelegate();
virtual void OpenMultiDeviceSetupUi();
virtual void OpenChangeConnectedPhoneSettings();
virtual void OpenConnectedDevicesSettings();
};
......
......@@ -97,10 +97,6 @@ class MultiDeviceNotificationPresenterTest : public NoSessionAshTestBase {
return open_multi_device_setup_ui_count_;
}
int open_change_connected_phone_settings_count() const {
return open_change_connected_phone_settings_count_;
}
int open_connected_devices_settings_count() const {
return open_connected_devices_settings_count_;
}
......@@ -110,17 +106,12 @@ class MultiDeviceNotificationPresenterTest : public NoSessionAshTestBase {
++open_multi_device_setup_ui_count_;
}
void OpenChangeConnectedPhoneSettings() override {
++open_change_connected_phone_settings_count_;
}
void OpenConnectedDevicesSettings() override {
++open_connected_devices_settings_count_;
}
private:
int open_multi_device_setup_ui_count_ = 0;
int open_change_connected_phone_settings_count_ = 0;
int open_connected_devices_settings_count_ = 0;
};
......@@ -370,8 +361,7 @@ TEST_F(MultiDeviceNotificationPresenterTest,
notification_presenter_->RemoveMultiDeviceSetupNotification();
VerifyNoNotificationIsVisible();
EXPECT_EQ(
test_open_ui_delegate_->open_change_connected_phone_settings_count(), 0);
EXPECT_EQ(test_open_ui_delegate_->open_connected_devices_settings_count(), 0);
AssertHostSwitchedBucketCount("MultiDeviceSetup_NotificationClicked", 0);
AssertHostSwitchedBucketCount("MultiDeviceSetup_NotificationShown", 1);
}
......@@ -386,8 +376,7 @@ TEST_F(MultiDeviceNotificationPresenterTest,
ClickNotification();
VerifyNoNotificationIsVisible();
EXPECT_EQ(
test_open_ui_delegate_->open_change_connected_phone_settings_count(), 1);
EXPECT_EQ(test_open_ui_delegate_->open_connected_devices_settings_count(), 1);
AssertHostSwitchedBucketCount("MultiDeviceSetup_NotificationClicked", 1);
AssertHostSwitchedBucketCount("MultiDeviceSetup_NotificationShown", 1);
}
......
......@@ -112,6 +112,9 @@ interface SystemTrayClient {
// Shows settings related to input methods.
ShowIMESettings();
// Shows settings related to MultiDevice features.
ShowConnectedDevicesSettings();
// Shows the about chrome OS page and checks for updates after the page is
// loaded.
ShowAboutChromeOS();
......
......@@ -276,6 +276,10 @@ void SystemTrayClient::ShowIMESettings() {
ShowSettingsSubPageForActiveUser(chrome::kLanguageOptionsSubPage);
}
void SystemTrayClient::ShowConnectedDevicesSettings() {
ShowSettingsSubPageForActiveUser(chrome::kConnectedDevicesSubPage);
}
void SystemTrayClient::ShowAboutChromeOS() {
// We always want to check for updates when showing the about page from the
// Ash UI.
......
......@@ -72,6 +72,7 @@ class SystemTrayClient : public ash::mojom::SystemTrayClient,
void ShowPowerSettings() override;
void ShowChromeSlow() override;
void ShowIMESettings() override;
void ShowConnectedDevicesSettings() override;
void ShowAboutChromeOS() override;
void ShowHelp() override;
void ShowAccessibilityHelp() override;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment