Commit 5fed494e authored by Andre Le's avatar Andre Le Committed by Commit Bot

[CrOS PhoneHub] Hook up settings button to settings page.

Add the functionality to open settings page in the settings buttons
of PhoneHub bubble and PhoneHub notification.

BUG=1106937,1126208

Change-Id: I751c0dfb227c5d0d0d0e47f6fd97753a460e530a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2453872
Commit-Queue: Andre Le <leandre@chromium.org>
Reviewed-by: default avatarTim Song <tengs@chromium.org>
Reviewed-by: default avatarKyle Horimoto <khorimoto@chromium.org>
Cr-Commit-Position: refs/heads/master@{#814903}
parent 715c16f6
...@@ -4,7 +4,11 @@ ...@@ -4,7 +4,11 @@
#include "ash/system/phonehub/phone_hub_notification_controller.h" #include "ash/system/phonehub/phone_hub_notification_controller.h"
#include "ash/public/cpp/system_tray_client.h"
#include "ash/shell.h"
#include "ash/strings/grit/ash_strings.h" #include "ash/strings/grit/ash_strings.h"
#include "ash/system/model/system_tray_model.h"
#include "ash/system/tray/tray_popup_utils.h"
#include "base/logging.h" #include "base/logging.h"
#include "base/memory/weak_ptr.h" #include "base/memory/weak_ptr.h"
#include "base/strings/strcat.h" #include "base/strings/strcat.h"
...@@ -142,7 +146,8 @@ void PhoneHubNotificationController::OnNotificationsRemoved( ...@@ -142,7 +146,8 @@ void PhoneHubNotificationController::OnNotificationsRemoved(
} }
void PhoneHubNotificationController::OpenSettings() { void PhoneHubNotificationController::OpenSettings() {
// TODO(tengs): Open the PhoneHub settings page. DCHECK(TrayPopupUtils::CanOpenWebUISettings());
Shell::Get()->system_tray_model()->client()->ShowConnectedDevicesSettings();
} }
void PhoneHubNotificationController::DismissNotification( void PhoneHubNotificationController::DismissNotification(
...@@ -239,8 +244,10 @@ PhoneHubNotificationController::CreateNotification( ...@@ -239,8 +244,10 @@ PhoneHubNotificationController::CreateNotification(
IDS_ASH_PHONE_HUB_NOTIFICATION_INLINE_CANCEL_BUTTON); IDS_ASH_PHONE_HUB_NOTIFICATION_INLINE_CANCEL_BUTTON);
optional_fields.buttons.push_back(cancel_button); optional_fields.buttons.push_back(cancel_button);
optional_fields.settings_button_handler = if (TrayPopupUtils::CanOpenWebUISettings()) {
message_center::SettingsButtonHandler::DELEGATE; optional_fields.settings_button_handler =
message_center::SettingsButtonHandler::DELEGATE;
}
return std::make_unique<message_center::Notification>( return std::make_unique<message_center::Notification>(
notification_type, cros_id, title, message, icon, display_source, notification_type, cros_id, title, message, icon, display_source,
......
...@@ -6,12 +6,19 @@ ...@@ -6,12 +6,19 @@
#include "ash/public/cpp/network_icon_image_source.h" #include "ash/public/cpp/network_icon_image_source.h"
#include "ash/public/cpp/shelf_config.h" #include "ash/public/cpp/shelf_config.h"
#include "ash/public/cpp/system_tray_client.h"
#include "ash/resources/vector_icons/vector_icons.h" #include "ash/resources/vector_icons/vector_icons.h"
#include "ash/root_window_controller.h"
#include "ash/shell.h"
#include "ash/strings/grit/ash_strings.h" #include "ash/strings/grit/ash_strings.h"
#include "ash/style/ash_color_provider.h" #include "ash/style/ash_color_provider.h"
#include "ash/system/model/system_tray_model.h"
#include "ash/system/phonehub/phone_hub_tray.h"
#include "ash/system/phonehub/phone_hub_view_ids.h" #include "ash/system/phonehub/phone_hub_view_ids.h"
#include "ash/system/status_area_widget.h"
#include "ash/system/tray/tray_constants.h" #include "ash/system/tray/tray_constants.h"
#include "ash/system/tray/tray_popup_item_style.h" #include "ash/system/tray/tray_popup_item_style.h"
#include "ash/system/tray/tray_popup_utils.h"
#include "base/i18n/number_formatting.h" #include "base/i18n/number_formatting.h"
#include "base/strings/string16.h" #include "base/strings/string16.h"
#include "ui/base/l10n/l10n_util.h" #include "ui/base/l10n/l10n_util.h"
...@@ -101,6 +108,9 @@ PhoneStatusView::PhoneStatusView(chromeos::phonehub::PhoneModel* phone_model) ...@@ -101,6 +108,9 @@ PhoneStatusView::PhoneStatusView(chromeos::phonehub::PhoneModel* phone_model)
IDS_ASH_STATUS_TRAY_SETTINGS); IDS_ASH_STATUS_TRAY_SETTINGS);
AddView(TriView::Container::END, settings_button_); AddView(TriView::Container::END, settings_button_);
separator->SetVisible(TrayPopupUtils::CanOpenWebUISettings());
settings_button_->SetVisible(TrayPopupUtils::CanOpenWebUISettings());
Update(); Update();
} }
...@@ -110,7 +120,9 @@ PhoneStatusView::~PhoneStatusView() { ...@@ -110,7 +120,9 @@ PhoneStatusView::~PhoneStatusView() {
void PhoneStatusView::ButtonPressed(views::Button* sender, void PhoneStatusView::ButtonPressed(views::Button* sender,
const ui::Event& event) { const ui::Event& event) {
// TODO(leandre): implement open settings/other buttons. DCHECK_EQ(settings_button_, sender);
DCHECK(TrayPopupUtils::CanOpenWebUISettings());
Shell::Get()->system_tray_model()->client()->ShowConnectedDevicesSettings();
} }
void PhoneStatusView::OnModelChanged() { void PhoneStatusView::OnModelChanged() {
......
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