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

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

Issue 2131603004: [ash-md] Makes Ctrl+W accelerator close a selected window in overview mode (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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
Index: ash/common/wm/overview/window_selector_item.cc
diff --git a/ash/common/wm/overview/window_selector_item.cc b/ash/common/wm/overview/window_selector_item.cc
index 1943920c2b16776fbba32149c6b2051a89776cbd..8483975f105d2e7f10b934bac221cbb9ca9e4e79 100644
--- a/ash/common/wm/overview/window_selector_item.cc
+++ b/ash/common/wm/overview/window_selector_item.cc
@@ -390,6 +390,26 @@ void WindowSelectorItem::SendAccessibleSelectionEvent() {
true);
}
+void WindowSelectorItem::CloseWindow() {
+ if (ash::MaterialDesignController::IsOverviewMaterial()) {
+ gfx::Rect inset_bounds(target_bounds_);
+ inset_bounds.Inset(target_bounds_.width() * kPreCloseScale,
+ target_bounds_.height() * kPreCloseScale);
+ OverviewAnimationType animation_type =
+ OverviewAnimationType::OVERVIEW_ANIMATION_CLOSING_SELECTOR_ITEM;
+ // Scale down both the window and label.
+ SetBounds(inset_bounds, animation_type);
+ // First animate opacity to an intermediate value concurrently with the
+ // scaling animation.
+ AnimateOpacity(kClosingItemOpacity, animation_type);
+
+ // Fade out the window and the label, effectively hiding them.
+ AnimateOpacity(
+ 0.0, OverviewAnimationType::OVERVIEW_ANIMATION_CLOSE_SELECTOR_ITEM);
+ }
+ transform_window_.Close();
+}
+
void WindowSelectorItem::SetDimmed(bool dimmed) {
dimmed_ = dimmed;
SetOpacity(dimmed ? kDimmedItemOpacity : 1.0f);
@@ -398,23 +418,7 @@ void WindowSelectorItem::SetDimmed(bool dimmed) {
void WindowSelectorItem::ButtonPressed(views::Button* sender,
const ui::Event& event) {
if (sender == close_button_) {
- if (ash::MaterialDesignController::IsOverviewMaterial()) {
- gfx::Rect inset_bounds(target_bounds_);
- inset_bounds.Inset(target_bounds_.width() * kPreCloseScale,
- target_bounds_.height() * kPreCloseScale);
- OverviewAnimationType animation_type =
- OverviewAnimationType::OVERVIEW_ANIMATION_CLOSING_SELECTOR_ITEM;
- // Scale down both the window and label.
- SetBounds(inset_bounds, animation_type);
- // First animate opacity to an intermediate value concurrently with the
- // scaling animation.
- AnimateOpacity(kClosingItemOpacity, animation_type);
-
- // Fade out the window and the label, effectively hiding them.
- AnimateOpacity(
- 0.0, OverviewAnimationType::OVERVIEW_ANIMATION_CLOSE_SELECTOR_ITEM);
- }
- transform_window_.Close();
+ CloseWindow();
return;
}
CHECK(sender == window_label_button_view_);

Powered by Google App Engine
This is Rietveld 408576698