Commit 60b7e012 authored by Yulun Wu's avatar Yulun Wu Committed by Commit Bot

Restore classic launcher backgrounds.

This CL addresses changes in:

https://chromium-review.googlesource.com/c/chromium/src/+/2421441

Bug: 1134800
Change-Id: Idfe0c66caa4c3e9219a7bdc5c61f91a0bb77856c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2464343Reviewed-by: default avatarYulun Wu <yulunwu@chromium.org>
Reviewed-by: default avatarXiyuan Xia <xiyuan@chromium.org>
Reviewed-by: default avatarAlex Newcomer <newcomer@chromium.org>
Commit-Queue: Yulun Wu <yulunwu@chromium.org>
Cr-Commit-Position: refs/heads/master@{#816824}
parent f98a2005
......@@ -15,23 +15,26 @@ AppListColorProviderImpl::AppListColorProviderImpl()
AppListColorProviderImpl::~AppListColorProviderImpl() = default;
SkColor AppListColorProviderImpl::GetExpandArrowInkDropBaseColor() const {
return DeprecatedGetInkDropBaseColor(SkColorSetARGB(0x14, 0xFF, 0xFF, 0xFF));
return DeprecatedGetInkDropBaseColor(
/*default_color*/ SkColorSetARGB(0x14, 0xFF, 0xFF, 0xFF));
}
SkColor AppListColorProviderImpl::GetExpandArrowIconBaseColor() const {
return DeprecatedGetContentLayerColor(
AshColorProvider::ContentLayerType::kButtonIconColor, SK_ColorWHITE);
AshColorProvider::ContentLayerType::kButtonIconColor,
/*default_color*/ SK_ColorWHITE);
}
SkColor AppListColorProviderImpl::GetExpandArrowIconBackgroundColor() const {
return DeprecatedGetControlsLayerColor(
AshColorProvider::ControlsLayerType::kControlBackgroundColorInactive,
SkColorSetARGB(0xF, 0xFF, 0xFF, 0xFF));
/*default_color*/ SkColorSetARGB(0xF, 0xFF, 0xFF, 0xFF));
}
SkColor AppListColorProviderImpl::GetAppListBackgroundColor() const {
return DeprecatedGetShieldLayerColor(
AshColorProvider::ShieldLayerType::kShield80, gfx::kGoogleGrey900);
AshColorProvider::ShieldLayerType::kShield80,
/*default_color*/ gfx::kGoogleGrey900);
}
SkColor AppListColorProviderImpl::GetSearchBoxBackgroundColor() const {
......@@ -42,42 +45,44 @@ SkColor AppListColorProviderImpl::GetSearchBoxBackgroundColor() const {
SkColor AppListColorProviderImpl::GetSearchBoxCardBackgroundColor() const {
// Set solid color background to avoid broken text. See crbug.com/746563.
return ash_color_provider_->GetBaseLayerColor(
AshColorProvider::BaseLayerType::kOpaque);
return DeprecatedGetBaseLayerColor(AshColorProvider::BaseLayerType::kOpaque,
/*default_color*/ SK_ColorWHITE);
}
SkColor AppListColorProviderImpl::GetSearchBoxPlaceholderTextColor() const {
return DeprecatedGetContentLayerColor(
AshColorProvider::ContentLayerType::kTextColorSecondary,
gfx::kGoogleGrey200);
/*default_color*/ gfx::kGoogleGrey200);
}
SkColor AppListColorProviderImpl::GetSearchBoxTextColor() const {
SkColor AppListColorProviderImpl::GetSearchBoxTextColor(
SkColor default_color) const {
return DeprecatedGetContentLayerColor(
AshColorProvider::ContentLayerType::kTextColorPrimary,
SkColorSetRGB(0x33, 0x33, 0x33));
AshColorProvider::ContentLayerType::kTextColorPrimary, default_color);
}
SkColor AppListColorProviderImpl::GetSearchBoxSecondaryTextColor() const {
return ash_color_provider_->GetContentLayerColor(
AshColorProvider::ContentLayerType::kTextColorSecondary);
SkColor AppListColorProviderImpl::GetSearchBoxSecondaryTextColor(
SkColor default_color) const {
return DeprecatedGetContentLayerColor(
AshColorProvider::ContentLayerType::kTextColorSecondary, default_color);
}
SkColor AppListColorProviderImpl::GetSuggestionChipBackgroundColor() const {
return DeprecatedGetControlsLayerColor(
AshColorProvider::ControlsLayerType::kControlBackgroundColorInactive,
SkColorSetA(gfx::kGoogleGrey100, 0x14));
/*default_color*/ SkColorSetA(gfx::kGoogleGrey100, 0x14));
}
SkColor AppListColorProviderImpl::GetSuggestionChipTextColor() const {
return DeprecatedGetContentLayerColor(
AshColorProvider::ContentLayerType::kTextColorPrimary,
gfx::kGoogleGrey100);
/*default_color*/ gfx::kGoogleGrey100);
}
SkColor AppListColorProviderImpl::GetAppListItemTextColor() const {
return DeprecatedGetContentLayerColor(
AshColorProvider::ContentLayerType::kTextColorPrimary, SK_ColorBLACK);
AshColorProvider::ContentLayerType::kTextColorPrimary,
/*default_color*/ SK_ColorBLACK);
}
SkColor AppListColorProviderImpl::GetPageSwitcherButtonColor(
......@@ -125,7 +130,7 @@ SkColor AppListColorProviderImpl::GetFolderTitleTextColor(
SkColor AppListColorProviderImpl::GetFolderHintTextColor() const {
return DeprecatedGetContentLayerColor(
AshColorProvider::ContentLayerType::kTextColorSecondary,
gfx::kGoogleGrey600);
/*default_color*/ gfx::kGoogleGrey600);
}
SkColor AppListColorProviderImpl::GetFolderNameBackgroundColor(
......@@ -133,10 +138,7 @@ SkColor AppListColorProviderImpl::GetFolderNameBackgroundColor(
if (!active)
return SK_ColorTRANSPARENT;
AshColorProvider::RippleAttributes ripple_attributes =
ash_color_provider_->GetRippleAttributes(GetAppListBackgroundColor());
return SkColorSetA(ripple_attributes.base_color,
ripple_attributes.inkdrop_opacity * 255);
return DeprecatedGetInkDropRippleColor(/*default_color*/ gfx::kGoogleGrey100);
}
SkColor AppListColorProviderImpl::GetFolderNameBorderColor(bool active) const {
......@@ -153,14 +155,15 @@ SkColor AppListColorProviderImpl::GetFolderNameSelectionColor() const {
}
SkColor AppListColorProviderImpl::GetContentsBackgroundColor() const {
return ash_color_provider_->GetControlsLayerColor(
AshColorProvider::ControlsLayerType::kControlBackgroundColorInactive);
return DeprecatedGetControlsLayerColor(
AshColorProvider::ControlsLayerType::kControlBackgroundColorInactive,
/*default_color*/ SkColorSetRGB(0xF2, 0xF2, 0xF2));
}
SkColor AppListColorProviderImpl::GetSeparatorColor() const {
return DeprecatedGetContentLayerColor(
AshColorProvider::ContentLayerType::kSeparatorColor,
SkColorSetA(gfx::kGoogleGrey900, 0x24));
/*default_color*/ SkColorSetA(gfx::kGoogleGrey900, 0x24));
}
SkColor AppListColorProviderImpl::GetSearchResultViewInkDropColor() const {
......
......@@ -21,9 +21,9 @@ class AppListColorProviderImpl : public AppListColorProvider {
SkColor GetExpandArrowIconBackgroundColor() const override;
SkColor GetAppListBackgroundColor() const override;
SkColor GetSearchBoxBackgroundColor() const override;
SkColor GetSearchBoxSecondaryTextColor() const override;
SkColor GetSearchBoxSecondaryTextColor(SkColor default_color) const override;
SkColor GetSearchBoxPlaceholderTextColor() const override;
SkColor GetSearchBoxTextColor() const override;
SkColor GetSearchBoxTextColor(SkColor default_color) const override;
SkColor GetSuggestionChipBackgroundColor() const override;
SkColor GetSuggestionChipTextColor() const override;
SkColor GetAppListItemTextColor() const override;
......
......@@ -36,11 +36,13 @@ SkColor TestAppListColorProvider::GetSearchBoxPlaceholderTextColor() const {
return gfx::kGoogleGrey500;
}
SkColor TestAppListColorProvider::GetSearchBoxTextColor() const {
SkColor TestAppListColorProvider::GetSearchBoxTextColor(
SkColor default_color) const {
return gfx::kGoogleGrey200;
}
SkColor TestAppListColorProvider::GetSearchBoxSecondaryTextColor() const {
SkColor TestAppListColorProvider::GetSearchBoxSecondaryTextColor(
SkColor default_color) const {
return gfx::kGoogleGrey500;
}
......
......@@ -22,8 +22,8 @@ class TestAppListColorProvider : public AppListColorProvider {
SkColor GetAppListBackgroundColor() const override;
SkColor GetSearchBoxBackgroundColor() const override;
SkColor GetSearchBoxPlaceholderTextColor() const override;
SkColor GetSearchBoxTextColor() const override;
SkColor GetSearchBoxSecondaryTextColor() const override;
SkColor GetSearchBoxTextColor(SkColor default_color) const override;
SkColor GetSearchBoxSecondaryTextColor(SkColor default_color) const override;
SkColor GetSuggestionChipBackgroundColor() const override;
SkColor GetSuggestionChipTextColor() const override;
SkColor GetAppListItemTextColor() const override;
......
......@@ -262,7 +262,8 @@ void PrivacyInfoView::InitText() {
text_view_->GetViewAccessibility().OverrideRole(ax::mojom::Role::kLink);
views::StyledLabel::RangeStyleInfo style;
style.override_color = AppListColorProvider::Get()->GetSearchBoxTextColor();
style.override_color = AppListColorProvider::Get()->GetSearchBoxTextColor(
kDeprecatedSearchBoxTextDefaultColor);
text_view_->AddStyleRange(gfx::Range(0, offset), style);
// Create a custom view for the link portion of the text. This allows an
......
......@@ -338,8 +338,8 @@ void SearchBoxView::UpdateBackground(double progress,
progress, GetBackgroundColorForState(current_state),
GetBackgroundColorForState(target_state));
UpdateBackgroundColor(color);
search_box()->SetTextColor(
AppListColorProvider::Get()->GetSearchBoxTextColor());
search_box()->SetTextColor(AppListColorProvider::Get()->GetSearchBoxTextColor(
kDeprecatedSearchBoxTextDefaultColor));
}
void SearchBoxView::UpdateLayout(double progress,
......@@ -392,7 +392,8 @@ void SearchBoxView::OnWallpaperColorsChanged() {
AppListColorProvider* app_list_color_provider = AppListColorProvider::Get();
search_box()->set_placeholder_text_color(
app_list_color_provider->GetSearchBoxPlaceholderTextColor());
search_box()->SetTextColor(app_list_color_provider->GetSearchBoxTextColor());
search_box()->SetTextColor(app_list_color_provider->GetSearchBoxTextColor(
kDeprecatedSearchBoxTextDefaultColor));
if (features::IsDarkLightModeEnabled()) {
UpdateBackgroundColor(
app_list_color_provider->GetSearchBoxBackgroundColor());
......
......@@ -96,7 +96,8 @@ SearchResultTileItemView::SearchResultTileItemView(
title_ = AddChildView(std::make_unique<views::Label>());
title_->SetAutoColorReadabilityEnabled(false);
title_->SetEnabledColor(AppListColorProvider::Get()->GetSearchBoxTextColor());
title_->SetEnabledColor(AppListColorProvider::Get()->GetSearchBoxTextColor(
/*default_color*/ SK_ColorWHITE));
title_->SetLineHeight(kTileTextLineHeight);
title_->SetHorizontalAlignment(gfx::ALIGN_CENTER);
title_->SetHandlesTooltips(false);
......@@ -104,7 +105,8 @@ SearchResultTileItemView::SearchResultTileItemView(
rating_ = AddChildView(std::make_unique<views::Label>());
rating_->SetEnabledColor(
AppListColorProvider::Get()->GetSearchBoxSecondaryTextColor());
AppListColorProvider::Get()->GetSearchBoxSecondaryTextColor(
/*default_color*/ gfx::kGoogleGrey700));
rating_->SetLineHeight(kTileTextLineHeight);
rating_->SetHorizontalAlignment(gfx::ALIGN_RIGHT);
rating_->SetVisible(false);
......@@ -114,12 +116,14 @@ SearchResultTileItemView::SearchResultTileItemView(
rating_star_->SetVerticalAlignment(views::ImageView::Alignment::kLeading);
rating_star_->SetImage(gfx::CreateVectorIcon(
kBadgeRatingIcon, kSearchRatingStarSize,
AppListColorProvider::Get()->GetSearchBoxSecondaryTextColor()));
AppListColorProvider::Get()->GetSearchBoxSecondaryTextColor(
gfx::kGoogleGrey700)));
rating_star_->SetVisible(false);
price_ = AddChildView(std::make_unique<views::Label>());
price_->SetEnabledColor(
AppListColorProvider::Get()->GetSearchBoxSecondaryTextColor());
AppListColorProvider::Get()->GetSearchBoxSecondaryTextColor(
/*default_color*/ gfx::kGoogleGreen600));
price_->SetLineHeight(kTileTextLineHeight);
price_->SetHorizontalAlignment(gfx::ALIGN_LEFT);
price_->SetVisible(false);
......@@ -184,8 +188,8 @@ void SearchResultTileItemView::OnResultChanged() {
} else {
title_->SetFontList(font);
}
title_->SetEnabledColor(
AppListColorProvider::Get()->GetSearchBoxTextColor());
title_->SetEnabledColor(AppListColorProvider::Get()->GetSearchBoxTextColor(
/*default_color*/ gfx::kGoogleGrey900));
}
title_->SetMaxLines(2);
......
......@@ -119,14 +119,17 @@ void SearchResultView::CreateTitleRenderText() {
// When result is an omnibox non-url search, the matched tag indicates
// proposed query. For all other cases, the matched tag indicates typed search
// query.
render_text->SetColor(AppListColorProvider::Get()->GetSearchBoxTextColor());
render_text->SetColor(AppListColorProvider::Get()->GetSearchBoxTextColor(
kDeprecatedSearchBoxTextDefaultColor));
const SearchResult::Tags& tags = result()->title_tags();
for (const auto& tag : tags) {
if (tag.styles & SearchResult::Tag::URL) {
render_text->ApplyColor(kUrlColor, tag.range);
} else if (tag.styles & SearchResult::Tag::MATCH) {
render_text->ApplyColor(
AppListColorProvider::Get()->GetSearchBoxTextColor(), tag.range);
AppListColorProvider::Get()->GetSearchBoxTextColor(
kDeprecatedSearchBoxTextDefaultColor),
tag.range);
}
}
title_text_ = std::move(render_text);
......@@ -143,7 +146,8 @@ void SearchResultView::CreateDetailsRenderText() {
render_text->SetText(result()->details());
ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance();
render_text->SetFontList(rb.GetFontList(ui::ResourceBundle::BaseFont));
render_text->SetColor(AppListColorProvider::Get()->GetSearchBoxTextColor());
render_text->SetColor(AppListColorProvider::Get()->GetSearchBoxTextColor(
kDeprecatedSearchBoxTextDefaultColor));
const SearchResult::Tags& tags = result()->details_tags();
for (const auto& tag : tags) {
if (tag.styles & SearchResult::Tag::URL)
......
......@@ -10,6 +10,9 @@
namespace ash {
constexpr SkColor kDeprecatedSearchBoxTextDefaultColor =
SkColorSetRGB(0x33, 0x33, 0x33);
class ASH_PUBLIC_EXPORT AppListColorProvider {
public:
// Returns the singleton instance.
......@@ -21,8 +24,9 @@ class ASH_PUBLIC_EXPORT AppListColorProvider {
virtual SkColor GetAppListBackgroundColor() const = 0;
virtual SkColor GetSearchBoxBackgroundColor() const = 0;
virtual SkColor GetSearchBoxPlaceholderTextColor() const = 0;
virtual SkColor GetSearchBoxTextColor() const = 0;
virtual SkColor GetSearchBoxSecondaryTextColor() const = 0;
virtual SkColor GetSearchBoxTextColor(SkColor default_color) const = 0;
virtual SkColor GetSearchBoxSecondaryTextColor(
SkColor default_color) const = 0;
virtual SkColor GetSuggestionChipBackgroundColor() const = 0;
virtual SkColor GetSuggestionChipTextColor() const = 0;
virtual SkColor GetAppListItemTextColor() const = 0;
......
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