| 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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 // Overridden from views::View. | 46 // Overridden from views::View. |
| 47 void SetVisible(bool visible) override; | 47 void SetVisible(bool visible) override; |
| 48 gfx::Size GetPreferredSize() const override; | 48 gfx::Size GetPreferredSize() const override; |
| 49 int GetHeightForWidth(int width) const override; | 49 int GetHeightForWidth(int width) const override; |
| 50 | 50 |
| 51 protected: | 51 protected: |
| 52 // Makes sure the widget relayouts after the size/visibility of the view | 52 // Makes sure the widget relayouts after the size/visibility of the view |
| 53 // changes. | 53 // changes. |
| 54 void ApplyChange(); | 54 void ApplyChange(); |
| 55 | 55 |
| 56 // This should return the desired size of the view. For most views, this | |
| 57 // returns GetPreferredSize. But since this class overrides GetPreferredSize | |
| 58 // for animation purposes, we allow a different way to get this size, and do | |
| 59 // not allow GetPreferredSize to be overridden. | |
| 60 virtual gfx::Size DesiredSize() const; | |
| 61 | |
| 62 // The default animation duration is 200ms. But each view can customize this. | 56 // The default animation duration is 200ms. But each view can customize this. |
| 63 virtual int GetAnimationDurationMS(); | 57 virtual int GetAnimationDurationMS(); |
| 64 | 58 |
| 65 private: | 59 private: |
| 66 // Overridden from views::View. | 60 // Overridden from views::View. |
| 67 void ChildPreferredSizeChanged(View* child) override; | 61 void ChildPreferredSizeChanged(View* child) override; |
| 68 | 62 |
| 69 // Overridden from gfx::AnimationDelegate. | 63 // Overridden from gfx::AnimationDelegate. |
| 70 void AnimationProgressed(const gfx::Animation* animation) override; | 64 void AnimationProgressed(const gfx::Animation* animation) override; |
| 71 void AnimationEnded(const gfx::Animation* animation) override; | 65 void AnimationEnded(const gfx::Animation* animation) override; |
| 72 void AnimationCanceled(const gfx::Animation* animation) override; | 66 void AnimationCanceled(const gfx::Animation* animation) override; |
| 73 | 67 |
| 74 SystemTrayItem* owner_; | 68 SystemTrayItem* owner_; |
| 75 std::unique_ptr<gfx::SlideAnimation> animation_; | 69 std::unique_ptr<gfx::SlideAnimation> animation_; |
| 76 views::Label* label_; | 70 views::Label* label_; |
| 77 views::ImageView* image_view_; | 71 views::ImageView* image_view_; |
| 78 | 72 |
| 79 DISALLOW_COPY_AND_ASSIGN(TrayItemView); | 73 DISALLOW_COPY_AND_ASSIGN(TrayItemView); |
| 80 }; | 74 }; |
| 81 | 75 |
| 82 } // namespace ash | 76 } // namespace ash |
| 83 | 77 |
| 84 #endif // ASH_COMMON_SYSTEM_TRAY_TRAY_ITEM_VIEW_H_ | 78 #endif // ASH_COMMON_SYSTEM_TRAY_TRAY_ITEM_VIEW_H_ |
| OLD | NEW |