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

Side by Side Diff: ash/rotator/window_rotation.cc

Issue 1867223004: Convert //ash from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: address comments Created 4 years, 8 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/rotator/window_rotation.h" 5 #include "ash/rotator/window_rotation.h"
6 6
7 #include "base/time/time.h" 7 #include "base/time/time.h"
8 #include "ui/compositor/layer.h" 8 #include "ui/compositor/layer.h"
9 #include "ui/gfx/geometry/rect.h" 9 #include "ui/gfx/geometry/rect.h"
10 #include "ui/gfx/interpolated_transform.h" 10 #include "ui/gfx/interpolated_transform.h"
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 new_pivot = old_pivot = gfx::Point(width / 2, height / 2); 70 new_pivot = old_pivot = gfx::Point(width / 2, height / 2);
71 new_origin_.SetPoint(width, height); 71 new_origin_.SetPoint(width, height);
72 break; 72 break;
73 } 73 }
74 74
75 // Convert points to world space. 75 // Convert points to world space.
76 current_transform.TransformPoint(&old_pivot); 76 current_transform.TransformPoint(&old_pivot);
77 current_transform.TransformPoint(&new_pivot); 77 current_transform.TransformPoint(&new_pivot);
78 current_transform.TransformPoint(&new_origin_); 78 current_transform.TransformPoint(&new_origin_);
79 79
80 scoped_ptr<ui::InterpolatedTransform> rotation( 80 std::unique_ptr<ui::InterpolatedTransform> rotation(
81 new ui::InterpolatedTransformAboutPivot( 81 new ui::InterpolatedTransformAboutPivot(
82 old_pivot, new ui::InterpolatedRotation(0, degrees_))); 82 old_pivot, new ui::InterpolatedRotation(0, degrees_)));
83 83
84 scoped_ptr<ui::InterpolatedTransform> translation( 84 std::unique_ptr<ui::InterpolatedTransform> translation(
85 new ui::InterpolatedTranslation( 85 new ui::InterpolatedTranslation(
86 gfx::PointF(), gfx::PointF(new_pivot.x() - old_pivot.x(), 86 gfx::PointF(), gfx::PointF(new_pivot.x() - old_pivot.x(),
87 new_pivot.y() - old_pivot.y()))); 87 new_pivot.y() - old_pivot.y())));
88 88
89 float scale_factor = 0.9f; 89 float scale_factor = 0.9f;
90 scoped_ptr<ui::InterpolatedTransform> scale_down( 90 std::unique_ptr<ui::InterpolatedTransform> scale_down(
91 new ui::InterpolatedScale(1.0f, scale_factor, 0.0f, 0.5f)); 91 new ui::InterpolatedScale(1.0f, scale_factor, 0.0f, 0.5f));
92 92
93 scoped_ptr<ui::InterpolatedTransform> scale_up( 93 std::unique_ptr<ui::InterpolatedTransform> scale_up(
94 new ui::InterpolatedScale(1.0f, 1.0f / scale_factor, 0.5f, 1.0f)); 94 new ui::InterpolatedScale(1.0f, 1.0f / scale_factor, 0.5f, 1.0f));
95 95
96 interpolated_transform_.reset( 96 interpolated_transform_.reset(
97 new ui::InterpolatedConstantTransform(current_transform)); 97 new ui::InterpolatedConstantTransform(current_transform));
98 98
99 scale_up->SetChild(scale_down.release()); 99 scale_up->SetChild(scale_down.release());
100 translation->SetChild(scale_up.release()); 100 translation->SetChild(scale_up.release());
101 rotation->SetChild(translation.release()); 101 rotation->SetChild(translation.release());
102 interpolated_transform_->SetChild(rotation.release()); 102 interpolated_transform_->SetChild(rotation.release());
103 } 103 }
104 104
105 void WindowRotation::OnStart(ui::LayerAnimationDelegate* delegate) { 105 void WindowRotation::OnStart(ui::LayerAnimationDelegate* delegate) {
106 } 106 }
107 107
108 bool WindowRotation::OnProgress(double t, 108 bool WindowRotation::OnProgress(double t,
109 ui::LayerAnimationDelegate* delegate) { 109 ui::LayerAnimationDelegate* delegate) {
110 delegate->SetTransformFromAnimation(interpolated_transform_->Interpolate(t)); 110 delegate->SetTransformFromAnimation(interpolated_transform_->Interpolate(t));
111 return true; 111 return true;
112 } 112 }
113 113
114 void WindowRotation::OnGetTarget(TargetValue* target) const { 114 void WindowRotation::OnGetTarget(TargetValue* target) const {
115 target->transform = interpolated_transform_->Interpolate(1.0); 115 target->transform = interpolated_transform_->Interpolate(1.0);
116 } 116 }
117 117
118 void WindowRotation::OnAbort(ui::LayerAnimationDelegate* delegate) { 118 void WindowRotation::OnAbort(ui::LayerAnimationDelegate* delegate) {
119 } 119 }
120 120
121 } // namespace ash 121 } // namespace ash
OLDNEW
« no previous file with comments | « ash/rotator/window_rotation.h ('k') | ash/shelf/scoped_observer_with_duplicated_sources_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698