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

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

Issue 2660873002: Move two utility functions from ash/screen_util.h to ui/wm/core/coordinate_conversion.h (Closed)
Patch Set: rebase Created 3 years, 10 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
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 #include <algorithm> 8 #include <algorithm>
9 #include <utility> 9 #include <utility>
10 #include <vector> 10 #include <vector>
11 11
12 #include "ash/common/shelf/wm_shelf.h" 12 #include "ash/common/shelf/wm_shelf.h"
13 #include "ash/common/wm/window_animation_types.h" 13 #include "ash/common/wm/window_animation_types.h"
14 #include "ash/common/wm/workspace_controller.h" 14 #include "ash/common/wm/workspace_controller.h"
15 #include "ash/common/wm_window.h" 15 #include "ash/common/wm_window.h"
16 #include "ash/screen_util.h"
17 #include "ash/wm/window_util.h" 16 #include "ash/wm/window_util.h"
18 #include "base/i18n/rtl.h" 17 #include "base/i18n/rtl.h"
19 #include "base/logging.h" 18 #include "base/logging.h"
20 #include "base/memory/ptr_util.h" 19 #include "base/memory/ptr_util.h"
21 #include "base/stl_util.h" 20 #include "base/stl_util.h"
22 #include "base/time/time.h" 21 #include "base/time/time.h"
23 #include "ui/aura/client/aura_constants.h" 22 #include "ui/aura/client/aura_constants.h"
24 #include "ui/aura/window.h" 23 #include "ui/aura/window.h"
25 #include "ui/aura/window_observer.h" 24 #include "ui/aura/window_observer.h"
26 #include "ui/base/class_property.h" 25 #include "ui/base/class_property.h"
27 #include "ui/compositor/compositor_observer.h" 26 #include "ui/compositor/compositor_observer.h"
28 #include "ui/compositor/layer.h" 27 #include "ui/compositor/layer.h"
29 #include "ui/compositor/layer_animation_observer.h" 28 #include "ui/compositor/layer_animation_observer.h"
30 #include "ui/compositor/layer_animation_sequence.h" 29 #include "ui/compositor/layer_animation_sequence.h"
31 #include "ui/compositor/layer_animator.h" 30 #include "ui/compositor/layer_animator.h"
32 #include "ui/compositor/layer_tree_owner.h" 31 #include "ui/compositor/layer_tree_owner.h"
33 #include "ui/compositor/scoped_layer_animation_settings.h" 32 #include "ui/compositor/scoped_layer_animation_settings.h"
34 #include "ui/display/display.h" 33 #include "ui/display/display.h"
35 #include "ui/display/screen.h" 34 #include "ui/display/screen.h"
36 #include "ui/gfx/interpolated_transform.h" 35 #include "ui/gfx/interpolated_transform.h"
37 #include "ui/gfx/transform.h" 36 #include "ui/gfx/transform.h"
37 #include "ui/wm/core/coordinate_conversion.h"
38 #include "ui/wm/core/window_util.h" 38 #include "ui/wm/core/window_util.h"
39 39
40 namespace ash { 40 namespace ash {
41 namespace { 41 namespace {
42 42
43 const int kLayerAnimationsForMinimizeDurationMS = 200; 43 const int kLayerAnimationsForMinimizeDurationMS = 200;
44 44
45 // Durations for the cross-fade animation, in milliseconds. 45 // Durations for the cross-fade animation, in milliseconds.
46 const float kCrossFadeDurationMinMs = 200.f; 46 const float kCrossFadeDurationMinMs = 200.f;
47 const float kCrossFadeDurationMaxMs = 400.f; 47 const float kCrossFadeDurationMaxMs = 400.f;
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 86
87 } // namespace 87 } // namespace
88 88
89 const int kCrossFadeDurationMS = 200; 89 const int kCrossFadeDurationMS = 200;
90 90
91 void AddLayerAnimationsForMinimize(aura::Window* window, bool show) { 91 void AddLayerAnimationsForMinimize(aura::Window* window, bool show) {
92 // Recalculate the transform at restore time since the launcher item may have 92 // Recalculate the transform at restore time since the launcher item may have
93 // moved while the window was minimized. 93 // moved while the window was minimized.
94 gfx::Rect bounds = window->bounds(); 94 gfx::Rect bounds = window->bounds();
95 gfx::Rect target_bounds = GetMinimizeAnimationTargetBoundsInScreen(window); 95 gfx::Rect target_bounds = GetMinimizeAnimationTargetBoundsInScreen(window);
96 target_bounds = 96 ::wm::ConvertRectFromScreen(window->parent(), &target_bounds);
97 ScreenUtil::ConvertRectFromScreen(window->parent(), target_bounds);
98 97
99 float scale_x = static_cast<float>(target_bounds.width()) / bounds.width(); 98 float scale_x = static_cast<float>(target_bounds.width()) / bounds.width();
100 float scale_y = static_cast<float>(target_bounds.height()) / bounds.height(); 99 float scale_y = static_cast<float>(target_bounds.height()) / bounds.height();
101 100
102 std::unique_ptr<ui::InterpolatedTransform> scale = 101 std::unique_ptr<ui::InterpolatedTransform> scale =
103 base::MakeUnique<ui::InterpolatedScale>( 102 base::MakeUnique<ui::InterpolatedScale>(
104 gfx::Point3F(1, 1, 1), gfx::Point3F(scale_x, scale_y, 1)); 103 gfx::Point3F(1, 1, 1), gfx::Point3F(scale_x, scale_y, 1));
105 104
106 std::unique_ptr<ui::InterpolatedTransform> translation = 105 std::unique_ptr<ui::InterpolatedTransform> translation =
107 base::MakeUnique<ui::InterpolatedTranslation>( 106 base::MakeUnique<ui::InterpolatedTranslation>(
(...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after
452 case SHELF_ALIGNMENT_LEFT: 451 case SHELF_ALIGNMENT_LEFT:
453 return gfx::Rect(work_area.x(), work_area.y(), 0, 0); 452 return gfx::Rect(work_area.x(), work_area.y(), 0, 0);
454 case SHELF_ALIGNMENT_RIGHT: 453 case SHELF_ALIGNMENT_RIGHT:
455 return gfx::Rect(work_area.right(), work_area.y(), 0, 0); 454 return gfx::Rect(work_area.right(), work_area.y(), 0, 0);
456 } 455 }
457 NOTREACHED(); 456 NOTREACHED();
458 return gfx::Rect(); 457 return gfx::Rect();
459 } 458 }
460 459
461 } // namespace ash 460 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698