Commit 9f64e116 authored by varkha's avatar varkha Committed by Commit bot

[ash-md] Uses a solid color layer for overview mode shield

Replaces a tdefault textured layer used for a shield with a solid color
layer.

BUG=537050
TEST=NONE - no visible change

Review-Url: https://codereview.chromium.org/2627153006
Cr-Commit-Position: refs/heads/master@{#443342}
parent a6b30160
...@@ -226,6 +226,7 @@ gfx::Vector2d GetSlideVectorForFadeIn(WindowSelector::Direction direction, ...@@ -226,6 +226,7 @@ gfx::Vector2d GetSlideVectorForFadeIn(WindowSelector::Direction direction,
// |border_color|, otherwise |border_color| parameter is ignored. // |border_color|, otherwise |border_color| parameter is ignored.
// The new background widget starts with |initial_opacity| and then fades in. // The new background widget starts with |initial_opacity| and then fades in.
views::Widget* CreateBackgroundWidget(WmWindow* root_window, views::Widget* CreateBackgroundWidget(WmWindow* root_window,
ui::LayerType layer_type,
SkColor background_color, SkColor background_color,
int border_thickness, int border_thickness,
int border_radius, int border_radius,
...@@ -237,6 +238,7 @@ views::Widget* CreateBackgroundWidget(WmWindow* root_window, ...@@ -237,6 +238,7 @@ views::Widget* CreateBackgroundWidget(WmWindow* root_window,
params.keep_on_top = false; params.keep_on_top = false;
params.ownership = views::Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET; params.ownership = views::Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET;
params.opacity = views::Widget::InitParams::TRANSLUCENT_WINDOW; params.opacity = views::Widget::InitParams::TRANSLUCENT_WINDOW;
params.layer_type = layer_type;
params.accept_events = false; params.accept_events = false;
widget->set_focus_on_creation(false); widget->set_focus_on_creation(false);
// Parenting in kShellWindowId_WallpaperContainer allows proper layering of // Parenting in kShellWindowId_WallpaperContainer allows proper layering of
...@@ -251,12 +253,15 @@ views::Widget* CreateBackgroundWidget(WmWindow* root_window, ...@@ -251,12 +253,15 @@ views::Widget* CreateBackgroundWidget(WmWindow* root_window,
widget_window->SetVisibilityAnimationTransition(::wm::ANIMATE_NONE); widget_window->SetVisibilityAnimationTransition(::wm::ANIMATE_NONE);
// The background widget should not activate the shelf when passing under it. // The background widget should not activate the shelf when passing under it.
widget_window->GetWindowState()->set_ignored_by_shelf(true); widget_window->GetWindowState()->set_ignored_by_shelf(true);
if (params.layer_type == ui::LAYER_SOLID_COLOR) {
widget_window->GetLayer()->SetColor(background_color);
} else {
views::View* content_view = views::View* content_view =
new RoundedRectView(border_radius, SK_ColorTRANSPARENT); new RoundedRectView(border_radius, SK_ColorTRANSPARENT);
content_view->set_background(new BackgroundWith1PxBorder( content_view->set_background(new BackgroundWith1PxBorder(
background_color, border_color, border_thickness, border_radius)); background_color, border_color, border_thickness, border_radius));
widget->SetContentsView(content_view); widget->SetContentsView(content_view);
}
widget_window->GetParent()->StackChildAtTop(widget_window); widget_window->GetParent()->StackChildAtTop(widget_window);
widget->Show(); widget->Show();
widget_window->SetOpacity(initial_opacity); widget_window->SetOpacity(initial_opacity);
...@@ -643,9 +648,9 @@ void WindowGrid::InitShieldWidget() { ...@@ -643,9 +648,9 @@ void WindowGrid::InitShieldWidget() {
SHELF_BACKGROUND_MAXIMIZED) SHELF_BACKGROUND_MAXIMIZED)
? 1.f ? 1.f
: 0.f; : 0.f;
shield_widget_.reset(CreateBackgroundWidget( shield_widget_.reset(
root_window_, kShieldColor, 0, 0, SK_ColorTRANSPARENT, initial_opacity)); CreateBackgroundWidget(root_window_, ui::LAYER_SOLID_COLOR, kShieldColor,
0, 0, SK_ColorTRANSPARENT, initial_opacity));
WmWindow* widget_window = WmWindow* widget_window =
WmLookup::Get()->GetWindowForWidget(shield_widget_.get()); WmLookup::Get()->GetWindowForWidget(shield_widget_.get());
const gfx::Rect bounds = widget_window->GetParent()->GetBounds(); const gfx::Rect bounds = widget_window->GetParent()->GetBounds();
...@@ -664,8 +669,9 @@ void WindowGrid::InitShieldWidget() { ...@@ -664,8 +669,9 @@ void WindowGrid::InitShieldWidget() {
void WindowGrid::InitSelectionWidget(WindowSelector::Direction direction) { void WindowGrid::InitSelectionWidget(WindowSelector::Direction direction) {
selection_widget_.reset(CreateBackgroundWidget( selection_widget_.reset(CreateBackgroundWidget(
root_window_, kWindowSelectionColor, kWindowSelectionBorderThickness, root_window_, ui::LAYER_TEXTURED, kWindowSelectionColor,
kWindowSelectionRadius, kWindowSelectionBorderColor, 0.f)); kWindowSelectionBorderThickness, kWindowSelectionRadius,
kWindowSelectionBorderColor, 0.f));
WmWindow* widget_window = WmWindow* widget_window =
WmLookup::Get()->GetWindowForWidget(selection_widget_.get()); WmLookup::Get()->GetWindowForWidget(selection_widget_.get());
const gfx::Rect target_bounds = const gfx::Rect target_bounds =
......
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