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> |
11 | 11 |
12 #include "ash/aura/wm_window_aura.h" | 12 #include "ash/aura/wm_window_aura.h" |
13 #include "ash/common/shelf/shelf.h" | 13 #include "ash/common/shelf/shelf.h" |
14 #include "ash/common/shelf/shelf_layout_manager.h" | 14 #include "ash/common/shelf/shelf_layout_manager.h" |
15 #include "ash/common/shelf/shelf_widget.h" | 15 #include "ash/common/shelf/shelf_widget.h" |
| 16 #include "ash/common/shelf/wm_shelf.h" |
16 #include "ash/common/wm/window_animation_types.h" | 17 #include "ash/common/wm/window_animation_types.h" |
17 #include "ash/screen_util.h" | 18 #include "ash/screen_util.h" |
18 #include "ash/wm/window_util.h" | 19 #include "ash/wm/window_util.h" |
19 #include "ash/wm/workspace_controller.h" | 20 #include "ash/wm/workspace_controller.h" |
20 #include "base/command_line.h" | 21 #include "base/command_line.h" |
21 #include "base/compiler_specific.h" | 22 #include "base/compiler_specific.h" |
22 #include "base/logging.h" | 23 #include "base/logging.h" |
23 #include "base/message_loop/message_loop.h" | 24 #include "base/message_loop/message_loop.h" |
24 #include "base/stl_util.h" | 25 #include "base/stl_util.h" |
25 #include "base/time/time.h" | 26 #include "base/time/time.h" |
(...skipping 420 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
446 return item_rect; | 447 return item_rect; |
447 | 448 |
448 // If both the icon width and height are 0, then there is no icon in the | 449 // If both the icon width and height are 0, then there is no icon in the |
449 // launcher for |window|. If the launcher is auto hidden, one of the height or | 450 // launcher for |window|. If the launcher is auto hidden, one of the height or |
450 // width will be 0 but the position in the launcher and the major dimension | 451 // width will be 0 but the position in the launcher and the major dimension |
451 // are still reported correctly and the window can be animated to the launcher | 452 // are still reported correctly and the window can be animated to the launcher |
452 // item's light bar. | 453 // item's light bar. |
453 if (item_rect.width() != 0 || item_rect.height() != 0) { | 454 if (item_rect.width() != 0 || item_rect.height() != 0) { |
454 if (shelf->shelf_layout_manager()->visibility_state() == SHELF_AUTO_HIDE) { | 455 if (shelf->shelf_layout_manager()->visibility_state() == SHELF_AUTO_HIDE) { |
455 gfx::Rect shelf_bounds = shelf->shelf_widget()->GetWindowBoundsInScreen(); | 456 gfx::Rect shelf_bounds = shelf->shelf_widget()->GetWindowBoundsInScreen(); |
456 if (shelf->alignment() == SHELF_ALIGNMENT_LEFT) | 457 if (shelf->wm_shelf()->alignment() == SHELF_ALIGNMENT_LEFT) |
457 item_rect.set_x(shelf_bounds.right()); | 458 item_rect.set_x(shelf_bounds.right()); |
458 else if (shelf->alignment() == SHELF_ALIGNMENT_RIGHT) | 459 else if (shelf->wm_shelf()->alignment() == SHELF_ALIGNMENT_RIGHT) |
459 item_rect.set_x(shelf_bounds.x()); | 460 item_rect.set_x(shelf_bounds.x()); |
460 else | 461 else |
461 item_rect.set_y(shelf_bounds.y()); | 462 item_rect.set_y(shelf_bounds.y()); |
462 return item_rect; | 463 return item_rect; |
463 } | 464 } |
464 } | 465 } |
465 | 466 |
466 // Coming here, there is no visible icon of that shelf item and we zoom back | 467 // Coming here, there is no visible icon of that shelf item and we zoom back |
467 // to the location of the application launcher (which is fixed as first item | 468 // to the location of the application launcher (which is fixed as first item |
468 // of the shelf). | 469 // of the shelf). |
469 gfx::Rect work_area = | 470 gfx::Rect work_area = |
470 display::Screen::GetScreen()->GetDisplayNearestWindow(window).work_area(); | 471 display::Screen::GetScreen()->GetDisplayNearestWindow(window).work_area(); |
471 int ltr_adjusted_x = base::i18n::IsRTL() ? work_area.right() : work_area.x(); | 472 int ltr_adjusted_x = base::i18n::IsRTL() ? work_area.right() : work_area.x(); |
472 switch (shelf->alignment()) { | 473 switch (shelf->wm_shelf()->alignment()) { |
473 case SHELF_ALIGNMENT_BOTTOM: | 474 case SHELF_ALIGNMENT_BOTTOM: |
474 case SHELF_ALIGNMENT_BOTTOM_LOCKED: | 475 case SHELF_ALIGNMENT_BOTTOM_LOCKED: |
475 return gfx::Rect(ltr_adjusted_x, work_area.bottom(), 0, 0); | 476 return gfx::Rect(ltr_adjusted_x, work_area.bottom(), 0, 0); |
476 case SHELF_ALIGNMENT_LEFT: | 477 case SHELF_ALIGNMENT_LEFT: |
477 return gfx::Rect(work_area.x(), work_area.y(), 0, 0); | 478 return gfx::Rect(work_area.x(), work_area.y(), 0, 0); |
478 case SHELF_ALIGNMENT_RIGHT: | 479 case SHELF_ALIGNMENT_RIGHT: |
479 return gfx::Rect(work_area.right(), work_area.y(), 0, 0); | 480 return gfx::Rect(work_area.right(), work_area.y(), 0, 0); |
480 } | 481 } |
481 NOTREACHED(); | 482 NOTREACHED(); |
482 return gfx::Rect(); | 483 return gfx::Rect(); |
483 } | 484 } |
484 | 485 |
485 } // namespace ash | 486 } // namespace ash |
OLD | NEW |