| 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 451 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 if (item_rect.width() != 0 || item_rect.height() != 0) { | 469 if (item_rect.width() != 0 || item_rect.height() != 0) { |
| 470 if (shelf->shelf_layout_manager()->visibility_state() == SHELF_AUTO_HIDE) { | 470 if (shelf->shelf_layout_manager()->visibility_state() == SHELF_AUTO_HIDE) { |
| 471 gfx::Rect shelf_bounds = shelf->shelf_widget()->GetWindowBoundsInScreen(); | 471 gfx::Rect shelf_bounds = shelf->shelf_widget()->GetWindowBoundsInScreen(); |
| 472 if (shelf->alignment() == SHELF_ALIGNMENT_LEFT) | 472 if (shelf->alignment() == wm::SHELF_ALIGNMENT_LEFT) |
| 473 item_rect.set_x(shelf_bounds.right()); | 473 item_rect.set_x(shelf_bounds.right()); |
| 474 else if (shelf->alignment() == SHELF_ALIGNMENT_RIGHT) | 474 else if (shelf->alignment() == wm::SHELF_ALIGNMENT_RIGHT) |
| 475 item_rect.set_x(shelf_bounds.x()); | 475 item_rect.set_x(shelf_bounds.x()); |
| 476 else | 476 else |
| 477 item_rect.set_y(shelf_bounds.y()); | 477 item_rect.set_y(shelf_bounds.y()); |
| 478 return item_rect; | 478 return item_rect; |
| 479 } | 479 } |
| 480 } | 480 } |
| 481 | 481 |
| 482 // Coming here, there is no visible icon of that shelf item and we zoom back | 482 // Coming here, there is no visible icon of that shelf item and we zoom back |
| 483 // to the location of the application launcher (which is fixed as first item | 483 // to the location of the application launcher (which is fixed as first item |
| 484 // of the shelf). | 484 // of the shelf). |
| 485 gfx::Rect work_area = | 485 gfx::Rect work_area = |
| 486 gfx::Screen::GetScreen()->GetDisplayNearestWindow(window).work_area(); | 486 gfx::Screen::GetScreen()->GetDisplayNearestWindow(window).work_area(); |
| 487 int ltr_adjusted_x = base::i18n::IsRTL() ? work_area.right() : work_area.x(); | 487 int ltr_adjusted_x = base::i18n::IsRTL() ? work_area.right() : work_area.x(); |
| 488 return shelf->SelectValueForShelfAlignment( | 488 return shelf->SelectValueForShelfAlignment( |
| 489 gfx::Rect(ltr_adjusted_x, work_area.bottom(), 0, 0), | 489 gfx::Rect(ltr_adjusted_x, work_area.bottom(), 0, 0), |
| 490 gfx::Rect(work_area.x(), work_area.y(), 0, 0), | 490 gfx::Rect(work_area.x(), work_area.y(), 0, 0), |
| 491 gfx::Rect(work_area.right(), work_area.y(), 0, 0)); | 491 gfx::Rect(work_area.right(), work_area.y(), 0, 0)); |
| 492 } | 492 } |
| 493 | 493 |
| 494 } // namespace ash | 494 } // namespace ash |
| OLD | NEW |