Skip to content

Commit

Permalink
Apply system style to High Contrast Mode notification.
Browse files Browse the repository at this point in the history
In new-style notification system notification has different style from
other notifications such as web notifications.
* The context header shous the title "Chrome OS system".
* The context header has accent color.
* New MD icon is used.
This CL applies the system style to High Contrast Mode notification.

TEST=manual
BUG=751024

Change-Id: I7ab022e5b7fcd7e2807ca5327e196c1e2f6b3e84
Reviewed-on: https://chromium-review.googlesource.com/637058
Commit-Queue: Tetsui Ohkubo <tetsui@chromium.org>
Reviewed-by: James Cook <jamescook@chromium.org>
Cr-Commit-Position: refs/heads/master@{#498030}
  • Loading branch information
Tetsui Ohkubo authored and Commit Bot committed Aug 29, 2017
1 parent 14ecf25 commit fd8f9c1
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 9 deletions.
25 changes: 16 additions & 9 deletions ash/accelerators/accelerator_controller.cc
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ namespace {
using base::UserMetricsAction;
using chromeos::input_method::InputMethodManager;
using message_center::Notification;
using message_center::SystemNotificationWarningLevel;

// Identifier for the high contrast toggle accelerator notification.
const char kHighContrastToggleAccelNotificationId[] =
Expand Down Expand Up @@ -717,15 +718,21 @@ void HandleToggleHighContrast() {
// Show a notification so the user knows that this accelerator toggled
// high contrast mode, and that they can press it again to toggle back.
// The message center automatically only shows this once per session.
std::unique_ptr<Notification> notification(new Notification(
message_center::NOTIFICATION_TYPE_SIMPLE,
kHighContrastToggleAccelNotificationId, base::string16() /* title */,
l10n_util::GetStringUTF16(IDS_HIGH_CONTRAST_ACCEL_MSG),
gfx::Image(CreateVectorIcon(kSystemMenuAccessibilityIcon, SK_ColorBLACK)),
base::string16() /* display source */, GURL(),
message_center::NotifierId(message_center::NotifierId::SYSTEM_COMPONENT,
system_notifier::kNotifierAccessibility),
message_center::RichNotificationData(), nullptr));
std::unique_ptr<Notification> notification =
system_notifier::CreateSystemNotification(
message_center::NOTIFICATION_TYPE_SIMPLE,
kHighContrastToggleAccelNotificationId,
l10n_util::GetStringUTF16(IDS_HIGH_CONTRAST_ACCEL_TITLE),
l10n_util::GetStringUTF16(IDS_HIGH_CONTRAST_ACCEL_MSG),
gfx::Image(
CreateVectorIcon(kSystemMenuAccessibilityIcon, SK_ColorBLACK)),
base::string16() /* display source */, GURL(),
message_center::NotifierId(
message_center::NotifierId::SYSTEM_COMPONENT,
system_notifier::kNotifierAccessibility),
message_center::RichNotificationData(), nullptr,
kNotificationAccessibilityIcon,
SystemNotificationWarningLevel::NORMAL);
message_center::MessageCenter::Get()->AddNotification(
std::move(notification));

Expand Down
2 changes: 2 additions & 0 deletions ash/accelerators/accelerator_controller_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1326,6 +1326,8 @@ TEST_F(DeprecatedAcceleratorTester, TestNewAccelerators) {
// screen before we proceed testing the rest of accelerators.
ResetStateIfNeeded();
}

RemoveAllNotifications();
}

} // namespace ash
4 changes: 4 additions & 0 deletions ash/ash_strings.grd
Original file line number Diff line number Diff line change
Expand Up @@ -1068,6 +1068,10 @@ This file contains the strings for ash.
</message>

<!-- Notification that an accelerator was pressed, so the user knows how to toggle it back -->
<message name="IDS_HIGH_CONTRAST_ACCEL_TITLE"
desc="Notification title to tell users that they just pressed the Search+Shift+H shortcut to toggle High Contrast Mode, and that pressing it again will toggle it off.">
High Contrast Mode
</message>
<message name="IDS_HIGH_CONTRAST_ACCEL_MSG"
desc="Notification message to tell users that they just pressed the Search+Shift+H shortcut to toggle High Contrast Mode, and that pressing it again will toggle it off.">
High Contrast Mode enabled. Press Ctrl+Search+H again to toggle it off.
Expand Down

0 comments on commit fd8f9c1

Please sign in to comment.