OLD | NEW |
---|---|
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 Loading... | |
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 ui::LayerAnimationSequence* brightness_sequence = |
loyso (OOO)
2016/12/06 04:21:56
Use auto and MakeUnique and std::move here and eve
Sunny
2016/12/06 06:21:05
Hi, the variable "brightness_sequence" here is onl
loyso (OOO)
2016/12/06 06:32:35
Thanks for working on this, Sunny!
On 2016/12/06
| |
258 new ui::LayerAnimationSequence()); | 258 new ui::LayerAnimationSequence(); |
259 std::unique_ptr<ui::LayerAnimationSequence> grayscale_sequence( | 259 ui::LayerAnimationSequence* grayscale_sequence = |
260 new ui::LayerAnimationSequence()); | 260 new ui::LayerAnimationSequence(); |
261 | 261 |
262 std::unique_ptr<ui::LayerAnimationElement> brightness_element( | 262 ui::LayerAnimationElement* brightness_element = |
263 ui::LayerAnimationElement::CreateBrightnessElement(target, duration)); | 263 ui::LayerAnimationElement::CreateBrightnessElement(target, duration); |
loyso (OOO)
2016/12/06 04:25:17
It's better for Create*Element methods to use move
Sunny
2016/12/06 06:21:05
Same question, is it worthwhile to wrap raw pointe
| |
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(brightness_element); |
266 | 266 |
267 std::unique_ptr<ui::LayerAnimationElement> grayscale_element( | 267 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(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); |
274 animations.push_back(grayscale_sequence.release()); | 274 animations.push_back(grayscale_sequence); |
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); |
281 | 281 |
282 animator->StartTogether(animations); | 282 animator->StartTogether(animations); |
283 } | 283 } |
284 | 284 |
(...skipping 366 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
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 |
OLD | NEW |