Chromium Code Reviews| Index: ash/display/display_util.cc |
| diff --git a/ash/display/display_util.cc b/ash/display/display_util.cc |
| index 01137fadb4bdc1bb9ee4d9e9b3ceb8a1f68604b2..c8218565062faca38e14245d25895cafdf6a502c 100644 |
| --- a/ash/display/display_util.cc |
| +++ b/ash/display/display_util.cc |
| @@ -16,11 +16,11 @@ |
| #include "ash/public/interfaces/new_window.mojom.h" |
| #include "ash/shell.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/window_tree_host.h" |
| #include "ui/base/l10n/l10n_util.h" |
| -#include "ui/base/resource/resource_bundle.h" |
| #include "ui/display/display.h" |
| #include "ui/display/manager/display_manager.h" |
| #include "ui/display/manager/managed_display_info.h" |
| @@ -34,7 +34,9 @@ |
| #include "ui/wm/core/coordinate_conversion.h" |
| #if defined(OS_CHROMEOS) |
| +#include "ash/resources/vector_icons/vector_icons.h" |
| #include "base/sys_info.h" |
| +#include "ui/gfx/paint_vector_icon.h" |
| #endif |
| namespace ash { |
| @@ -42,6 +44,14 @@ namespace { |
| const char kDisplayErrorNotificationId[] = "chrome://settings/display/error"; |
| +#if defined(OS_CHROMEOS) |
| +// TODO: These are for new MD vector icons, but are using pre-MD color scheme. |
|
Evan Stade
2016/12/05 22:53:10
please put your name in the TODO (to indicate you
Greg Levin
2016/12/06 22:44:49
Done. Although... I had always thought the name w
Evan Stade
2016/12/06 23:42:18
I certainly hope that I'm not on the hook for all
Greg Levin
2016/12/12 22:36:43
Acknowledged.
|
| +// When we switch to all MD icons for notifications, these should be updated to |
| +// use MD color scheme. |
| +const SkColor kDisplayIconColor = 0xFFBDBDBD; |
|
Evan Stade
2016/12/05 22:53:10
nit: SkColorSetRGB(0xBD, 0xBD, 0xBD);
(similar be
Greg Levin
2016/12/06 22:44:49
Done.
|
| +const SkColor kFeedbackIconColor = 0xFF969698; |
| +#endif |
| + |
| // A notification delegate that will start the feedback app when the notication |
| // is clicked. |
| class DisplayErrorNotificationDelegate |
| @@ -50,9 +60,8 @@ class DisplayErrorNotificationDelegate |
| DisplayErrorNotificationDelegate() = default; |
| // message_center::NotificationDelegate: |
| - bool HasClickedListener() override { return true; } |
| - |
| - void Click() override { |
| + void ButtonClick(int index) override { |
| + DCHECK_EQ(0, index); |
| WmShell::Get()->new_window_client()->OpenFeedbackPage(); |
| } |
| @@ -163,25 +172,33 @@ void MoveCursorTo(AshWindowTreeHost* ash_host, |
| #if defined(OS_CHROMEOS) |
| -void ShowDisplayErrorNotification(int message_id) { |
| +void ShowDisplayErrorNotification(base::string16& message, |
| + bool allow_feedback) { |
| // Always remove the notification to make sure the notification appears |
| // as a popup in any situation. |
| message_center::MessageCenter::Get()->RemoveNotification( |
| kDisplayErrorNotificationId, false /* by_user */); |
| - ui::ResourceBundle& bundle = ui::ResourceBundle::GetSharedInstance(); |
| + message_center::RichNotificationData optional_field; |
| + if (allow_feedback) { |
| + message_center::ButtonInfo send_button( |
| + l10n_util::GetStringUTF16(IDS_ASH_DISPLAY_FAILURE_SEND_FEEDBACK)); |
| + send_button.icon = gfx::Image( |
| + CreateVectorIcon(kNotificationFeedbackIcon, kFeedbackIconColor)); |
| + optional_field.buttons.push_back(send_button); |
| + } |
| + |
| std::unique_ptr<message_center::Notification> notification( |
| new message_center::Notification( |
| message_center::NOTIFICATION_TYPE_SIMPLE, kDisplayErrorNotificationId, |
| base::string16(), // title |
| - l10n_util::GetStringUTF16(message_id), |
| - bundle.GetImageNamed(IDR_AURA_NOTIFICATION_DISPLAY), |
| + message, gfx::Image(CreateVectorIcon(kDisplayNotificationIcon, |
| + kDisplayIconColor)), |
| base::string16(), // display_source |
| GURL(), message_center::NotifierId( |
| message_center::NotifierId::SYSTEM_COMPONENT, |
| system_notifier::kNotifierDisplayError), |
| - message_center::RichNotificationData(), |
| - new DisplayErrorNotificationDelegate)); |
| + optional_field, new DisplayErrorNotificationDelegate)); |
| message_center::MessageCenter::Get()->AddNotification( |
| std::move(notification)); |
| } |