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

Unified Diff: ash/rotator/window_rotation.cc

Issue 2550933002: Make all LayerAnimationElement::Create*Element return unique_ptr (Closed)
Patch Set: Complete inclusion Created 4 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 side-by-side diff with in-line comments
Download patch
Index: ash/rotator/window_rotation.cc
diff --git a/ash/rotator/window_rotation.cc b/ash/rotator/window_rotation.cc
index 2ee5d8f7c4350470da41e6c5ae4a3304ceea5342..94ee05ac3bbced2e074384904d4ac85abdee2032 100644
--- a/ash/rotator/window_rotation.cc
+++ b/ash/rotator/window_rotation.cc
@@ -4,6 +4,7 @@
#include "ash/rotator/window_rotation.h"
+#include "base/memory/ptr_util.h"
#include "base/time/time.h"
#include "ui/compositor/layer.h"
#include "ui/gfx/geometry/rect.h"
@@ -76,29 +77,30 @@ void WindowRotation::InitTransform(ui::Layer* layer) {
current_transform.TransformPoint(&new_pivot);
current_transform.TransformPoint(&new_origin_);
- std::unique_ptr<ui::InterpolatedTransform> rotation(
- new ui::InterpolatedTransformAboutPivot(
- old_pivot, new ui::InterpolatedRotation(0, degrees_)));
+ std::unique_ptr<ui::InterpolatedTransform> rotation =
+ base::MakeUnique<ui::InterpolatedTransformAboutPivot>(
+ old_pivot, base::MakeUnique<ui::InterpolatedRotation>(0, degrees_));
- std::unique_ptr<ui::InterpolatedTransform> translation(
- new ui::InterpolatedTranslation(
+ std::unique_ptr<ui::InterpolatedTransform> translation =
+ base::MakeUnique<ui::InterpolatedTranslation>(
gfx::PointF(), gfx::PointF(new_pivot.x() - old_pivot.x(),
- new_pivot.y() - old_pivot.y())));
+ new_pivot.y() - old_pivot.y()));
float scale_factor = 0.9f;
- std::unique_ptr<ui::InterpolatedTransform> scale_down(
- new ui::InterpolatedScale(1.0f, scale_factor, 0.0f, 0.5f));
+ std::unique_ptr<ui::InterpolatedTransform> scale_down =
+ base::MakeUnique<ui::InterpolatedScale>(1.0f, scale_factor, 0.0f, 0.5f);
- std::unique_ptr<ui::InterpolatedTransform> scale_up(
- new ui::InterpolatedScale(1.0f, 1.0f / scale_factor, 0.5f, 1.0f));
+ std::unique_ptr<ui::InterpolatedTransform> scale_up =
+ base::MakeUnique<ui::InterpolatedScale>(1.0f, 1.0f / scale_factor, 0.5f,
+ 1.0f);
interpolated_transform_.reset(
new ui::InterpolatedConstantTransform(current_transform));
- scale_up->SetChild(scale_down.release());
- translation->SetChild(scale_up.release());
- rotation->SetChild(translation.release());
- interpolated_transform_->SetChild(rotation.release());
+ scale_up->SetChild(std::move(scale_down));
+ translation->SetChild(std::move(scale_up));
+ rotation->SetChild(std::move(translation));
+ interpolated_transform_->SetChild(std::move(rotation));
}
void WindowRotation::OnStart(ui::LayerAnimationDelegate* delegate) {}

Powered by Google App Engine
This is Rietveld 408576698