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/system/tray/tray_item_view.h" | 5 #include "ash/system/tray/tray_item_view.h" |
6 | 6 |
7 #include "ash/shelf/shelf_types.h" | 7 #include "ash/shelf/shelf_types.h" |
8 #include "ash/system/tray/system_tray.h" | 8 #include "ash/system/tray/system_tray.h" |
9 #include "ash/system/tray/system_tray_item.h" | 9 #include "ash/system/tray/system_tray_item.h" |
10 #include "ui/compositor/layer.h" | 10 #include "ui/compositor/layer.h" |
11 #include "ui/gfx/animation/slide_animation.h" | 11 #include "ui/gfx/animation/slide_animation.h" |
12 #include "ui/views/controls/image_view.h" | 12 #include "ui/views/controls/image_view.h" |
13 #include "ui/views/controls/label.h" | 13 #include "ui/views/controls/label.h" |
14 #include "ui/views/layout/box_layout.h" | 14 #include "ui/views/layout/box_layout.h" |
15 #include "ui/views/widget/widget.h" | 15 #include "ui/views/widget/widget.h" |
16 | 16 |
17 namespace { | 17 namespace { |
18 const int kTrayIconHeight = 29; | 18 const int kTrayIconHeight = 29; |
19 const int kTrayIconWidth = 29; | 19 const int kTrayIconWidth = 29; |
20 const int kTrayItemAnimationDurationMS = 200; | 20 const int kTrayItemAnimationDurationMS = 200; |
21 | 21 |
22 // Animations can be disabled for testing. | 22 // Animations can be disabled for testing. |
23 bool animations_enabled = true; | 23 bool animations_enabled = true; |
24 } | 24 } |
25 | 25 |
26 namespace ash { | 26 namespace ash { |
27 namespace internal { | |
28 | 27 |
29 TrayItemView::TrayItemView(SystemTrayItem* owner) | 28 TrayItemView::TrayItemView(SystemTrayItem* owner) |
30 : owner_(owner), | 29 : owner_(owner), |
31 label_(NULL), | 30 label_(NULL), |
32 image_view_(NULL) { | 31 image_view_(NULL) { |
33 SetPaintToLayer(true); | 32 SetPaintToLayer(true); |
34 SetFillsBoundsOpaquely(false); | 33 SetFillsBoundsOpaquely(false); |
35 SetLayoutManager( | 34 SetLayoutManager( |
36 new views::BoxLayout(views::BoxLayout::kHorizontal, 0, 0, 0)); | 35 new views::BoxLayout(views::BoxLayout::kHorizontal, 0, 0, 0)); |
37 } | 36 } |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
130 | 129 |
131 void TrayItemView::AnimationEnded(const gfx::Animation* animation) { | 130 void TrayItemView::AnimationEnded(const gfx::Animation* animation) { |
132 if (animation->GetCurrentValue() < 0.1) | 131 if (animation->GetCurrentValue() < 0.1) |
133 views::View::SetVisible(false); | 132 views::View::SetVisible(false); |
134 } | 133 } |
135 | 134 |
136 void TrayItemView::AnimationCanceled(const gfx::Animation* animation) { | 135 void TrayItemView::AnimationCanceled(const gfx::Animation* animation) { |
137 AnimationEnded(animation); | 136 AnimationEnded(animation); |
138 } | 137 } |
139 | 138 |
140 } // namespace internal | |
141 } // namespace ash | 139 } // namespace ash |
OLD | NEW |