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

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

Issue 21966005: Removes workspace_animations.(h,cc) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 7 years, 4 months 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
« no previous file with comments | « ash/wm/window_animations.h ('k') | ash/wm/workspace/workspace_animations.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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" 12 #include "ash/launcher/launcher.h"
13 #include "ash/screen_ash.h" 13 #include "ash/screen_ash.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/workspace_animations.h"
19 #include "ash/wm/workspace_controller.h" 18 #include "ash/wm/workspace_controller.h"
20 #include "base/command_line.h" 19 #include "base/command_line.h"
21 #include "base/compiler_specific.h" 20 #include "base/compiler_specific.h"
22 #include "base/logging.h" 21 #include "base/logging.h"
23 #include "base/message_loop/message_loop.h" 22 #include "base/message_loop/message_loop.h"
24 #include "base/stl_util.h" 23 #include "base/stl_util.h"
25 #include "base/time/time.h" 24 #include "base/time/time.h"
26 #include "ui/aura/client/aura_constants.h" 25 #include "ui/aura/client/aura_constants.h"
27 #include "ui/aura/window.h" 26 #include "ui/aura/window.h"
28 #include "ui/aura/window_observer.h" 27 #include "ui/aura/window_observer.h"
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 // Scales for AshWindow above/below current workspace. 65 // Scales for AshWindow above/below current workspace.
67 const float kLayerScaleAboveSize = 1.1f; 66 const float kLayerScaleAboveSize = 1.1f;
68 const float kLayerScaleBelowSize = .9f; 67 const float kLayerScaleBelowSize = .9f;
69 68
70 int64 Round64(float f) { 69 int64 Round64(float f) {
71 return static_cast<int64>(f + 0.5f); 70 return static_cast<int64>(f + 0.5f);
72 } 71 }
73 72
74 } // namespace 73 } // namespace
75 74
75 const int kCrossFadeDurationMS = 200;
76
76 void AddLayerAnimationsForMinimize(aura::Window* window, bool show) { 77 void AddLayerAnimationsForMinimize(aura::Window* window, bool show) {
77 // Recalculate the transform at restore time since the launcher item may have 78 // Recalculate the transform at restore time since the launcher item may have
78 // moved while the window was minimized. 79 // moved while the window was minimized.
79 gfx::Rect bounds = window->bounds(); 80 gfx::Rect bounds = window->bounds();
80 gfx::Rect target_bounds = GetMinimizeAnimationTargetBoundsInScreen(window); 81 gfx::Rect target_bounds = GetMinimizeAnimationTargetBoundsInScreen(window);
81 target_bounds = 82 target_bounds =
82 ScreenAsh::ConvertRectFromScreen(window->parent(), target_bounds); 83 ScreenAsh::ConvertRectFromScreen(window->parent(), target_bounds);
83 84
84 float scale_x = static_cast<float>(target_bounds.width()) / bounds.width(); 85 float scale_x = static_cast<float>(target_bounds.width()) / bounds.width();
85 float scale_y = static_cast<float>(target_bounds.height()) / bounds.height(); 86 float scale_y = static_cast<float>(target_bounds.height()) / bounds.height();
(...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after
429 base::TimeDelta GetCrossFadeDuration(const gfx::Rect& old_bounds, 430 base::TimeDelta GetCrossFadeDuration(const gfx::Rect& old_bounds,
430 const gfx::Rect& new_bounds) { 431 const gfx::Rect& new_bounds) {
431 if (views::corewm::WindowAnimationsDisabled(NULL)) 432 if (views::corewm::WindowAnimationsDisabled(NULL))
432 return base::TimeDelta(); 433 return base::TimeDelta();
433 434
434 int old_area = old_bounds.width() * old_bounds.height(); 435 int old_area = old_bounds.width() * old_bounds.height();
435 int new_area = new_bounds.width() * new_bounds.height(); 436 int new_area = new_bounds.width() * new_bounds.height();
436 int max_area = std::max(old_area, new_area); 437 int max_area = std::max(old_area, new_area);
437 // Avoid divide by zero. 438 // Avoid divide by zero.
438 if (max_area == 0) 439 if (max_area == 0)
439 return base::TimeDelta::FromMilliseconds(internal::kWorkspaceSwitchTimeMS); 440 return base::TimeDelta::FromMilliseconds(kCrossFadeDurationMS);
440 441
441 int delta_area = std::abs(old_area - new_area); 442 int delta_area = std::abs(old_area - new_area);
442 // If the area didn't change, the animation is instantaneous. 443 // If the area didn't change, the animation is instantaneous.
443 if (delta_area == 0) 444 if (delta_area == 0)
444 return base::TimeDelta::FromMilliseconds(internal::kWorkspaceSwitchTimeMS); 445 return base::TimeDelta::FromMilliseconds(kCrossFadeDurationMS);
445 446
446 float factor = 447 float factor =
447 static_cast<float>(delta_area) / static_cast<float>(max_area); 448 static_cast<float>(delta_area) / static_cast<float>(max_area);
448 const float kRange = kCrossFadeDurationMaxMs - kCrossFadeDurationMinMs; 449 const float kRange = kCrossFadeDurationMaxMs - kCrossFadeDurationMinMs;
449 return base::TimeDelta::FromMilliseconds( 450 return base::TimeDelta::FromMilliseconds(
450 Round64(kCrossFadeDurationMinMs + (factor * kRange))); 451 Round64(kCrossFadeDurationMinMs + (factor * kRange)));
451 } 452 }
452 453
453 bool AnimateOnChildWindowVisibilityChanged(aura::Window* window, bool visible) { 454 bool AnimateOnChildWindowVisibilityChanged(aura::Window* window, bool visible) {
454 if (views::corewm::WindowAnimationsDisabled(window)) 455 if (views::corewm::WindowAnimationsDisabled(window))
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
550 } 551 }
551 552
552 // Assume the launcher is overflowed, zoom off to the bottom right of the 553 // Assume the launcher is overflowed, zoom off to the bottom right of the
553 // work area. 554 // work area.
554 gfx::Rect work_area = 555 gfx::Rect work_area =
555 Shell::GetScreen()->GetDisplayNearestWindow(window).work_area(); 556 Shell::GetScreen()->GetDisplayNearestWindow(window).work_area();
556 return gfx::Rect(work_area.right(), work_area.bottom(), 0, 0); 557 return gfx::Rect(work_area.right(), work_area.bottom(), 0, 0);
557 } 558 }
558 559
559 } // namespace ash 560 } // namespace ash
OLDNEW
« no previous file with comments | « ash/wm/window_animations.h ('k') | ash/wm/workspace/workspace_animations.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698