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

Unified Diff: chrome/browser/android/vr_shell/ui_scene.cc

Issue 2696293002: Adds in-out easing type. (Closed)
Patch Set: MakeUnique, default value, comments 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/android/vr_shell/ui_scene.cc
diff --git a/chrome/browser/android/vr_shell/ui_scene.cc b/chrome/browser/android/vr_shell/ui_scene.cc
index 020e307e94c255163fd4d3d8fac6f71025c993ce..80c4d5bb4e3b0c322d58f7d795e7b8d8b75926f7 100644
--- a/chrome/browser/android/vr_shell/ui_scene.cc
+++ b/chrome/browser/android/vr_shell/ui_scene.cc
@@ -150,7 +150,7 @@ std::unique_ptr<easing::Easing> ParseEasing(
switch (easingType) {
case easing::EasingType::LINEAR: {
- result.reset(new easing::Linear());
+ result = base::MakeUnique<easing::Linear>();
break;
}
case easing::EasingType::CUBICBEZIER: {
@@ -159,19 +159,25 @@ std::unique_ptr<easing::Easing> ParseEasing(
CHECK(dict.GetDouble("p1y", &p1y));
CHECK(dict.GetDouble("p2x", &p2x));
CHECK(dict.GetDouble("p2y", &p2y));
- result.reset(new easing::CubicBezier(p1x, p1y, p2x, p2y));
+ result = base::MakeUnique<easing::CubicBezier>(p1x, p1y, p2x, p2y);
break;
}
case easing::EasingType::EASEIN: {
double pow;
CHECK(dict.GetDouble("pow", &pow));
- result.reset(new easing::EaseIn(pow));
+ result = base::MakeUnique<easing::EaseIn>(pow);
break;
}
case easing::EasingType::EASEOUT: {
double pow;
CHECK(dict.GetDouble("pow", &pow));
- result.reset(new easing::EaseOut(pow));
+ result = base::MakeUnique<easing::EaseOut>(pow);
+ break;
+ }
+ case easing::EasingType::EASEINOUT: {
+ double pow;
+ CHECK(dict.GetDouble("pow", &pow));
+ result = base::MakeUnique<easing::EaseInOut>(pow);
break;
}
}
@@ -227,7 +233,7 @@ void UiScene::AddUiElementFromDict(const base::DictionaryValue& dict) {
CHECK(dict.GetInteger("id", &id));
CHECK_EQ(GetUiElementById(id), nullptr);
- std::unique_ptr<ContentRectangle> element(new ContentRectangle);
+ auto element = base::MakeUnique<ContentRectangle>();
element->id = id;
ApplyDictToElement(dict, element.get());
@@ -302,10 +308,9 @@ void UiScene::AddAnimationFromDict(const base::DictionaryValue& dict,
ContentRectangle* element = GetUiElementById(element_id);
CHECK_NE(element, nullptr);
- element->animations.emplace_back(std::unique_ptr<Animation>(
- new Animation(
- animation_id, static_cast<Animation::Property>(property),
- std::move(easing), from, to, start, duration)));
+ element->animations.emplace_back(base::MakeUnique<Animation>(
+ animation_id, static_cast<Animation::Property>(property),
+ std::move(easing), from, to, start, duration));
}
void UiScene::RemoveAnimation(int element_id, int animation_id) {

Powered by Google App Engine
This is Rietveld 408576698