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 #ifndef ASH_SYSTEM_TRAY_TRAY_ITEM_VIEW_H_ | 5 #ifndef ASH_SYSTEM_TRAY_TRAY_ITEM_VIEW_H_ |
6 #define ASH_SYSTEM_TRAY_TRAY_ITEM_VIEW_H_ | 6 #define ASH_SYSTEM_TRAY_TRAY_ITEM_VIEW_H_ |
7 | 7 |
8 #include "ash/ash_export.h" | 8 #include "ash/ash_export.h" |
9 #include "ui/base/animation/animation_delegate.h" | 9 #include "ui/gfx/animation/animation_delegate.h" |
10 #include "ui/views/view.h" | 10 #include "ui/views/view.h" |
11 | 11 |
12 namespace ui { | 12 namespace gfx { |
13 class SlideAnimation; | 13 class SlideAnimation; |
14 } | 14 } |
15 | 15 |
16 namespace views { | 16 namespace views { |
17 class ImageView; | 17 class ImageView; |
18 class Label; | 18 class Label; |
19 } | 19 } |
20 | 20 |
21 namespace ash { | 21 namespace ash { |
22 | 22 |
23 class SystemTrayItem; | 23 class SystemTrayItem; |
24 | 24 |
25 namespace internal { | 25 namespace internal { |
26 | 26 |
27 // Base-class for items in the tray. It makes sure the widget is updated | 27 // Base-class for items in the tray. It makes sure the widget is updated |
28 // correctly when the visibility/size of the tray item changes. It also adds | 28 // correctly when the visibility/size of the tray item changes. It also adds |
29 // animation when showing/hiding the item in the tray. | 29 // animation when showing/hiding the item in the tray. |
30 class ASH_EXPORT TrayItemView : public views::View, | 30 class ASH_EXPORT TrayItemView : public views::View, |
31 public ui::AnimationDelegate { | 31 public gfx::AnimationDelegate { |
32 public: | 32 public: |
33 explicit TrayItemView(SystemTrayItem* owner); | 33 explicit TrayItemView(SystemTrayItem* owner); |
34 virtual ~TrayItemView(); | 34 virtual ~TrayItemView(); |
35 | 35 |
36 static void DisableAnimationsForTest(); | 36 static void DisableAnimationsForTest(); |
37 | 37 |
38 // Convenience function for creating a child Label or ImageView. | 38 // Convenience function for creating a child Label or ImageView. |
39 void CreateLabel(); | 39 void CreateLabel(); |
40 void CreateImageView(); | 40 void CreateImageView(); |
41 | 41 |
(...skipping 17 matching lines...) Expand all Loading... |
59 // not allow GetPreferredSize to be overridden. | 59 // not allow GetPreferredSize to be overridden. |
60 virtual gfx::Size DesiredSize(); | 60 virtual gfx::Size DesiredSize(); |
61 | 61 |
62 // The default animation duration is 200ms. But each view can customize this. | 62 // The default animation duration is 200ms. But each view can customize this. |
63 virtual int GetAnimationDurationMS(); | 63 virtual int GetAnimationDurationMS(); |
64 | 64 |
65 private: | 65 private: |
66 // Overridden from views::View. | 66 // Overridden from views::View. |
67 virtual void ChildPreferredSizeChanged(View* child) OVERRIDE; | 67 virtual void ChildPreferredSizeChanged(View* child) OVERRIDE; |
68 | 68 |
69 // Overridden from ui::AnimationDelegate. | 69 // Overridden from gfx::AnimationDelegate. |
70 virtual void AnimationProgressed(const ui::Animation* animation) OVERRIDE; | 70 virtual void AnimationProgressed(const gfx::Animation* animation) OVERRIDE; |
71 virtual void AnimationEnded(const ui::Animation* animation) OVERRIDE; | 71 virtual void AnimationEnded(const gfx::Animation* animation) OVERRIDE; |
72 virtual void AnimationCanceled(const ui::Animation* animation) OVERRIDE; | 72 virtual void AnimationCanceled(const gfx::Animation* animation) OVERRIDE; |
73 | 73 |
74 SystemTrayItem* owner_; | 74 SystemTrayItem* owner_; |
75 scoped_ptr<ui::SlideAnimation> animation_; | 75 scoped_ptr<gfx::SlideAnimation> animation_; |
76 views::Label* label_; | 76 views::Label* label_; |
77 views::ImageView* image_view_; | 77 views::ImageView* image_view_; |
78 | 78 |
79 DISALLOW_COPY_AND_ASSIGN(TrayItemView); | 79 DISALLOW_COPY_AND_ASSIGN(TrayItemView); |
80 }; | 80 }; |
81 | 81 |
82 } // namespace internal | 82 } // namespace internal |
83 } // namespace ash | 83 } // namespace ash |
84 | 84 |
85 #endif // ASH_SYSTEM_TRAY_TRAY_ITEM_VIEW_H_ | 85 #endif // ASH_SYSTEM_TRAY_TRAY_ITEM_VIEW_H_ |
OLD | NEW |