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

Side by Side Diff: ash/common/system/tray/tray_item_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 (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/common/system/tray/tray_item_view.h" 5 #include "ash/common/system/tray/tray_item_view.h"
6 6
7 #include "ash/common/material_design/material_design_controller.h" 7 #include "ash/common/material_design/material_design_controller.h"
8 #include "ash/common/shelf/wm_shelf_util.h" 8 #include "ash/common/shelf/wm_shelf_util.h"
9 #include "ash/common/system/tray/system_tray.h" 9 #include "ash/common/system/tray/system_tray.h"
10 #include "ash/common/system/tray/system_tray_item.h" 10 #include "ash/common/system/tray/system_tray_item.h"
11 #include "ash/common/system/tray/tray_constants.h" 11 #include "ash/common/system/tray/tray_constants.h"
12 #include "ash/public/cpp/shelf_types.h" 12 #include "ash/public/cpp/shelf_types.h"
13 #include "ui/compositor/layer.h" 13 #include "ui/compositor/layer.h"
14 #include "ui/compositor/layer_type.h"
14 #include "ui/gfx/animation/slide_animation.h" 15 #include "ui/gfx/animation/slide_animation.h"
15 #include "ui/views/controls/image_view.h" 16 #include "ui/views/controls/image_view.h"
16 #include "ui/views/controls/label.h" 17 #include "ui/views/controls/label.h"
17 #include "ui/views/layout/fill_layout.h" 18 #include "ui/views/layout/fill_layout.h"
18 #include "ui/views/widget/widget.h" 19 #include "ui/views/widget/widget.h"
19 20
20 namespace { 21 namespace {
21 const int kTrayIconHeight = 29; 22 const int kTrayIconHeight = 29;
22 const int kTrayIconWidth = 29; 23 const int kTrayIconWidth = 29;
23 const int kTrayItemAnimationDurationMS = 200; 24 const int kTrayItemAnimationDurationMS = 200;
24 25
25 // Animations can be disabled for testing. 26 // Animations can be disabled for testing.
26 bool animations_enabled = true; 27 bool animations_enabled = true;
27 } 28 }
28 29
29 namespace ash { 30 namespace ash {
30 31
31 TrayItemView::TrayItemView(SystemTrayItem* owner) 32 TrayItemView::TrayItemView(SystemTrayItem* owner)
32 : owner_(owner), label_(NULL), image_view_(NULL) { 33 : owner_(owner), label_(NULL), image_view_(NULL) {
33 SetPaintToLayer(true); 34 SetPaintToLayer(ui::LAYER_TEXTURED);
34 layer()->SetFillsBoundsOpaquely(false); 35 layer()->SetFillsBoundsOpaquely(false);
35 SetLayoutManager(new views::FillLayout()); 36 SetLayoutManager(new views::FillLayout());
36 } 37 }
37 38
38 TrayItemView::~TrayItemView() {} 39 TrayItemView::~TrayItemView() {}
39 40
40 // static 41 // static
41 void TrayItemView::DisableAnimationsForTest() { 42 void TrayItemView::DisableAnimationsForTest() {
42 animations_enabled = false; 43 animations_enabled = false;
43 } 44 }
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 void TrayItemView::AnimationEnded(const gfx::Animation* animation) { 142 void TrayItemView::AnimationEnded(const gfx::Animation* animation) {
142 if (animation->GetCurrentValue() < 0.1) 143 if (animation->GetCurrentValue() < 0.1)
143 views::View::SetVisible(false); 144 views::View::SetVisible(false);
144 } 145 }
145 146
146 void TrayItemView::AnimationCanceled(const gfx::Animation* animation) { 147 void TrayItemView::AnimationCanceled(const gfx::Animation* animation) {
147 AnimationEnded(animation); 148 AnimationEnded(animation);
148 } 149 }
149 150
150 } // namespace ash 151 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698