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

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

Issue 2550933002: Make all LayerAnimationElement::Create*Element return unique_ptr (Closed)
Patch Set: Make all LayerAnimationElement::Create*Element return unique_ptr 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
« no previous file with comments | « no previous file | ash/wm/window_animations.cc » ('j') | ash/wm/window_animations.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 auto brightness_sequence = base::MakeUnique<ui::LayerAnimationSequence>();
258 new ui::LayerAnimationSequence()); 258 auto grayscale_sequence = base::MakeUnique<ui::LayerAnimationSequence>();
259 std::unique_ptr<ui::LayerAnimationSequence> grayscale_sequence(
260 new ui::LayerAnimationSequence());
261 259
262 std::unique_ptr<ui::LayerAnimationElement> brightness_element( 260 std::unique_ptr<ui::LayerAnimationElement> brightness_element =
263 ui::LayerAnimationElement::CreateBrightnessElement(target, duration)); 261 ui::LayerAnimationElement::CreateBrightnessElement(target, duration);
264 brightness_element->set_tween_type(tween_type); 262 brightness_element->set_tween_type(tween_type);
265 brightness_sequence->AddElement(brightness_element.release()); 263 brightness_sequence->AddElement(std::move(brightness_element));
266 264
267 std::unique_ptr<ui::LayerAnimationElement> grayscale_element( 265 std::unique_ptr<ui::LayerAnimationElement> grayscale_element =
268 ui::LayerAnimationElement::CreateGrayscaleElement(target, duration)); 266 ui::LayerAnimationElement::CreateGrayscaleElement(target, duration);
269 grayscale_element->set_tween_type(tween_type); 267 grayscale_element->set_tween_type(tween_type);
270 grayscale_sequence->AddElement(grayscale_element.release()); 268 grayscale_sequence->AddElement(std::move(grayscale_element));
271 269
272 std::vector<ui::LayerAnimationSequence*> animations; 270 std::vector<ui::LayerAnimationSequence*> animations;
273 animations.push_back(brightness_sequence.release()); 271 animations.push_back(brightness_sequence.release());
274 animations.push_back(grayscale_sequence.release()); 272 animations.push_back(grayscale_sequence.release());
275 273
276 if (observer) 274 if (observer)
277 animations[0]->AddObserver(observer); 275 animations[0]->AddObserver(observer);
278 276
279 animator->set_preemption_strategy( 277 animator->set_preemption_strategy(
280 ui::LayerAnimator::IMMEDIATELY_ANIMATE_TO_NEW_TARGET); 278 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); 649 gfx::Tween::EASE_IN, observer);
652 break; 650 break;
653 case ANIMATION_UNDO_GRAYSCALE_BRIGHTNESS: 651 case ANIMATION_UNDO_GRAYSCALE_BRIGHTNESS:
654 StartGrayscaleBrightnessAnimationForWindow( 652 StartGrayscaleBrightnessAnimationForWindow(
655 window, 0.0, duration, gfx::Tween::EASE_IN_OUT, observer); 653 window, 0.0, duration, gfx::Tween::EASE_IN_OUT, observer);
656 break; 654 break;
657 } 655 }
658 } 656 }
659 657
660 } // namespace ash 658 } // namespace ash
OLDNEW
« no previous file with comments | « no previous file | ash/wm/window_animations.cc » ('j') | ash/wm/window_animations.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698