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

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

Issue 2239233002: [ash-md] Fades overview header in and out (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: [ash-md] Fades overview header in and out (rebase) Created 4 years, 4 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
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 bd4de0549b2f49611f0962d555f405457ac8f170..3a60eb1225cd174049bc3b8a867729447936acc9 100644
--- a/ash/common/wm/overview/window_grid.cc
+++ b/ash/common/wm/overview/window_grid.cc
@@ -408,6 +408,7 @@ WindowGrid::WindowGrid(WmWindow* root_window,
ReorderItemsGreedyLeastMovement(&windows_in_root, root_window_,
window_selector_->text_filter_bottom());
}
+ PrepareForUsingMasksOrShapes(windows_in_root.size());
bruthig 2016/08/30 17:57:33 Correct me if I'm wrong but there is no need for t
varkha 2016/09/02 11:22:51 There is since this is dependent on number of wind
for (auto* window : windows_in_root) {
window->AddObserver(this);
observed_windows_.insert(window);
@@ -430,7 +431,7 @@ void WindowGrid::Shutdown() {
widget_window->GetLayer()->GetAnimator());
animation_settings.SetTransitionDuration(base::TimeDelta::FromMilliseconds(
kOverviewSelectorTransitionMilliseconds));
- animation_settings.SetTweenType(gfx::Tween::EASE_IN);
+ animation_settings.SetTweenType(gfx::Tween::EASE_IN_2);
animation_settings.SetPreemptionStrategy(
ui::LayerAnimator::IMMEDIATELY_ANIMATE_TO_NEW_TARGET);
// CleanupAnimationObserver will delete itself (and the shield widget) when
@@ -458,34 +459,7 @@ void WindowGrid::PrepareForOverview() {
void WindowGrid::PositionWindowsMD(bool animate) {
if (window_list_.empty())
return;
-
- const int kUnlimited = -1;
- const size_t windows_count = window_list_.size();
- const base::CommandLine* command_line =
- base::CommandLine::ForCurrentProcess();
- int windows_to_use_masks = kMaxWindowsCountToHideHeaderWithMasks;
- if (command_line->HasSwitch(switches::kAshMaxWindowsToUseMaskInOverview) &&
- (!base::StringToInt(command_line->GetSwitchValueASCII(
- switches::kAshMaxWindowsToUseMaskInOverview),
- &windows_to_use_masks) ||
- windows_to_use_masks <= kUnlimited)) {
- windows_to_use_masks = kMaxWindowsCountToHideHeaderWithMasks;
- }
- int windows_to_use_shapes = kUnlimited;
- if (command_line->HasSwitch(switches::kAshMaxWindowsToUseShapeInOverview) &&
- (!base::StringToInt(command_line->GetSwitchValueASCII(
- switches::kAshMaxWindowsToUseShapeInOverview),
- &windows_to_use_shapes) ||
- windows_to_use_shapes <= kUnlimited)) {
- windows_to_use_shapes = kUnlimited;
- }
- WindowSelectorItem::set_use_mask(windows_to_use_masks <= kUnlimited ||
- static_cast<int>(windows_count) <=
- windows_to_use_masks);
- WindowSelectorItem::set_use_shape(windows_to_use_shapes <= kUnlimited ||
- static_cast<int>(windows_count) <=
- windows_to_use_shapes);
-
+ PrepareForUsingMasksOrShapes(window_list_.size());
gfx::Rect total_bounds =
root_window_->ConvertRectToScreen(wm::GetDisplayWorkAreaBoundsInParent(
root_window_->GetChildByShellWindowId(
@@ -594,7 +568,7 @@ void WindowGrid::PositionWindowsMD(bool animate) {
}
// Position the windows centering the left-aligned rows vertically.
gfx::Vector2d offset(0, (total_bounds.bottom() - max_bottom) / 2);
- for (size_t i = 0; i < windows_count; ++i) {
+ for (size_t i = 0; i < window_list_.size(); ++i) {
window_list_[i]->SetBounds(
rects[i] + offset,
animate
@@ -859,7 +833,7 @@ void WindowGrid::InitShieldWidget() {
widget_window->GetLayer()->GetAnimator());
animation_settings.SetTransitionDuration(base::TimeDelta::FromMilliseconds(
kOverviewSelectorTransitionMilliseconds));
- animation_settings.SetTweenType(gfx::Tween::LINEAR_OUT_SLOW_IN);
+ animation_settings.SetTweenType(gfx::Tween::EASE_IN);
animation_settings.SetPreemptionStrategy(
ui::LayerAnimator::IMMEDIATELY_ANIMATE_TO_NEW_TARGET);
shield_widget_->SetOpacity(kShieldOpacity);
@@ -1059,4 +1033,32 @@ bool WindowGrid::FitWindowRectsInBounds(const gfx::Rect& bounds,
return windows_fit;
}
+void WindowGrid::PrepareForUsingMasksOrShapes(size_t windows_count) const {
+ const int kUnlimited = -1;
+ const base::CommandLine* command_line =
+ base::CommandLine::ForCurrentProcess();
+ int windows_to_use_masks = kMaxWindowsCountToHideHeaderWithMasks;
+ if (command_line->HasSwitch(switches::kAshMaxWindowsToUseMaskInOverview) &&
+ (!base::StringToInt(command_line->GetSwitchValueASCII(
+ switches::kAshMaxWindowsToUseMaskInOverview),
+ &windows_to_use_masks) ||
+ windows_to_use_masks <= kUnlimited)) {
+ windows_to_use_masks = kMaxWindowsCountToHideHeaderWithMasks;
bruthig 2016/08/30 17:57:33 You could consider adding a warning when the comme
varkha 2016/09/02 11:22:51 This flag was temporary scaffolding and Will be re
+ }
+ int windows_to_use_shapes = kUnlimited;
+ if (command_line->HasSwitch(switches::kAshMaxWindowsToUseShapeInOverview) &&
bruthig 2016/08/30 17:57:33 Consider wrapping this duplicate logic in a helper
varkha 2016/09/02 11:22:51 Ditto, will keep this in mind.
+ (!base::StringToInt(command_line->GetSwitchValueASCII(
+ switches::kAshMaxWindowsToUseShapeInOverview),
+ &windows_to_use_shapes) ||
+ windows_to_use_shapes <= kUnlimited)) {
+ windows_to_use_shapes = kUnlimited;
+ }
+ WindowSelectorItem::set_use_mask(windows_to_use_masks <= kUnlimited ||
+ static_cast<int>(windows_count) <=
+ windows_to_use_masks);
+ WindowSelectorItem::set_use_shape(windows_to_use_shapes <= kUnlimited ||
+ static_cast<int>(windows_count) <=
+ windows_to_use_shapes);
+}
+
} // namespace ash

Powered by Google App Engine
This is Rietveld 408576698