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

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

Issue 2550933002: Make all LayerAnimationElement::Create*Element return unique_ptr (Closed)
Patch Set: More change and typo fix 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 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/session_state_animator_impl.h" 5 #include "ash/wm/session_state_animator_impl.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "ash/common/wm/wm_window_animations.h" 9 #include "ash/common/wm/wm_window_animations.h"
10 #include "ash/public/cpp/shell_window_ids.h" 10 #include "ash/public/cpp/shell_window_ids.h"
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after
247 // Starts grayscale/brightness animation for |window| over |duration|. Target 247 // Starts grayscale/brightness animation for |window| over |duration|. Target
248 // value for both grayscale and brightness are specified by |target|. 248 // value for both grayscale and brightness are specified by |target|.
249 void StartGrayscaleBrightnessAnimationForWindow( 249 void StartGrayscaleBrightnessAnimationForWindow(
250 aura::Window* window, 250 aura::Window* window,
251 float target, 251 float target,
252 base::TimeDelta duration, 252 base::TimeDelta duration,
253 gfx::Tween::Type tween_type, 253 gfx::Tween::Type tween_type,
254 ui::LayerAnimationObserver* observer) { 254 ui::LayerAnimationObserver* observer) {
255 ui::LayerAnimator* animator = window->layer()->GetAnimator(); 255 ui::LayerAnimator* animator = window->layer()->GetAnimator();
256 256
257 std::unique_ptr<ui::LayerAnimationSequence> brightness_sequence( 257 std::unique_ptr<ui::LayerAnimationSequence> brightness_sequence =
258 new ui::LayerAnimationSequence()); 258 base::MakeUnique<ui::LayerAnimationSequence>();
259 std::unique_ptr<ui::LayerAnimationSequence> grayscale_sequence( 259 std::unique_ptr<ui::LayerAnimationSequence> grayscale_sequence =
260 new ui::LayerAnimationSequence()); 260 base::MakeUnique<ui::LayerAnimationSequence>();
261 261
262 std::unique_ptr<ui::LayerAnimationElement> brightness_element( 262 std::unique_ptr<ui::LayerAnimationElement> brightness_element =
263 ui::LayerAnimationElement::CreateBrightnessElement(target, duration)); 263 ui::LayerAnimationElement::CreateBrightnessElement(target, duration);
264 brightness_element->set_tween_type(tween_type); 264 brightness_element->set_tween_type(tween_type);
265 brightness_sequence->AddElement(brightness_element.release()); 265 brightness_sequence->AddElement(std::move(brightness_element));
266 266
267 std::unique_ptr<ui::LayerAnimationElement> grayscale_element( 267 std::unique_ptr<ui::LayerAnimationElement> grayscale_element =
268 ui::LayerAnimationElement::CreateGrayscaleElement(target, duration)); 268 ui::LayerAnimationElement::CreateGrayscaleElement(target, duration);
269 grayscale_element->set_tween_type(tween_type); 269 grayscale_element->set_tween_type(tween_type);
270 grayscale_sequence->AddElement(grayscale_element.release()); 270 grayscale_sequence->AddElement(std::move(grayscale_element));
271 271
272 std::vector<ui::LayerAnimationSequence*> animations; 272 std::vector<ui::LayerAnimationSequence*> animations;
273 animations.push_back(brightness_sequence.release()); 273 animations.push_back(brightness_sequence.release());
274 animations.push_back(grayscale_sequence.release()); 274 animations.push_back(grayscale_sequence.release());
275 275
276 if (observer) 276 if (observer)
277 animations[0]->AddObserver(observer); 277 animations[0]->AddObserver(observer);
278 278
279 animator->set_preemption_strategy( 279 animator->set_preemption_strategy(
280 ui::LayerAnimator::IMMEDIATELY_ANIMATE_TO_NEW_TARGET); 280 ui::LayerAnimator::IMMEDIATELY_ANIMATE_TO_NEW_TARGET);
(...skipping 370 matching lines...) Expand 10 before | Expand all | Expand 10 after
651 gfx::Tween::EASE_IN, observer); 651 gfx::Tween::EASE_IN, observer);
652 break; 652 break;
653 case ANIMATION_UNDO_GRAYSCALE_BRIGHTNESS: 653 case ANIMATION_UNDO_GRAYSCALE_BRIGHTNESS:
654 StartGrayscaleBrightnessAnimationForWindow( 654 StartGrayscaleBrightnessAnimationForWindow(
655 window, 0.0, duration, gfx::Tween::EASE_IN_OUT, observer); 655 window, 0.0, duration, gfx::Tween::EASE_IN_OUT, observer);
656 break; 656 break;
657 } 657 }
658 } 658 }
659 659
660 } // namespace ash 660 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698