Commit 58616714 authored by Yulun Wu's avatar Yulun Wu Committed by Chromium LUCI CQ

Add base shielding to tablet mode app list.

Bug: 1145383
Change-Id: Ia1daa2762e5a0da81ef7dee1a47ead199352fa39
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2582833Reviewed-by: default avatarXiyuan Xia <xiyuan@chromium.org>
Reviewed-by: default avatarYulun Wu <yulunwu@chromium.org>
Reviewed-by: default avatarToni Baržić <tbarzic@chromium.org>
Commit-Queue: Yulun Wu <yulunwu@chromium.org>
Cr-Commit-Position: refs/heads/master@{#836977}
parent 01a4a143
......@@ -48,9 +48,11 @@ SkColor AppListColorProviderImpl::GetExpandArrowIconBackgroundColor() const {
/*default_color*/ SkColorSetARGB(0xF, 0xFF, 0xFF, 0xFF));
}
SkColor AppListColorProviderImpl::GetAppListBackgroundColor() const {
SkColor AppListColorProviderImpl::GetAppListBackgroundColor(
bool is_tablet_mode) const {
return DeprecatedGetShieldLayerColor(
AshColorProvider::ShieldLayerType::kShield80,
is_tablet_mode ? AshColorProvider::ShieldLayerType::kShield40
: AshColorProvider::ShieldLayerType::kShield80,
/*default_color*/ gfx::kGoogleGrey900);
}
......
......@@ -20,7 +20,7 @@ class AppListColorProviderImpl : public AppListColorProvider {
float GetExpandArrowInkDropOpacity() const override;
SkColor GetExpandArrowIconBaseColor() const override;
SkColor GetExpandArrowIconBackgroundColor() const override;
SkColor GetAppListBackgroundColor() const override;
SkColor GetAppListBackgroundColor(bool is_tablet_mode) const override;
SkColor GetSearchBoxBackgroundColor() const override;
SkColor GetSearchBoxSecondaryTextColor(SkColor default_color) const override;
SkColor GetSearchBoxTextColor(SkColor default_color) const override;
......
......@@ -3788,10 +3788,11 @@ TEST_P(AppListPresenterDelegateHomeLauncherTest, BackgroundOpacity) {
// The opacity should be set on the color, not the layer. Setting opacity on
// the layer will change the opacity of the blur effect, which is not desired.
const U8CPU clamshell_background_opacity = static_cast<U8CPU>(255 * 0.8);
EXPECT_EQ(
SkColorSetA(AppListColorProvider::Get()->GetAppListBackgroundColor(),
clamshell_background_opacity),
GetAppListView()->GetAppListBackgroundShieldColorForTest());
EXPECT_EQ(SkColorSetA(AppListColorProvider::Get()->GetAppListBackgroundColor(
/*is_tablet_mode*/
false),
clamshell_background_opacity),
GetAppListView()->GetAppListBackgroundShieldColorForTest());
EXPECT_EQ(1, GetAppListView()
->GetAppListBackgroundShieldForTest()
->layer()
......@@ -3801,10 +3802,11 @@ TEST_P(AppListPresenterDelegateHomeLauncherTest, BackgroundOpacity) {
EnableTabletMode(true);
const U8CPU tablet_background_opacity = static_cast<U8CPU>(0);
EXPECT_EQ(
SkColorSetA(AppListColorProvider::Get()->GetAppListBackgroundColor(),
tablet_background_opacity),
GetAppListView()->GetAppListBackgroundShieldColorForTest());
EXPECT_EQ(SkColorSetA(AppListColorProvider::Get()->GetAppListBackgroundColor(
/*is_tablet_mode*/
true),
tablet_background_opacity),
GetAppListView()->GetAppListBackgroundShieldColorForTest());
EXPECT_EQ(1, GetAppListView()
->GetAppListBackgroundShieldForTest()
->layer()
......
......@@ -157,10 +157,12 @@ class SearchBoxFocusHost : public views::View {
};
SkColor GetBackgroundShieldColor(const std::vector<SkColor>& colors,
float color_opacity) {
float color_opacity,
bool is_tablet_mode) {
const U8CPU sk_opacity_value = static_cast<U8CPU>(255 * color_opacity);
return SkColorSetA(AppListColorProvider::Get()->GetAppListBackgroundColor(),
sk_opacity_value);
return SkColorSetA(
AppListColorProvider::Get()->GetAppListBackgroundColor(is_tablet_mode),
sk_opacity_value);
}
DEFINE_UI_CLASS_PROPERTY_KEY(bool, kExcludeWindowFromEventHandling, false)
......@@ -410,8 +412,10 @@ class BoundsAnimationObserver : public ui::ImplicitAnimationObserver {
// The view for the app list background shield which changes color and radius.
class AppListBackgroundShieldView : public views::View {
public:
explicit AppListBackgroundShieldView(int shelf_background_corner_radius)
: color_(AppListColorProvider::Get()->GetAppListBackgroundColor()),
explicit AppListBackgroundShieldView(int shelf_background_corner_radius,
bool is_tablet_mode)
: color_(AppListColorProvider::Get()->GetAppListBackgroundColor(
is_tablet_mode)),
shelf_background_corner_radius_(shelf_background_corner_radius) {
SetPaintToLayer(ui::LAYER_SOLID_COLOR);
layer()->SetFillsBoundsOpaquely(false);
......@@ -590,8 +594,8 @@ void AppListView::InitContents() {
DCHECK(!announcement_view_);
auto app_list_background_shield =
std::make_unique<AppListBackgroundShieldView>(delegate_->GetShelfSize() /
2);
std::make_unique<AppListBackgroundShieldView>(
delegate_->GetShelfSize() / 2, delegate_->IsInTabletMode());
app_list_background_shield->UpdateBackground(
/*use_blur*/ !delegate_->IsInTabletMode() && is_background_blur_enabled_);
app_list_background_shield_ =
......@@ -2208,8 +2212,9 @@ void AppListView::SetBackgroundShieldColor() {
color_opacity = kAppListOpacityWithBlur;
}
app_list_background_shield_->UpdateColor(GetBackgroundShieldColor(
delegate_->GetWallpaperProminentColors(), color_opacity));
app_list_background_shield_->UpdateColor(
GetBackgroundShieldColor(delegate_->GetWallpaperProminentColors(),
color_opacity, delegate_->IsInTabletMode()));
}
void AppListView::RecordFolderMetrics() {
......
......@@ -25,7 +25,7 @@ class ASH_PUBLIC_EXPORT AppListColorProvider {
virtual float GetExpandArrowInkDropOpacity() const = 0;
virtual SkColor GetExpandArrowIconBaseColor() const = 0;
virtual SkColor GetExpandArrowIconBackgroundColor() const = 0;
virtual SkColor GetAppListBackgroundColor() const = 0;
virtual SkColor GetAppListBackgroundColor(bool is_tablet_mode) const = 0;
virtual SkColor GetSearchBoxBackgroundColor() const = 0;
virtual SkColor GetSearchBoxTextColor(SkColor default_color) const = 0;
virtual SkColor GetSearchBoxSecondaryTextColor(
......
......@@ -24,8 +24,10 @@ SkColor TestAppListColorProvider::GetExpandArrowIconBackgroundColor() const {
return SkColorSetA(SK_ColorWHITE, 0x1A);
}
SkColor TestAppListColorProvider::GetAppListBackgroundColor() const {
return gfx::kGoogleGrey900;
SkColor TestAppListColorProvider::GetAppListBackgroundColor(
bool is_tablet_mode) const {
return SkColorSetA(gfx::kGoogleGrey900,
is_tablet_mode ? 0x66 /*40%*/ : 0xCD /*80%*/);
}
SkColor TestAppListColorProvider::GetSearchBoxBackgroundColor() const {
......
......@@ -20,7 +20,7 @@ class TestAppListColorProvider : public AppListColorProvider {
float GetExpandArrowInkDropOpacity() const override;
SkColor GetExpandArrowIconBaseColor() const override;
SkColor GetExpandArrowIconBackgroundColor() const override;
SkColor GetAppListBackgroundColor() const override;
SkColor GetAppListBackgroundColor(bool is_tablet_mode) const override;
SkColor GetSearchBoxBackgroundColor() const override;
SkColor GetSearchBoxTextColor(SkColor default_color) const override;
SkColor GetSearchBoxSecondaryTextColor(SkColor default_color) const override;
......
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