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

Side by Side Diff: ui/app_list/views/top_icon_animation_view.cc

Issue 2639203007: Update SetPaintToLayer to accept LayerType (Closed)
Patch Set: Refactor Created 3 years, 11 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/top_icon_animation_view.h" 5 #include "ui/app_list/views/top_icon_animation_view.h"
6 6
7 #include "base/threading/thread_task_runner_handle.h" 7 #include "base/threading/thread_task_runner_handle.h"
8 #include "ui/app_list/app_list_constants.h" 8 #include "ui/app_list/app_list_constants.h"
9 #include "ui/compositor/layer_type.h"
9 #include "ui/compositor/scoped_layer_animation_settings.h" 10 #include "ui/compositor/scoped_layer_animation_settings.h"
10 #include "ui/gfx/image/image_skia_operations.h" 11 #include "ui/gfx/image/image_skia_operations.h"
11 #include "ui/views/controls/image_view.h" 12 #include "ui/views/controls/image_view.h"
12 13
13 namespace app_list { 14 namespace app_list {
14 15
15 TopIconAnimationView::TopIconAnimationView(const gfx::ImageSkia& icon, 16 TopIconAnimationView::TopIconAnimationView(const gfx::ImageSkia& icon,
16 const gfx::Rect& scaled_rect, 17 const gfx::Rect& scaled_rect,
17 bool open_folder) 18 bool open_folder)
18 : icon_size_(kGridIconDimension, kGridIconDimension), 19 : icon_size_(kGridIconDimension, kGridIconDimension),
19 icon_(new views::ImageView), 20 icon_(new views::ImageView),
20 scaled_rect_(scaled_rect), 21 scaled_rect_(scaled_rect),
21 open_folder_(open_folder) { 22 open_folder_(open_folder) {
22 DCHECK(!icon.isNull()); 23 DCHECK(!icon.isNull());
23 gfx::ImageSkia resized(gfx::ImageSkiaOperations::CreateResizedImage( 24 gfx::ImageSkia resized(gfx::ImageSkiaOperations::CreateResizedImage(
24 icon, 25 icon,
25 skia::ImageOperations::RESIZE_BEST, icon_size_)); 26 skia::ImageOperations::RESIZE_BEST, icon_size_));
26 icon_->SetImage(resized); 27 icon_->SetImage(resized);
27 AddChildView(icon_); 28 AddChildView(icon_);
28 29
29 SetPaintToLayer(true); 30 SetPaintToLayer(ui::LAYER_TEXTURED);
30 layer()->SetFillsBoundsOpaquely(false); 31 layer()->SetFillsBoundsOpaquely(false);
31 } 32 }
32 33
33 TopIconAnimationView::~TopIconAnimationView() { 34 TopIconAnimationView::~TopIconAnimationView() {
34 // Required due to RequiresNotificationWhenAnimatorDestroyed() returning true. 35 // Required due to RequiresNotificationWhenAnimatorDestroyed() returning true.
35 // See ui::LayerAnimationObserver for details. 36 // See ui::LayerAnimationObserver for details.
36 StopObservingImplicitAnimations(); 37 StopObservingImplicitAnimations();
37 } 38 }
38 39
39 void TopIconAnimationView::AddObserver(TopIconAnimationObserver* observer) { 40 void TopIconAnimationView::AddObserver(TopIconAnimationObserver* observer) {
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 for (auto& observer : observers_) 86 for (auto& observer : observers_)
86 observer.OnTopIconAnimationsComplete(); 87 observer.OnTopIconAnimationsComplete();
87 base::ThreadTaskRunnerHandle::Get()->DeleteSoon(FROM_HERE, this); 88 base::ThreadTaskRunnerHandle::Get()->DeleteSoon(FROM_HERE, this);
88 } 89 }
89 90
90 bool TopIconAnimationView::RequiresNotificationWhenAnimatorDestroyed() const { 91 bool TopIconAnimationView::RequiresNotificationWhenAnimatorDestroyed() const {
91 return true; 92 return true;
92 } 93 }
93 94
94 } // namespace app_list 95 } // namespace app_list
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698