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 452 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
463 return item_rect; | 463 return item_rect; |
464 | 464 |
465 // If both the icon width and height are 0, then there is no icon in the | 465 // If both the icon width and height are 0, then there is no icon in the |
466 // launcher for |window|. If the launcher is auto hidden, one of the height or | 466 // launcher for |window|. If the launcher is auto hidden, one of the height or |
467 // width will be 0 but the position in the launcher and the major dimension | 467 // width will be 0 but the position in the launcher and the major dimension |
468 // are still reported correctly and the window can be animated to the launcher | 468 // are still reported correctly and the window can be animated to the launcher |
469 // item's light bar. | 469 // item's light bar. |
470 if (item_rect.width() != 0 || item_rect.height() != 0) { | 470 if (item_rect.width() != 0 || item_rect.height() != 0) { |
471 if (shelf->shelf_layout_manager()->visibility_state() == SHELF_AUTO_HIDE) { | 471 if (shelf->shelf_layout_manager()->visibility_state() == SHELF_AUTO_HIDE) { |
472 gfx::Rect shelf_bounds = shelf->shelf_widget()->GetWindowBoundsInScreen(); | 472 gfx::Rect shelf_bounds = shelf->shelf_widget()->GetWindowBoundsInScreen(); |
473 if (shelf->alignment() == wm::SHELF_ALIGNMENT_LEFT) | 473 if (shelf->alignment() == SHELF_ALIGNMENT_LEFT) |
474 item_rect.set_x(shelf_bounds.right()); | 474 item_rect.set_x(shelf_bounds.right()); |
475 else if (shelf->alignment() == wm::SHELF_ALIGNMENT_RIGHT) | 475 else if (shelf->alignment() == SHELF_ALIGNMENT_RIGHT) |
476 item_rect.set_x(shelf_bounds.x()); | 476 item_rect.set_x(shelf_bounds.x()); |
477 else | 477 else |
478 item_rect.set_y(shelf_bounds.y()); | 478 item_rect.set_y(shelf_bounds.y()); |
479 return item_rect; | 479 return item_rect; |
480 } | 480 } |
481 } | 481 } |
482 | 482 |
483 // Coming here, there is no visible icon of that shelf item and we zoom back | 483 // Coming here, there is no visible icon of that shelf item and we zoom back |
484 // to the location of the application launcher (which is fixed as first item | 484 // to the location of the application launcher (which is fixed as first item |
485 // of the shelf). | 485 // of the shelf). |
486 gfx::Rect work_area = | 486 gfx::Rect work_area = |
487 display::Screen::GetScreen()->GetDisplayNearestWindow(window).work_area(); | 487 display::Screen::GetScreen()->GetDisplayNearestWindow(window).work_area(); |
488 int ltr_adjusted_x = base::i18n::IsRTL() ? work_area.right() : work_area.x(); | 488 int ltr_adjusted_x = base::i18n::IsRTL() ? work_area.right() : work_area.x(); |
489 return shelf->SelectValueForShelfAlignment( | 489 return shelf->SelectValueForShelfAlignment( |
490 gfx::Rect(ltr_adjusted_x, work_area.bottom(), 0, 0), | 490 gfx::Rect(ltr_adjusted_x, work_area.bottom(), 0, 0), |
491 gfx::Rect(work_area.x(), work_area.y(), 0, 0), | 491 gfx::Rect(work_area.x(), work_area.y(), 0, 0), |
492 gfx::Rect(work_area.right(), work_area.y(), 0, 0)); | 492 gfx::Rect(work_area.right(), work_area.y(), 0, 0)); |
493 } | 493 } |
494 | 494 |
495 } // namespace ash | 495 } // namespace ash |
OLD | NEW |