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

Unified Diff: ash/display/display_util.cc

Issue 2490323003: Improve monitor compatibility error, move feedback link into button (Closed)
Patch Set: Fix vector icons (2nd try) Created 4 years, 1 month 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
« no previous file with comments | « ash/display/display_util.h ('k') | ash/resources/vector_icons/BUILD.gn » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/display/display_util.cc
diff --git a/ash/display/display_util.cc b/ash/display/display_util.cc
index 01137fadb4bdc1bb9ee4d9e9b3ceb8a1f68604b2..4a2b78aea31f0fc5c152d6249f3ef4a896f30b74 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,13 +34,16 @@
#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 {
namespace {
const char kDisplayErrorNotificationId[] = "chrome://settings/display/error";
+const SkColor kNotificationIconColor = 0xFFBDBDBD;
// A notification delegate that will start the feedback app when the notication
// is clicked.
@@ -50,9 +53,8 @@ class DisplayErrorNotificationDelegate
DisplayErrorNotificationDelegate() = default;
// message_center::NotificationDelegate:
- bool HasClickedListener() override { return true; }
-
- void Click() override {
+ void ButtonClick(int index) override {
+ DCHECK(index == 0);
oshima 2016/11/22 21:51:56 DCHECK_EQ.
Greg Levin 2016/11/29 16:26:28 Done.
WmShell::Get()->new_window_client()->OpenFeedbackPage();
}
@@ -163,25 +165,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, kNotificationIconColor));
+ 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,
+ kNotificationIconColor)),
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));
}
« no previous file with comments | « ash/display/display_util.h ('k') | ash/resources/vector_icons/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698