Commit bea348ed authored by Tatsuhisa Yamaguchi's avatar Tatsuhisa Yamaguchi Committed by Commit Bot

Adjust colors of notification icons based on session status.

This will prevent notification counter icon shown in white while
in the OOBE screen, when the background of the icons are also
bright color.

Test: manual test
Bug: 874021
Change-Id: I91cbbd1111b33d1a030b1d5aae2bdd884a1d487a
Reviewed-on: https://chromium-review.googlesource.com/1175517Reviewed-by: default avatarYoshiki Iguchi <yoshiki@chromium.org>
Commit-Queue: Tatsuhisa Yamaguchi <yamaguchi@chromium.org>
Cr-Commit-Position: refs/heads/master@{#583179}
parent 0fd72b87
...@@ -5,6 +5,8 @@ ...@@ -5,6 +5,8 @@
#include "ash/system/unified/notification_counter_view.h" #include "ash/system/unified/notification_counter_view.h"
#include "ash/resources/vector_icons/vector_icons.h" #include "ash/resources/vector_icons/vector_icons.h"
#include "ash/session/session_controller.h"
#include "ash/shell.h"
#include "ash/system/tray/tray_constants.h" #include "ash/system/tray/tray_constants.h"
#include "ash/system/tray/tray_utils.h" #include "ash/system/tray/tray_utils.h"
#include "base/i18n/number_formatting.h" #include "base/i18n/number_formatting.h"
...@@ -51,23 +53,25 @@ class NumberIconImageSource : public gfx::CanvasImageSource { ...@@ -51,23 +53,25 @@ class NumberIconImageSource : public gfx::CanvasImageSource {
} }
void Draw(gfx::Canvas* canvas) override { void Draw(gfx::Canvas* canvas) override {
SkColor tray_icon_color =
TrayIconColor(Shell::Get()->session_controller()->GetSessionState());
// Paint the contents inside the circle background. The color doesn't matter // Paint the contents inside the circle background. The color doesn't matter
// as it will be hollowed out by the XOR operation. // as it will be hollowed out by the XOR operation.
if (count_ > kTrayNotificationMaxCount) { if (count_ > kTrayNotificationMaxCount) {
canvas->DrawImageInt( canvas->DrawImageInt(
gfx::CreateVectorIcon(kSystemTrayNotificationCounterPlusIcon, gfx::CreateVectorIcon(kSystemTrayNotificationCounterPlusIcon,
size().width(), kTrayIconColor), size().width(), tray_icon_color),
0, 0); 0, 0);
} else { } else {
canvas->DrawStringRectWithFlags( canvas->DrawStringRectWithFlags(
base::FormatNumber(count_), GetNumberIconFontList(), kTrayIconColor, base::FormatNumber(count_), GetNumberIconFontList(), tray_icon_color,
gfx::Rect(size()), gfx::Rect(size()),
gfx::Canvas::TEXT_ALIGN_CENTER | gfx::Canvas::NO_SUBPIXEL_RENDERING); gfx::Canvas::TEXT_ALIGN_CENTER | gfx::Canvas::NO_SUBPIXEL_RENDERING);
} }
cc::PaintFlags flags; cc::PaintFlags flags;
flags.setBlendMode(SkBlendMode::kXor); flags.setBlendMode(SkBlendMode::kXor);
flags.setAntiAlias(true); flags.setAntiAlias(true);
flags.setColor(kTrayIconColor); flags.setColor(tray_icon_color);
canvas->DrawCircle(gfx::RectF(gfx::SizeF(size())).CenterPoint(), canvas->DrawCircle(gfx::RectF(gfx::SizeF(size())).CenterPoint(),
kTrayNotificationCircleIconRadius, flags); kTrayNotificationCircleIconRadius, flags);
} }
...@@ -110,8 +114,9 @@ QuietModeView::QuietModeView() : TrayItemView(nullptr) { ...@@ -110,8 +114,9 @@ QuietModeView::QuietModeView() : TrayItemView(nullptr) {
// implemented, so that icon resizing will not happen here. // implemented, so that icon resizing will not happen here.
// DCHECK_EQ(kTrayIconSize, // DCHECK_EQ(kTrayIconSize,
// gfx::GetDefaultSizeOfVectorIcon(kSystemTrayDoNotDisturbIcon)); // gfx::GetDefaultSizeOfVectorIcon(kSystemTrayDoNotDisturbIcon));
image_view()->SetImage(gfx::CreateVectorIcon(kSystemTrayDoNotDisturbIcon, image_view()->SetImage(gfx::CreateVectorIcon(
kTrayIconSize, kTrayIconColor)); kSystemTrayDoNotDisturbIcon, kTrayIconSize,
TrayIconColor(Shell::Get()->session_controller()->GetSessionState())));
Update(); Update();
} }
......
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