| 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_COMMON_SYSTEM_TRAY_TRAY_ITEM_VIEW_H_ | 5 #ifndef ASH_COMMON_SYSTEM_TRAY_TRAY_ITEM_VIEW_H_ |
| 6 #define ASH_COMMON_SYSTEM_TRAY_TRAY_ITEM_VIEW_H_ | 6 #define ASH_COMMON_SYSTEM_TRAY_TRAY_ITEM_VIEW_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 | 9 |
| 10 #include "ash/ash_export.h" | 10 #include "ash/ash_export.h" |
| (...skipping 18 matching lines...) Expand all Loading... |
| 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 gfx::AnimationDelegate { | 31 public gfx::AnimationDelegate { |
| 32 public: | 32 public: |
| 33 explicit TrayItemView(SystemTrayItem* owner); | 33 explicit TrayItemView(SystemTrayItem* owner); |
| 34 ~TrayItemView() override; | 34 ~TrayItemView() override; |
| 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 // Only one of the two should be called. |
| 39 void CreateLabel(); | 40 void CreateLabel(); |
| 40 void CreateImageView(); | 41 void CreateImageView(); |
| 41 | 42 |
| 42 SystemTrayItem* owner() const { return owner_; } | 43 SystemTrayItem* owner() const { return owner_; } |
| 43 views::Label* label() const { return label_; } | 44 views::Label* label() const { return label_; } |
| 44 views::ImageView* image_view() const { return image_view_; } | 45 views::ImageView* image_view() const { return image_view_; } |
| 45 | 46 |
| 46 // Overridden from views::View. | 47 // Overridden from views::View. |
| 47 void SetVisible(bool visible) override; | 48 void SetVisible(bool visible) override; |
| 48 gfx::Size GetPreferredSize() const override; | 49 gfx::Size GetPreferredSize() const override; |
| (...skipping 11 matching lines...) Expand all Loading... |
| 60 // Overridden from views::View. | 61 // Overridden from views::View. |
| 61 void ChildPreferredSizeChanged(View* child) override; | 62 void ChildPreferredSizeChanged(View* child) override; |
| 62 | 63 |
| 63 // Overridden from gfx::AnimationDelegate. | 64 // Overridden from gfx::AnimationDelegate. |
| 64 void AnimationProgressed(const gfx::Animation* animation) override; | 65 void AnimationProgressed(const gfx::Animation* animation) override; |
| 65 void AnimationEnded(const gfx::Animation* animation) override; | 66 void AnimationEnded(const gfx::Animation* animation) override; |
| 66 void AnimationCanceled(const gfx::Animation* animation) override; | 67 void AnimationCanceled(const gfx::Animation* animation) override; |
| 67 | 68 |
| 68 SystemTrayItem* owner_; | 69 SystemTrayItem* owner_; |
| 69 std::unique_ptr<gfx::SlideAnimation> animation_; | 70 std::unique_ptr<gfx::SlideAnimation> animation_; |
| 71 // Only one of |label_| and |image_view_| should be non-null. |
| 70 views::Label* label_; | 72 views::Label* label_; |
| 71 views::ImageView* image_view_; | 73 views::ImageView* image_view_; |
| 72 | 74 |
| 73 DISALLOW_COPY_AND_ASSIGN(TrayItemView); | 75 DISALLOW_COPY_AND_ASSIGN(TrayItemView); |
| 74 }; | 76 }; |
| 75 | 77 |
| 76 } // namespace ash | 78 } // namespace ash |
| 77 | 79 |
| 78 #endif // ASH_COMMON_SYSTEM_TRAY_TRAY_ITEM_VIEW_H_ | 80 #endif // ASH_COMMON_SYSTEM_TRAY_TRAY_ITEM_VIEW_H_ |
| OLD | NEW |