Commit c6ce8aec authored by glevin's avatar glevin Committed by Commit bot

Improve monitor compatibility error, move feedback link into button

BUG=631181
TEST=Plug in unsupported monitor, note that error notification string
has changed to

"This monitor isn't getting along with your Chromebook (the monitor is
not supported)."

Also, "Send a feedback report" should be in a lower button.

Review-Url: https://codereview.chromium.org/2490323003
Cr-Commit-Position: refs/heads/master@{#438212}
parent ceb9f022
...@@ -508,10 +508,13 @@ Press Shift + Alt to switch. ...@@ -508,10 +508,13 @@ Press Shift + Alt to switch.
Show on-screen keyboard Show on-screen keyboard
</message> </message>
<message name="IDS_ASH_DISPLAY_FAILURE_ON_MIRRORING" desc="An error message to show that the system failed to enter the mirroring mode."> <message name="IDS_ASH_DISPLAY_FAILURE_ON_MIRRORING" desc="An error message to show that the system failed to enter the mirroring mode.">
Could not mirror displays since no supported resolutions found. Entered extended desktop instead. Click to send a feedback report. Could not mirror displays since no supported resolutions found. Entered extended desktop instead.
</message> </message>
<message name="IDS_ASH_DISPLAY_FAILURE_ON_NON_MIRRORING" desc="An error message to show that the system failed to enter the extended desktop mode or unknown status. Please translate the parentized text."> <message name="IDS_ASH_DISPLAY_FAILURE_ON_NON_MIRRORING" desc="An error message to show that the system failed to enter the extended desktop mode or unknown status. Please translate the parenthesized text.">
Dear Monitor, it's not working out between us. (That monitor is not supported. Click to send a feedback report.) This monitor isn't getting along with your <ph name="DEVICE_TYPE">$1<ex>Chromebook</ex></ph> (the monitor is not supported).
</message>
<message name="IDS_ASH_DISPLAY_FAILURE_SEND_FEEDBACK" desc="Button text below error report to allow user to send feedback report.">
Send feedback
</message> </message>
<message name="IDS_ASH_DISPLAY_MIRRORING_NOT_SUPPORTED" desc="A message used to explain that mirroring with more than two displays is not supported."> <message name="IDS_ASH_DISPLAY_MIRRORING_NOT_SUPPORTED" desc="A message used to explain that mirroring with more than two displays is not supported.">
Mirroring with more than two displays is not supported. Mirroring with more than two displays is not supported.
......
...@@ -15,6 +15,7 @@ ...@@ -15,6 +15,7 @@
#include "ash/display/display_animator_chromeos.h" #include "ash/display/display_animator_chromeos.h"
#include "base/sys_info.h" #include "base/sys_info.h"
#include "grit/ash_strings.h" #include "grit/ash_strings.h"
#include "ui/base/l10n/l10n_util.h"
#endif #endif
namespace { namespace {
...@@ -84,8 +85,11 @@ void DisplayConfigurationController::SetMirrorMode(bool mirror, ...@@ -84,8 +85,11 @@ void DisplayConfigurationController::SetMirrorMode(bool mirror,
bool user_action) { bool user_action) {
if (display_manager_->num_connected_displays() > 2) { if (display_manager_->num_connected_displays() > 2) {
#if defined(OS_CHROMEOS) #if defined(OS_CHROMEOS)
if (user_action) if (user_action) {
ShowDisplayErrorNotification(IDS_ASH_DISPLAY_MIRRORING_NOT_SUPPORTED); ShowDisplayErrorNotification(
l10n_util::GetStringUTF16(IDS_ASH_DISPLAY_MIRRORING_NOT_SUPPORTED),
false);
}
#endif #endif
return; return;
} }
......
...@@ -4,9 +4,11 @@ ...@@ -4,9 +4,11 @@
#include "ash/display/display_error_observer_chromeos.h" #include "ash/display/display_error_observer_chromeos.h"
#include "ash/common/system/chromeos/devicetype_utils.h"
#include "ash/display/display_util.h" #include "ash/display/display_util.h"
#include "base/strings/string_number_conversions.h" #include "base/strings/string_number_conversions.h"
#include "grit/ash_strings.h" #include "grit/ash_strings.h"
#include "ui/base/l10n/l10n_util.h"
namespace ash { namespace ash {
...@@ -25,10 +27,12 @@ void DisplayErrorObserver::OnDisplayModeChangeFailed( ...@@ -25,10 +27,12 @@ void DisplayErrorObserver::OnDisplayModeChangeFailed(
<< "."; << ".";
} }
ShowDisplayErrorNotification( base::string16 message =
(new_state == ui::MULTIPLE_DISPLAY_STATE_DUAL_MIRROR) (new_state == ui::MULTIPLE_DISPLAY_STATE_DUAL_MIRROR)
? IDS_ASH_DISPLAY_FAILURE_ON_MIRRORING ? l10n_util::GetStringUTF16(IDS_ASH_DISPLAY_FAILURE_ON_MIRRORING)
: IDS_ASH_DISPLAY_FAILURE_ON_NON_MIRRORING); : ash::SubstituteChromeOSDeviceType(
IDS_ASH_DISPLAY_FAILURE_ON_NON_MIRRORING);
ShowDisplayErrorNotification(message, true);
} }
} // namespace ash } // namespace ash
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
#include "ash/display/display_error_observer_chromeos.h" #include "ash/display/display_error_observer_chromeos.h"
#include "ash/common/system/chromeos/devicetype_utils.h"
#include "ash/display/display_util.h" #include "ash/display/display_util.h"
#include "ash/shell.h" #include "ash/shell.h"
#include "ash/test/ash_test_base.h" #include "ash/test/ash_test_base.h"
...@@ -85,7 +86,8 @@ TEST_F(DisplayErrorObserverTest, CallWithDifferentState) { ...@@ -85,7 +86,8 @@ TEST_F(DisplayErrorObserverTest, CallWithDifferentState) {
observer()->OnDisplayModeChangeFailed( observer()->OnDisplayModeChangeFailed(
ui::DisplayConfigurator::DisplayStateList(), ui::DisplayConfigurator::DisplayStateList(),
ui::MULTIPLE_DISPLAY_STATE_DUAL_EXTENDED); ui::MULTIPLE_DISPLAY_STATE_DUAL_EXTENDED);
EXPECT_EQ(l10n_util::GetStringUTF16(IDS_ASH_DISPLAY_FAILURE_ON_NON_MIRRORING), EXPECT_EQ(ash::SubstituteChromeOSDeviceType(
IDS_ASH_DISPLAY_FAILURE_ON_NON_MIRRORING),
GetMessageContents()); GetMessageContents());
} }
......
...@@ -16,11 +16,11 @@ ...@@ -16,11 +16,11 @@
#include "ash/host/ash_window_tree_host.h" #include "ash/host/ash_window_tree_host.h"
#include "ash/shell.h" #include "ash/shell.h"
#include "base/strings/string_number_conversions.h" #include "base/strings/string_number_conversions.h"
#include "grit/ash_resources.h" #include "base/strings/utf_string_conversions.h"
#include "grit/ash_strings.h"
#include "ui/aura/env.h" #include "ui/aura/env.h"
#include "ui/aura/window_tree_host.h" #include "ui/aura/window_tree_host.h"
#include "ui/base/l10n/l10n_util.h" #include "ui/base/l10n/l10n_util.h"
#include "ui/base/resource/resource_bundle.h"
#include "ui/display/display.h" #include "ui/display/display.h"
#include "ui/display/manager/display_manager.h" #include "ui/display/manager/display_manager.h"
#include "ui/display/manager/managed_display_info.h" #include "ui/display/manager/managed_display_info.h"
...@@ -34,7 +34,9 @@ ...@@ -34,7 +34,9 @@
#include "ui/wm/core/coordinate_conversion.h" #include "ui/wm/core/coordinate_conversion.h"
#if defined(OS_CHROMEOS) #if defined(OS_CHROMEOS)
#include "ash/resources/vector_icons/vector_icons.h"
#include "base/sys_info.h" #include "base/sys_info.h"
#include "ui/gfx/paint_vector_icon.h"
#endif #endif
namespace ash { namespace ash {
...@@ -42,6 +44,14 @@ namespace { ...@@ -42,6 +44,14 @@ namespace {
const char kDisplayErrorNotificationId[] = "chrome://settings/display/error"; const char kDisplayErrorNotificationId[] = "chrome://settings/display/error";
#if defined(OS_CHROMEOS)
// TODO(glevin): These are for new MD vector icons, but are using pre-MD color
// scheme. When we switch to all MD icons for notifications, these should be
// updated to use MD color scheme.
const SkColor kDisplayIconColor = SkColorSetRGB(0xBD, 0xBD, 0xBD);
const SkColor kFeedbackIconColor = SkColorSetRGB(0x96, 0x96, 0x98);
#endif
// A notification delegate that will start the feedback app when the notication // A notification delegate that will start the feedback app when the notication
// is clicked. // is clicked.
class DisplayErrorNotificationDelegate class DisplayErrorNotificationDelegate
...@@ -50,9 +60,8 @@ class DisplayErrorNotificationDelegate ...@@ -50,9 +60,8 @@ class DisplayErrorNotificationDelegate
DisplayErrorNotificationDelegate() = default; DisplayErrorNotificationDelegate() = default;
// message_center::NotificationDelegate: // message_center::NotificationDelegate:
bool HasClickedListener() override { return true; } void ButtonClick(int index) override {
DCHECK_EQ(0, index);
void Click() override {
WmShell::Get()->new_window_controller()->OpenFeedbackPage(); WmShell::Get()->new_window_controller()->OpenFeedbackPage();
} }
...@@ -163,25 +172,33 @@ void MoveCursorTo(AshWindowTreeHost* ash_host, ...@@ -163,25 +172,33 @@ void MoveCursorTo(AshWindowTreeHost* ash_host,
#if defined(OS_CHROMEOS) #if defined(OS_CHROMEOS)
void ShowDisplayErrorNotification(int message_id) { void ShowDisplayErrorNotification(const base::string16& message,
bool allow_feedback) {
// Always remove the notification to make sure the notification appears // Always remove the notification to make sure the notification appears
// as a popup in any situation. // as a popup in any situation.
message_center::MessageCenter::Get()->RemoveNotification( message_center::MessageCenter::Get()->RemoveNotification(
kDisplayErrorNotificationId, false /* by_user */); kDisplayErrorNotificationId, false /* by_user */);
ui::ResourceBundle& bundle = ui::ResourceBundle::GetSharedInstance(); message_center::RichNotificationData data;
if (allow_feedback) {
message_center::ButtonInfo send_button(
l10n_util::GetStringUTF16(IDS_ASH_DISPLAY_FAILURE_SEND_FEEDBACK));
send_button.icon = gfx::Image(
CreateVectorIcon(kNotificationFeedbackButtonIcon, kFeedbackIconColor));
data.buttons.push_back(send_button);
}
std::unique_ptr<message_center::Notification> notification( std::unique_ptr<message_center::Notification> notification(
new message_center::Notification( new message_center::Notification(
message_center::NOTIFICATION_TYPE_SIMPLE, kDisplayErrorNotificationId, message_center::NOTIFICATION_TYPE_SIMPLE, kDisplayErrorNotificationId,
base::string16(), // title base::string16(), // title
l10n_util::GetStringUTF16(message_id), message, gfx::Image(CreateVectorIcon(kNotificationDisplayErrorIcon,
bundle.GetImageNamed(IDR_AURA_NOTIFICATION_DISPLAY), kDisplayIconColor)),
base::string16(), // display_source base::string16(), // display_source
GURL(), message_center::NotifierId( GURL(), message_center::NotifierId(
message_center::NotifierId::SYSTEM_COMPONENT, message_center::NotifierId::SYSTEM_COMPONENT,
system_notifier::kNotifierDisplayError), system_notifier::kNotifierDisplayError),
message_center::RichNotificationData(), data, new DisplayErrorNotificationDelegate));
new DisplayErrorNotificationDelegate));
message_center::MessageCenter::Get()->AddNotification( message_center::MessageCenter::Get()->AddNotification(
std::move(notification)); std::move(notification));
} }
......
...@@ -48,8 +48,10 @@ void MoveCursorTo(AshWindowTreeHost* ash_host, ...@@ -48,8 +48,10 @@ void MoveCursorTo(AshWindowTreeHost* ash_host,
bool update_last_location_now); bool update_last_location_now);
#if defined(OS_CHROMEOS) #if defined(OS_CHROMEOS)
// Shows the notification message for display related issues. // Shows the notification message for display related issues, and optionally
void ShowDisplayErrorNotification(int message_id); // adds a button to send a feedback report.
void ShowDisplayErrorNotification(const base::string16& message,
bool allow_feedback);
#endif #endif
ASH_EXPORT base::string16 GetDisplayErrorNotificationMessageForTest(); ASH_EXPORT base::string16 GetDisplayErrorNotificationMessageForTest();
......
...@@ -50,6 +50,9 @@ action("aggregate_vector_icons") { ...@@ -50,6 +50,9 @@ action("aggregate_vector_icons") {
"network_ethernet.icon", "network_ethernet.icon",
"network_vpn.1x.icon", "network_vpn.1x.icon",
"network_vpn.icon", "network_vpn.icon",
"notification_display_error.icon",
"notification_feedback_button.1x.icon",
"notification_feedback_button.icon",
"palette_action_capture_region.1x.icon", "palette_action_capture_region.1x.icon",
"palette_action_capture_region.icon", "palette_action_capture_region.icon",
"palette_action_capture_screen.1x.icon", "palette_action_capture_screen.1x.icon",
......
// Copyright 2016 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
CANVAS_DIMENSIONS, 80,
PATH_COLOR_ARGB, 0xFF, 0xFF, 0xB0, 0x00,
MOVE_TO, 58, 48,
R_CUBIC_TO, -4.42f, 0, -8, 3.58f, -8, 8,
R_CUBIC_TO, 0, 4.42f, 3.58f, 8, 8, 8,
R_CUBIC_TO, 4.42f, 0, 8, -3.58f, 8, -8,
R_CUBIC_TO, 0, -4.42f, -3.58f, -8, -8, -8,
CLOSE,
R_MOVE_TO, -1, 12,
R_H_LINE_TO, 2,
R_V_LINE_TO, -2,
R_H_LINE_TO, -2,
R_V_LINE_TO, 2,
CLOSE,
R_MOVE_TO, 0, -3,
R_H_LINE_TO, 2,
R_V_LINE_TO, -5,
R_H_LINE_TO, -2,
R_V_LINE_TO, 5,
CLOSE,
NEW_PATH,
MOVE_TO, 25, 46,
V_LINE_TO, 26,
H_LINE_TO, 55,
R_V_LINE_TO, 19.1f,
R_CUBIC_TO, 0, 0, 1.97f, -0.4f, 3, -0.4f,
R_V_LINE_TO, -18,
R_CUBIC_TO, 0, -1.76f, -1.47f, -3.2f, -3.27f, -3.7f,
H_LINE_TO, 25.27f,
R_CUBIC_TO, -1.8f, 0.5f, -3.27f, 1.94f, -3.27f, 3.7f,
R_V_LINE_TO, 19.1f,
R_CUBIC_TO, 0, 1.76f, 1.47f, 3.2f, 3.27f, 3.2f,
H_LINE_TO, 37,
R_LINE_TO, 0, 3.98f,
R_LINE_TO, -2.95f, -0.02f,
LINE_TO, 34, 56,
R_H_LINE_TO, 12,
R_LINE_TO, -0.05f, -3.03f,
R_LINE_TO, -2.96f, 0.01f,
LINE_TO, 43, 49,
R_H_LINE_TO, 6.12f,
R_CUBIC_TO, 0.96f, -1.17f, 3.62f, -2.99f, 3.62f, -2.99f,
LINE_TO, 25, 46,
CLOSE,
END
// Copyright 2016 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
CANVAS_DIMENSIONS, 16,
MOVE_TO, 2.4f, 1,
R_CUBIC_TO, -0.77f, 0, -1.39f, 0.63f, -1.39f, 1.4f,
LINE_TO, 1, 15,
R_LINE_TO, 2.8f, -3,
R_H_LINE_TO, 9.8f,
R_CUBIC_TO, 0.77f, 0.2f, 1.4f, -0.43f, 1.4f, -1.5f,
V_LINE_TO, 2.4f,
R_CUBIC_TO, 0, -0.77f, -0.63f, -1.4f, -1.4f, -1.4f,
H_LINE_TO, 2.4f,
CLOSE,
MOVE_TO, 7, 10,
V_LINE_TO, 8,
R_H_LINE_TO, 2,
R_V_LINE_TO, 2,
H_LINE_TO, 7,
CLOSE,
R_MOVE_TO, 0, -3,
V_LINE_TO, 3,
R_H_LINE_TO, 2,
R_V_LINE_TO, 4,
H_LINE_TO, 7,
CLOSE,
END
// Copyright 2016 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
CANVAS_DIMENSIONS, 32,
MOVE_TO, 4.8f, 2,
CUBIC_TO, 3.26f, 2, 2.01f, 3.26f, 2.01f, 4.8f,
LINE_TO, 2, 30,
R_LINE_TO, 5.6f, -6,
R_H_LINE_TO, 19.6f,
R_CUBIC_TO, 1.54f, 0.4f, 2.8f, -0.86f, 2.8f, -3,
V_LINE_TO, 4.8f,
CUBIC_TO, 30, 3.26f, 28.74f, 2, 27.2f, 2,
H_LINE_TO, 4.8f,
CLOSE,
MOVE_TO, 15, 19,
R_V_LINE_TO, -3,
R_H_LINE_TO, 3,
R_V_LINE_TO, 3,
R_H_LINE_TO, -3,
CLOSE,
R_MOVE_TO, 0, -5,
V_LINE_TO, 7,
R_H_LINE_TO, 3,
R_V_LINE_TO, 7,
R_H_LINE_TO, -3,
CLOSE,
END
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