Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(300)

Side by Side Diff: ash/wm/window_animations.cc

Issue 115113006: Rename Launcher to Shelf. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: more fixes Created 7 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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>
11 11
12 #include "ash/launcher/launcher.h"
13 #include "ash/screen_ash.h" 12 #include "ash/screen_ash.h"
13 #include "ash/shelf/shelf.h"
14 #include "ash/shelf/shelf_layout_manager.h" 14 #include "ash/shelf/shelf_layout_manager.h"
15 #include "ash/shelf/shelf_widget.h" 15 #include "ash/shelf/shelf_widget.h"
16 #include "ash/shell.h" 16 #include "ash/shell.h"
17 #include "ash/wm/window_util.h" 17 #include "ash/wm/window_util.h"
18 #include "ash/wm/workspace_controller.h" 18 #include "ash/wm/workspace_controller.h"
19 #include "base/command_line.h" 19 #include "base/command_line.h"
20 #include "base/compiler_specific.h" 20 #include "base/compiler_specific.h"
21 #include "base/logging.h" 21 #include "base/logging.h"
22 #include "base/message_loop/message_loop.h" 22 #include "base/message_loop/message_loop.h"
23 #include "base/stl_util.h" 23 #include "base/stl_util.h"
(...skipping 470 matching lines...) Expand 10 before | Expand all | Expand 10 after
494 type == LAYER_SCALE_ANIMATION_ABOVE ? kLayerScaleAboveSize : 494 type == LAYER_SCALE_ANIMATION_ABOVE ? kLayerScaleAboveSize :
495 kLayerScaleBelowSize; 495 kLayerScaleBelowSize;
496 gfx::Transform transform; 496 gfx::Transform transform;
497 transform.Translate(-layer->bounds().width() * (scale - 1.0f) / 2, 497 transform.Translate(-layer->bounds().width() * (scale - 1.0f) / 2,
498 -layer->bounds().height() * (scale - 1.0f) / 2); 498 -layer->bounds().height() * (scale - 1.0f) / 2);
499 transform.Scale(scale, scale); 499 transform.Scale(scale, scale);
500 layer->SetTransform(transform); 500 layer->SetTransform(transform);
501 } 501 }
502 502
503 gfx::Rect GetMinimizeAnimationTargetBoundsInScreen(aura::Window* window) { 503 gfx::Rect GetMinimizeAnimationTargetBoundsInScreen(aura::Window* window) {
504 Launcher* launcher = Launcher::ForWindow(window); 504 Shelf* shelf = Shelf::ForWindow(window);
505 // Shelf is created lazily and can be NULL. 505 // Shelf is created lazily and can be NULL.
506 if (!launcher) 506 if (!shelf)
507 return gfx::Rect(); 507 return gfx::Rect();
508 gfx::Rect item_rect = launcher->GetScreenBoundsOfItemIconForWindow(window); 508 gfx::Rect item_rect = shelf->GetScreenBoundsOfItemIconForWindow(window);
509 509
510 // The launcher item is visible and has an icon. 510 // The launcher item is visible and has an icon.
511 if (!item_rect.IsEmpty()) 511 if (!item_rect.IsEmpty())
512 return item_rect; 512 return item_rect;
513 513
514 // If both the icon width and height are 0, then there is no icon in the 514 // If both the icon width and height are 0, then there is no icon in the
515 // launcher for |window| or the icon is hidden in the overflow menu. If the 515 // launcher for |window| or the icon is hidden in the overflow menu. If the
516 // launcher is auto hidden, one of the height or width will be 0 but the 516 // launcher is auto hidden, one of the height or width will be 0 but the
517 // position in the launcher and the major dimension are still reported 517 // position in the launcher and the major dimension are still reported
518 // correctly and the window can be animated to the launcher item's light 518 // correctly and the window can be animated to the launcher item's light
519 // bar. 519 // bar.
520 if (item_rect.width() != 0 || item_rect.height() != 0) { 520 if (item_rect.width() != 0 || item_rect.height() != 0) {
521 internal::ShelfLayoutManager* layout_manager = 521 internal::ShelfLayoutManager* layout_manager =
522 internal::ShelfLayoutManager::ForLauncher(window); 522 internal::ShelfLayoutManager::ForShelf(window);
523 if (layout_manager->visibility_state() == SHELF_AUTO_HIDE) { 523 if (layout_manager->visibility_state() == SHELF_AUTO_HIDE) {
524 gfx::Rect shelf_bounds = 524 gfx::Rect shelf_bounds = shelf->shelf_widget()->GetWindowBoundsInScreen();
525 launcher->shelf_widget()->GetWindowBoundsInScreen();
526 switch (layout_manager->GetAlignment()) { 525 switch (layout_manager->GetAlignment()) {
527 case SHELF_ALIGNMENT_BOTTOM: 526 case SHELF_ALIGNMENT_BOTTOM:
528 item_rect.set_y(shelf_bounds.y()); 527 item_rect.set_y(shelf_bounds.y());
529 break; 528 break;
530 case SHELF_ALIGNMENT_LEFT: 529 case SHELF_ALIGNMENT_LEFT:
531 item_rect.set_x(shelf_bounds.right()); 530 item_rect.set_x(shelf_bounds.right());
532 break; 531 break;
533 case SHELF_ALIGNMENT_RIGHT: 532 case SHELF_ALIGNMENT_RIGHT:
534 item_rect.set_x(shelf_bounds.x()); 533 item_rect.set_x(shelf_bounds.x());
535 break; 534 break;
536 case SHELF_ALIGNMENT_TOP: 535 case SHELF_ALIGNMENT_TOP:
537 item_rect.set_y(shelf_bounds.bottom()); 536 item_rect.set_y(shelf_bounds.bottom());
538 break; 537 break;
539 } 538 }
540 return item_rect; 539 return item_rect;
541 } 540 }
542 } 541 }
543 542
544 // Assume the launcher is overflowed, zoom off to the bottom right of the 543 // Assume the shelf is overflowed, zoom off to the bottom right of the
545 // work area. 544 // work area.
546 gfx::Rect work_area = 545 gfx::Rect work_area =
547 Shell::GetScreen()->GetDisplayNearestWindow(window).work_area(); 546 Shell::GetScreen()->GetDisplayNearestWindow(window).work_area();
548 return gfx::Rect(work_area.right(), work_area.bottom(), 0, 0); 547 return gfx::Rect(work_area.right(), work_area.bottom(), 0, 0);
549 } 548 }
550 549
551 } // namespace ash 550 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698