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

Side by Side Diff: ui/app_list/views/pulsing_block_view.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 "ui/app_list/views/pulsing_block_view.h" 5 #include "ui/app_list/views/pulsing_block_view.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <vector> 9 #include <vector>
10 10
(...skipping 13 matching lines...) Expand all
24 const int kBlockSize = 64; 24 const int kBlockSize = 64;
25 25
26 const int kAnimationDurationInMs = 600; 26 const int kAnimationDurationInMs = 600;
27 const float kAnimationOpacity[] = { 0.4f, 0.8f, 0.4f }; 27 const float kAnimationOpacity[] = { 0.4f, 0.8f, 0.4f };
28 const float kAnimationScale[] = { 0.8f, 1.0f, 0.8f }; 28 const float kAnimationScale[] = { 0.8f, 1.0f, 0.8f };
29 29
30 void SchedulePulsingAnimation(ui::Layer* layer) { 30 void SchedulePulsingAnimation(ui::Layer* layer) {
31 DCHECK(layer); 31 DCHECK(layer);
32 DCHECK_EQ(arraysize(kAnimationOpacity), arraysize(kAnimationScale)); 32 DCHECK_EQ(arraysize(kAnimationOpacity), arraysize(kAnimationScale));
33 33
34 std::unique_ptr<ui::LayerAnimationSequence> opacity_sequence( 34 std::unique_ptr<ui::LayerAnimationSequence> opacity_sequence =
35 new ui::LayerAnimationSequence()); 35 base::MakeUnique<ui::LayerAnimationSequence>();
36 std::unique_ptr<ui::LayerAnimationSequence> transform_sequence( 36 std::unique_ptr<ui::LayerAnimationSequence> transform_sequence =
37 new ui::LayerAnimationSequence()); 37 base::MakeUnique<ui::LayerAnimationSequence>();
38 38
39 // The animations loop infinitely. 39 // The animations loop infinitely.
40 opacity_sequence->set_is_cyclic(true); 40 opacity_sequence->set_is_cyclic(true);
41 transform_sequence->set_is_cyclic(true); 41 transform_sequence->set_is_cyclic(true);
42 42
43 const gfx::Rect local_bounds(layer->bounds().size()); 43 const gfx::Rect local_bounds(layer->bounds().size());
44 for (size_t i = 0; i < arraysize(kAnimationOpacity); ++i) { 44 for (size_t i = 0; i < arraysize(kAnimationOpacity); ++i) {
45 opacity_sequence->AddElement( 45 opacity_sequence->AddElement(
46 ui::LayerAnimationElement::CreateOpacityElement( 46 ui::LayerAnimationElement::CreateOpacityElement(
47 kAnimationOpacity[i], 47 kAnimationOpacity[i],
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 SchedulePulsingAnimation(layer()); 92 SchedulePulsingAnimation(layer());
93 } 93 }
94 94
95 void PulsingBlockView::OnPaint(gfx::Canvas* canvas) { 95 void PulsingBlockView::OnPaint(gfx::Canvas* canvas) {
96 gfx::Rect rect(GetContentsBounds()); 96 gfx::Rect rect(GetContentsBounds());
97 rect.ClampToCenteredSize(gfx::Size(kBlockSize, kBlockSize)); 97 rect.ClampToCenteredSize(gfx::Size(kBlockSize, kBlockSize));
98 canvas->FillRect(rect, kBlockColor); 98 canvas->FillRect(rect, kBlockColor);
99 } 99 }
100 100
101 } // namespace app_list 101 } // namespace app_list
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698