OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "ash/wm/window_animations.h" | 5 #include "ash/wm/window_animations.h" |
6 | 6 |
7 #include <math.h> | 7 #include <math.h> |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <vector> | 10 #include <vector> |
(...skipping 450 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
461 if (!item_rect.IsEmpty()) | 461 if (!item_rect.IsEmpty()) |
462 return item_rect; | 462 return item_rect; |
463 | 463 |
464 // If both the icon width and height are 0, then there is no icon in the | 464 // If both the icon width and height are 0, then there is no icon in the |
465 // launcher for |window| or the icon is hidden in the overflow menu. If the | 465 // launcher for |window| or the icon is hidden in the overflow menu. If the |
466 // launcher is auto hidden, one of the height or width will be 0 but the | 466 // launcher is auto hidden, one of the height or width will be 0 but the |
467 // position in the launcher and the major dimension are still reported | 467 // position in the launcher and the major dimension are still reported |
468 // correctly and the window can be animated to the launcher item's light | 468 // correctly and the window can be animated to the launcher item's light |
469 // bar. | 469 // bar. |
470 if (item_rect.width() != 0 || item_rect.height() != 0) { | 470 if (item_rect.width() != 0 || item_rect.height() != 0) { |
471 internal::ShelfLayoutManager* layout_manager = | 471 ShelfLayoutManager* layout_manager = ShelfLayoutManager::ForShelf(window); |
472 internal::ShelfLayoutManager::ForShelf(window); | |
473 if (layout_manager->visibility_state() == SHELF_AUTO_HIDE) { | 472 if (layout_manager->visibility_state() == SHELF_AUTO_HIDE) { |
474 gfx::Rect shelf_bounds = shelf->shelf_widget()->GetWindowBoundsInScreen(); | 473 gfx::Rect shelf_bounds = shelf->shelf_widget()->GetWindowBoundsInScreen(); |
475 switch (layout_manager->GetAlignment()) { | 474 switch (layout_manager->GetAlignment()) { |
476 case SHELF_ALIGNMENT_BOTTOM: | 475 case SHELF_ALIGNMENT_BOTTOM: |
477 item_rect.set_y(shelf_bounds.y()); | 476 item_rect.set_y(shelf_bounds.y()); |
478 break; | 477 break; |
479 case SHELF_ALIGNMENT_LEFT: | 478 case SHELF_ALIGNMENT_LEFT: |
480 item_rect.set_x(shelf_bounds.right()); | 479 item_rect.set_x(shelf_bounds.right()); |
481 break; | 480 break; |
482 case SHELF_ALIGNMENT_RIGHT: | 481 case SHELF_ALIGNMENT_RIGHT: |
483 item_rect.set_x(shelf_bounds.x()); | 482 item_rect.set_x(shelf_bounds.x()); |
484 break; | 483 break; |
485 case SHELF_ALIGNMENT_TOP: | 484 case SHELF_ALIGNMENT_TOP: |
486 item_rect.set_y(shelf_bounds.bottom()); | 485 item_rect.set_y(shelf_bounds.bottom()); |
487 break; | 486 break; |
488 } | 487 } |
489 return item_rect; | 488 return item_rect; |
490 } | 489 } |
491 } | 490 } |
492 | 491 |
493 // Assume the shelf is overflowed, zoom off to the bottom right of the | 492 // Assume the shelf is overflowed, zoom off to the bottom right of the |
494 // work area. | 493 // work area. |
495 gfx::Rect work_area = | 494 gfx::Rect work_area = |
496 Shell::GetScreen()->GetDisplayNearestWindow(window).work_area(); | 495 Shell::GetScreen()->GetDisplayNearestWindow(window).work_area(); |
497 return gfx::Rect(work_area.right(), work_area.bottom(), 0, 0); | 496 return gfx::Rect(work_area.right(), work_area.bottom(), 0, 0); |
498 } | 497 } |
499 | 498 |
500 } // namespace ash | 499 } // namespace ash |
OLD | NEW |