Commit 32b225e4 authored by Renato Silva's avatar Renato Silva Committed by Commit Bot

Chrome OS - Add background to tray buttons in OOBE

Changes ShelfConfig and LoginShelfView so that the correct colors
are set for the buttons during the OOBE session state.

Fixed: 1023788
Change-Id: If4150449354575a648417f9aecfdb74a1d2bbfa2
Bug: 1023788
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2003316
Commit-Queue: Renato Silva <rrsilva@google.com>
Auto-Submit: Renato Silva <rrsilva@google.com>
Reviewed-by: default avatarXiyuan Xia <xiyuan@chromium.org>
Cr-Commit-Position: refs/heads/master@{#733270}
parent 3679e2a4
......@@ -99,13 +99,12 @@ constexpr int kButtonMarginRightDp = 16;
// Spacing between the button image and label.
constexpr int kImageLabelSpacingDp = 10;
// The color of the button background.
constexpr SkColor kButtonBackgroundColor =
SkColorSetA(gfx::kGoogleGrey100, 0x19);
// The color of the button text.
constexpr SkColor kButtonTextColor = gfx::kGoogleGrey100;
// The color of the button text during OOBE.
constexpr SkColor kButtonTextColorOobe = gfx::kGoogleGrey700;
// The color of the button icon.
constexpr SkColor kButtonIconColor = SkColorSetRGB(0xEB, 0xEA, 0xED);
......@@ -195,7 +194,7 @@ class LoginShelfButton : public views::LabelButton {
void PaintButtonContents(gfx::Canvas* canvas) override {
cc::PaintFlags flags;
flags.setAntiAlias(true);
flags.setColor(kButtonBackgroundColor);
flags.setColor(ShelfConfig::Get()->GetShelfControlButtonColor());
flags.setStyle(cc::PaintFlags::kFill_Style);
canvas->DrawPath(GetButtonHighlightPath(this), flags);
}
......@@ -214,15 +213,17 @@ class LoginShelfButton : public views::LabelButton {
}
void PaintDarkColors() {
SetEnabledTextColors(gfx::kGoogleGrey600);
SetEnabledTextColors(kButtonTextColorOobe);
SetImage(views::Button::STATE_NORMAL,
gfx::CreateVectorIcon(icon_, gfx::kGoogleGrey600));
gfx::CreateVectorIcon(icon_, kButtonTextColorOobe));
SchedulePaint();
}
void PaintLightColors() {
SetEnabledTextColors(kButtonTextColor);
SetImage(views::Button::STATE_NORMAL,
gfx::CreateVectorIcon(icon_, kButtonTextColor));
SchedulePaint();
}
private:
......@@ -321,7 +322,7 @@ class KioskAppsButton : public views::MenuButton,
void PaintButtonContents(gfx::Canvas* canvas) override {
cc::PaintFlags flags;
flags.setAntiAlias(true);
flags.setColor(kButtonBackgroundColor);
flags.setColor(ShelfConfig::Get()->GetShelfControlButtonColor());
flags.setStyle(cc::PaintFlags::kFill_Style);
canvas->DrawPath(GetButtonHighlightPath(this), flags);
}
......@@ -340,15 +341,17 @@ class KioskAppsButton : public views::MenuButton,
}
void PaintDarkColors() {
SetEnabledTextColors(gfx::kGoogleGrey600);
SetEnabledTextColors(kButtonTextColorOobe);
SetImage(views::Button::STATE_NORMAL,
CreateVectorIcon(kShelfAppsButtonIcon, gfx::kGoogleGrey600));
CreateVectorIcon(kShelfAppsButtonIcon, kButtonTextColorOobe));
SchedulePaint();
}
void PaintLightColors() {
SetEnabledTextColors(kButtonTextColor);
SetImage(views::Button::STATE_NORMAL,
CreateVectorIcon(kShelfAppsButtonIcon, kButtonIconColor));
SchedulePaint();
}
// views::ButtonListener:
......
......@@ -254,10 +254,14 @@ int ShelfConfig::GetShelfSize(bool ignore_in_app_state) const {
}
SkColor ShelfConfig::GetShelfControlButtonColor() const {
const session_manager::SessionState session_state =
Shell::Get()->session_controller()->GetSessionState();
if (chromeos::switches::ShouldShowShelfHotseat() && IsTabletMode() &&
Shell::Get()->session_controller()->GetSessionState() ==
session_manager::SessionState::ACTIVE) {
session_state == session_manager::SessionState::ACTIVE) {
return is_in_app() ? SK_ColorTRANSPARENT : GetDefaultShelfColor();
} else if (session_state == session_manager::SessionState::OOBE) {
return SkColorSetA(SK_ColorBLACK, 16); // 6% opacity
}
return shelf_control_permanent_highlight_background_;
}
......
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