Commit f6b313db authored by Sammie Quon's avatar Sammie Quon Committed by Commit Bot

dark mode: Change overview UI to use ash color provider.

See bug for specs. Focus ring was already done as part of virtual desks.
Since alt tab shares UI with overview, it is done implicitly as well.

Test: manual
Bug: 1128760, 1128757
Change-Id: I194b6e92ca8b406fea7bc05733e295f16adfc648
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2446838
Commit-Queue: Sammie Quon <sammiequon@chromium.org>
Reviewed-by: default avatarMin Chen <minch@chromium.org>
Reviewed-by: default avatarXiaoqian Dai <xdai@chromium.org>
Cr-Commit-Position: refs/heads/master@{#814783}
parent 1e0bfa5a
......@@ -6,6 +6,7 @@
#define ASH_WM_OVERVIEW_OVERVIEW_CONSTANTS_H_
#include "ash/ash_export.h"
#include "ash/style/ash_color_provider.h"
#include "ash/wm/window_mini_view.h"
#include "base/time/time.h"
......@@ -34,7 +35,8 @@ constexpr float kOpacity = 0.4f;
// Amount of blur to apply on the wallpaper when we enter or exit overview
// mode.
constexpr float kBlurSigma = 10.f;
constexpr float kBlurSigma =
static_cast<float>(AshColorProvider::LayerBlurSigma::kBlurDefault);
} // namespace overview_constants
......
......@@ -236,7 +236,7 @@ TEST_F(OverviewControllerTest, AnimationCallbacksForCrossFadeWallpaper) {
overview_controller->EndOverview();
EXPECT_FALSE(overview_controller->InOverviewSession());
EXPECT_EQ(TestOverviewObserver::UNKNOWN, observer.ending_animation_state());
EXPECT_EQ(10, wallpaper_widget_controller->GetWallpaperProperty().blur_sigma);
EXPECT_EQ(30, wallpaper_widget_controller->GetWallpaperProperty().blur_sigma);
EXPECT_FALSE(wallpaper_widget_controller->IsAnimating());
observer.WaitForEndingAnimationComplete();
......
......@@ -9,6 +9,7 @@
#include "ash/resources/vector_icons/vector_icons.h"
#include "ash/strings/grit/ash_strings.h"
#include "ash/style/ash_color_provider.h"
#include "ash/wm/overview/overview_constants.h"
#include "ash/wm/overview/overview_grid.h"
#include "ash/wm/overview/overview_item.h"
......@@ -56,18 +57,10 @@ constexpr base::TimeDelta kCloseButtonSlowFadeInDelay =
constexpr int kCloseButtonInkDropRadiusDp = 18;
constexpr SkColor kCloseButtonColor = SK_ColorWHITE;
// Value should match the one in
// ash/resources/vector_icons/overview_window_close.icon.
constexpr int kCloseButtonIconMarginDp = 5;
// The colors of the close button ripple.
constexpr SkColor kCloseButtonInkDropRippleColor =
SkColorSetA(kCloseButtonColor, 0x0F);
constexpr SkColor kCloseButtonInkDropRippleHighlightColor =
SkColorSetA(kCloseButtonColor, 0x14);
// Shadow values for shadow on overview header views.
constexpr int kTitleShadowBlur = 28;
constexpr SkColor kTitleShadowColor = SkColorSetA(SK_ColorBLACK, 82);
......@@ -111,15 +104,21 @@ class OverviewCloseButton : public views::ImageButton {
public:
explicit OverviewCloseButton(views::ButtonListener* listener)
: views::ImageButton(listener) {
SetInkDropMode(InkDropMode::ON_NO_GESTURE_HANDLER);
// Add a shadow to the close vector icon.
auto* color_provider = AshColorProvider::Get();
SkColor color = color_provider->GetContentLayerColor(
AshColorProvider::ContentLayerType::kButtonIconColor);
gfx::ImageSkia image_shadow =
gfx::ImageSkiaOperations::CreateImageWithDropShadow(
gfx::CreateVectorIcon(kOverviewWindowCloseIcon, kCloseButtonColor),
gfx::CreateVectorIcon(kOverviewWindowCloseIcon, color),
GetIconShadowValues());
SetImage(views::Button::STATE_NORMAL, image_shadow);
auto ripple_attributes = color_provider->GetRippleAttributes(color);
SetInkDropBaseColor(ripple_attributes.base_color);
SetInkDropVisibleOpacity(ripple_attributes.inkdrop_opacity);
SetInkDropMode(InkDropMode::ON_NO_GESTURE_HANDLER);
SetImageHorizontalAlignment(views::ImageButton::ALIGN_CENTER);
SetImageVerticalAlignment(views::ImageButton::ALIGN_MIDDLE);
SetMinimumImageSize(gfx::Size(kHeaderHeightDp, kHeaderHeightDp));
......@@ -144,20 +143,6 @@ class OverviewCloseButton : public views::ImageButton {
views::InkDropImpl::AutoHighlightMode::SHOW_ON_RIPPLE);
return ink_drop;
}
std::unique_ptr<views::InkDropRipple> CreateInkDropRipple() const override {
return std::make_unique<views::FloodFillInkDropRipple>(
size(), gfx::Insets(), GetInkDropCenterBasedOnLastEvent(),
kCloseButtonInkDropRippleColor, /*visible_opacity=*/1.f);
}
std::unique_ptr<views::InkDropHighlight> CreateInkDropHighlight()
const override {
auto highlight = std::make_unique<views::InkDropHighlight>(
gfx::SizeF(size()), kCloseButtonInkDropRippleHighlightColor);
highlight->set_visible_opacity(1.f);
return highlight;
}
};
} // namespace
......
......@@ -8,6 +8,7 @@
#include <utility>
#include "ash/public/cpp/window_properties.h"
#include "ash/style/ash_color_provider.h"
#include "ash/wm/window_preview_view.h"
#include "ash/wm/wm_highlight_item_border.h"
#include "ui/accessibility/ax_enums.mojom.h"
......@@ -25,15 +26,11 @@
namespace ash {
namespace {
// Foreground label color.
constexpr SkColor kLabelColor = SK_ColorWHITE;
// The font delta of the window title.
constexpr int kLabelFontDelta = 2;
// Values of the backdrop.
constexpr int kBackdropBorderRoundingDp = 4;
constexpr SkColor kBackdropColor = SkColorSetA(SK_ColorWHITE, 0x24);
base::string16 GetWindowTitle(aura::Window* window) {
aura::Window* transient_root = wm::GetTransientRoot(window);
......@@ -60,7 +57,8 @@ void WindowMiniView::SetBackdropVisibility(bool visible) {
backdrop_view_->SetPaintToLayer(ui::LAYER_SOLID_COLOR);
ui::Layer* layer = backdrop_view_->layer();
layer->SetFillsBoundsOpaquely(false);
layer->SetColor(kBackdropColor);
layer->SetColor(AshColorProvider::Get()->GetControlsLayerColor(
AshColorProvider::ControlsLayerType::kControlBackgroundColorInactive));
layer->SetRoundedCornerRadius(
gfx::RoundedCornersF(kBackdropBorderRoundingDp));
layer->SetIsFastRoundedCorner(true);
......@@ -146,7 +144,8 @@ WindowMiniView::WindowMiniView(aura::Window* source_window)
std::make_unique<views::Label>(GetWindowTitle(source_window_)));
title_label_->SetHorizontalAlignment(gfx::ALIGN_LEFT);
title_label_->SetAutoColorReadabilityEnabled(false);
title_label_->SetEnabledColor(kLabelColor);
title_label_->SetEnabledColor(AshColorProvider::Get()->GetContentLayerColor(
AshColorProvider::ContentLayerType::kTextColorPrimary));
title_label_->SetSubpixelRenderingEnabled(false);
title_label_->SetFontList(gfx::FontList().Derive(
kLabelFontDelta, gfx::Font::NORMAL, gfx::Font::Weight::MEDIUM));
......
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