| 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 <memory> | 8 #include <memory> |
| 9 | 9 |
| 10 #include "ash/ash_export.h" | 10 #include "ash/ash_export.h" |
| (...skipping 28 matching lines...) Expand all Loading... |
| 39 // Only one of the two should be called. | 39 // Only one of the two should be called. |
| 40 void CreateLabel(); | 40 void CreateLabel(); |
| 41 void CreateImageView(); | 41 void CreateImageView(); |
| 42 | 42 |
| 43 SystemTrayItem* owner() const { return owner_; } | 43 SystemTrayItem* owner() const { return owner_; } |
| 44 views::Label* label() const { return label_; } | 44 views::Label* label() const { return label_; } |
| 45 views::ImageView* image_view() const { return image_view_; } | 45 views::ImageView* image_view() const { return image_view_; } |
| 46 | 46 |
| 47 // Overridden from views::View. | 47 // Overridden from views::View. |
| 48 void SetVisible(bool visible) override; | 48 void SetVisible(bool visible) override; |
| 49 gfx::Size GetPreferredSize() const override; | 49 gfx::Size CalculatePreferredSize() const override; |
| 50 int GetHeightForWidth(int width) const override; | 50 int GetHeightForWidth(int width) const override; |
| 51 | 51 |
| 52 protected: | 52 protected: |
| 53 // The default animation duration is 200ms. But each view can customize this. | 53 // The default animation duration is 200ms. But each view can customize this. |
| 54 virtual int GetAnimationDurationMS(); | 54 virtual int GetAnimationDurationMS(); |
| 55 | 55 |
| 56 private: | 56 private: |
| 57 // Overridden from views::View. | 57 // Overridden from views::View. |
| 58 void ChildPreferredSizeChanged(View* child) override; | 58 void ChildPreferredSizeChanged(View* child) override; |
| 59 | 59 |
| 60 // Overridden from gfx::AnimationDelegate. | 60 // Overridden from gfx::AnimationDelegate. |
| 61 void AnimationProgressed(const gfx::Animation* animation) override; | 61 void AnimationProgressed(const gfx::Animation* animation) override; |
| 62 void AnimationEnded(const gfx::Animation* animation) override; | 62 void AnimationEnded(const gfx::Animation* animation) override; |
| 63 void AnimationCanceled(const gfx::Animation* animation) override; | 63 void AnimationCanceled(const gfx::Animation* animation) override; |
| 64 | 64 |
| 65 SystemTrayItem* owner_; | 65 SystemTrayItem* owner_; |
| 66 std::unique_ptr<gfx::SlideAnimation> animation_; | 66 std::unique_ptr<gfx::SlideAnimation> animation_; |
| 67 // Only one of |label_| and |image_view_| should be non-null. | 67 // Only one of |label_| and |image_view_| should be non-null. |
| 68 views::Label* label_; | 68 views::Label* label_; |
| 69 views::ImageView* image_view_; | 69 views::ImageView* image_view_; |
| 70 | 70 |
| 71 DISALLOW_COPY_AND_ASSIGN(TrayItemView); | 71 DISALLOW_COPY_AND_ASSIGN(TrayItemView); |
| 72 }; | 72 }; |
| 73 | 73 |
| 74 } // namespace ash | 74 } // namespace ash |
| 75 | 75 |
| 76 #endif // ASH_SYSTEM_TRAY_TRAY_ITEM_VIEW_H_ | 76 #endif // ASH_SYSTEM_TRAY_TRAY_ITEM_VIEW_H_ |
| OLD | NEW |