Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(50)

Unified Diff: ash/common/wm/overview/window_grid.cc

Issue 2150823002: [ash-md] Implements a shadow over overview items and selector (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: [ash-md] Implements a shadow over overview items and selector (nits) Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ash/common/wm/overview/window_grid.h ('k') | ash/common/wm/overview/window_selector_item.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/common/wm/overview/window_grid.cc
diff --git a/ash/common/wm/overview/window_grid.cc b/ash/common/wm/overview/window_grid.cc
index 10003074a2dd524a2c284f7ff9437a0cccf6b66e..60b9412915a08aae7ddcd0e5c77990309b5fc052 100644
--- a/ash/common/wm/overview/window_grid.cc
+++ b/ash/common/wm/overview/window_grid.cc
@@ -40,6 +40,7 @@
#include "ui/views/painter.h"
#include "ui/views/view.h"
#include "ui/views/widget/widget.h"
+#include "ui/wm/core/shadow.h"
#include "ui/wm/core/window_animations.h"
namespace ash {
@@ -723,6 +724,7 @@ void WindowGrid::FilterItems(const base::string16& pattern) {
if (selection_widget_ && SelectedWindow() == *iter) {
SelectedWindow()->SetSelected(false);
selection_widget_.reset();
+ selector_shadow_.reset();
}
}
}
@@ -823,7 +825,6 @@ void WindowGrid::InitSelectionWidget(WindowSelector::Direction direction) {
selection_widget_.reset(CreateBackgroundWidget(root_window_, selection_color,
border_thickness,
border_radius, border_color));
-
WmWindow* widget_window =
WmLookup::Get()->GetWindowForWidget(selection_widget_.get());
const gfx::Rect target_bounds =
@@ -831,6 +832,15 @@ void WindowGrid::InitSelectionWidget(WindowSelector::Direction direction) {
gfx::Vector2d fade_out_direction =
GetSlideVectorForFadeIn(direction, target_bounds);
widget_window->SetBounds(target_bounds - fade_out_direction);
+
+ if (material) {
+ selector_shadow_.reset(new ::wm::Shadow());
+ selector_shadow_->Init(::wm::Shadow::STYLE_ACTIVE);
+ selector_shadow_->layer()->SetVisible(true);
+ selection_widget_->GetLayer()->SetMasksToBounds(false);
+ selection_widget_->GetLayer()->Add(selector_shadow_->layer());
+ selector_shadow_->SetContentBounds(gfx::Rect(target_bounds.size()));
+ }
}
void WindowGrid::MoveSelectionWidget(WindowSelector::Direction direction,
@@ -894,10 +904,32 @@ void WindowGrid::MoveSelectionWidgetToTarget(bool animate) {
ui::LayerAnimator::IMMEDIATELY_ANIMATE_TO_NEW_TARGET);
selection_widget_->SetBounds(bounds);
selection_widget_->SetOpacity(1.f);
+
+ if (selector_shadow_) {
+ ui::ScopedLayerAnimationSettings animation_settings_shadow(
+ selector_shadow_->shadow_layer()->GetAnimator());
+ animation_settings_shadow.SetTransitionDuration(
+ base::TimeDelta::FromMilliseconds(
+ kOverviewSelectorTransitionMilliseconds));
+ animation_settings_shadow.SetTweenType(
+ ash::MaterialDesignController::IsOverviewMaterial()
+ ? gfx::Tween::EASE_IN_OUT
+ : gfx::Tween::LINEAR_OUT_SLOW_IN);
+ animation_settings_shadow.SetPreemptionStrategy(
+ ui::LayerAnimator::IMMEDIATELY_ANIMATE_TO_NEW_TARGET);
+ bounds.Inset(1, 1);
+ selector_shadow_->SetContentBounds(
+ gfx::Rect(gfx::Point(1, 1), bounds.size()));
+ }
return;
}
selection_widget_->SetBounds(bounds);
selection_widget_->SetOpacity(1.f);
+ if (selector_shadow_) {
+ bounds.Inset(1, 1);
+ selector_shadow_->SetContentBounds(
+ gfx::Rect(gfx::Point(1, 1), bounds.size()));
+ }
}
bool WindowGrid::FitWindowRectsInBounds(const gfx::Rect& bounds,
« no previous file with comments | « ash/common/wm/overview/window_grid.h ('k') | ash/common/wm/overview/window_selector_item.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698