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

Unified Diff: ash/wm/window_animations.cc

Issue 302653008: Moving default minimize location to the app launcher item. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Changed some comments Created 6 years, 7 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/shelf/shelf_view_unittest.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/wm/window_animations.cc
diff --git a/ash/wm/window_animations.cc b/ash/wm/window_animations.cc
index 3d195aec4e2abc2d1ef504da1dfa2d2ca1cf9657..b6fcfa7828a5c4295da109659798e08548c49e45 100644
--- a/ash/wm/window_animations.cc
+++ b/ash/wm/window_animations.cc
@@ -462,13 +462,12 @@ gfx::Rect GetMinimizeAnimationTargetBoundsInScreen(aura::Window* window) {
return item_rect;
// If both the icon width and height are 0, then there is no icon in the
- // launcher for |window| or the icon is hidden in the overflow menu. If the
- // launcher is auto hidden, one of the height or width will be 0 but the
- // position in the launcher and the major dimension are still reported
- // correctly and the window can be animated to the launcher item's light
- // bar.
+ // launcher for |window|. If the launcher is auto hidden, one of the height or
+ // width will be 0 but the position in the launcher and the major dimension
+ // are still reported correctly and the window can be animated to the launcher
+ // item's light bar.
+ ShelfLayoutManager* layout_manager = ShelfLayoutManager::ForShelf(window);
if (item_rect.width() != 0 || item_rect.height() != 0) {
- ShelfLayoutManager* layout_manager = ShelfLayoutManager::ForShelf(window);
if (layout_manager->visibility_state() == SHELF_AUTO_HIDE) {
gfx::Rect shelf_bounds = shelf->shelf_widget()->GetWindowBoundsInScreen();
switch (layout_manager->GetAlignment()) {
@@ -489,11 +488,24 @@ gfx::Rect GetMinimizeAnimationTargetBoundsInScreen(aura::Window* window) {
}
}
- // Assume the shelf is overflowed, zoom off to the bottom right of the
- // work area.
+ // Coming here, there is no visible icon of that shelf item and we zoom back
+ // to the location of the application launcher (which is fixed as first item
+ // of the shelf).
gfx::Rect work_area =
Shell::GetScreen()->GetDisplayNearestWindow(window).work_area();
- return gfx::Rect(work_area.right(), work_area.bottom(), 0, 0);
+ int ltr_adjusted_x = base::i18n::IsRTL() ? work_area.right() : work_area.x();
+ switch (layout_manager->GetAlignment()) {
+ case SHELF_ALIGNMENT_BOTTOM:
+ return gfx::Rect(ltr_adjusted_x, work_area.bottom(), 0, 0);
+ case SHELF_ALIGNMENT_TOP:
+ return gfx::Rect(ltr_adjusted_x, work_area.y(), 0, 0);
+ case SHELF_ALIGNMENT_LEFT:
+ return gfx::Rect(work_area.x(), work_area.y(), 0, 0);
+ case SHELF_ALIGNMENT_RIGHT:
+ return gfx::Rect(work_area.right(), work_area.y(), 0, 0);
+ }
+ NOTREACHED();
+ return gfx::Rect();
}
} // namespace ash
« no previous file with comments | « ash/shelf/shelf_view_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698