| 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 #include <algorithm> | 8 #include <algorithm> |
| 9 #include <utility> | 9 #include <utility> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 448 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 459 | 459 |
| 460 // The launcher item is visible and has an icon. | 460 // The launcher item is visible and has an icon. |
| 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|. If the launcher is auto hidden, one of the height or | 465 // launcher for |window|. If the launcher is auto hidden, one of the height or |
| 466 // width will be 0 but the position in the launcher and the major dimension | 466 // width will be 0 but the position in the launcher and the major dimension |
| 467 // are still reported correctly and the window can be animated to the launcher | 467 // are still reported correctly and the window can be animated to the launcher |
| 468 // item's light bar. | 468 // item's light bar. |
| 469 ShelfLayoutManager* layout_manager = ShelfLayoutManager::ForShelf(window); | 469 ShelfLayoutManager* layout_manager = |
| 470 shelf->shelf_widget()->shelf_layout_manager(); |
| 470 if (item_rect.width() != 0 || item_rect.height() != 0) { | 471 if (item_rect.width() != 0 || item_rect.height() != 0) { |
| 471 if (layout_manager->visibility_state() == SHELF_AUTO_HIDE) { | 472 if (layout_manager->visibility_state() == SHELF_AUTO_HIDE) { |
| 472 gfx::Rect shelf_bounds = shelf->shelf_widget()->GetWindowBoundsInScreen(); | 473 gfx::Rect shelf_bounds = shelf->shelf_widget()->GetWindowBoundsInScreen(); |
| 473 switch (layout_manager->GetAlignment()) { | 474 switch (layout_manager->GetAlignment()) { |
| 474 case SHELF_ALIGNMENT_BOTTOM: | 475 case SHELF_ALIGNMENT_BOTTOM: |
| 475 item_rect.set_y(shelf_bounds.y()); | 476 item_rect.set_y(shelf_bounds.y()); |
| 476 break; | 477 break; |
| 477 case SHELF_ALIGNMENT_LEFT: | 478 case SHELF_ALIGNMENT_LEFT: |
| 478 item_rect.set_x(shelf_bounds.right()); | 479 item_rect.set_x(shelf_bounds.right()); |
| 479 break; | 480 break; |
| (...skipping 22 matching lines...) Expand all Loading... |
| 502 case SHELF_ALIGNMENT_LEFT: | 503 case SHELF_ALIGNMENT_LEFT: |
| 503 return gfx::Rect(work_area.x(), work_area.y(), 0, 0); | 504 return gfx::Rect(work_area.x(), work_area.y(), 0, 0); |
| 504 case SHELF_ALIGNMENT_RIGHT: | 505 case SHELF_ALIGNMENT_RIGHT: |
| 505 return gfx::Rect(work_area.right(), work_area.y(), 0, 0); | 506 return gfx::Rect(work_area.right(), work_area.y(), 0, 0); |
| 506 } | 507 } |
| 507 NOTREACHED(); | 508 NOTREACHED(); |
| 508 return gfx::Rect(); | 509 return gfx::Rect(); |
| 509 } | 510 } |
| 510 | 511 |
| 511 } // namespace ash | 512 } // namespace ash |
| OLD | NEW |