OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 UI_APP_LIST_VIEWS_TOP_ICON_ANIMATION_VIEW_H_ | 5 #ifndef UI_APP_LIST_VIEWS_TOP_ICON_ANIMATION_VIEW_H_ |
6 #define UI_APP_LIST_VIEWS_TOP_ICON_ANIMATION_VIEW_H_ | 6 #define UI_APP_LIST_VIEWS_TOP_ICON_ANIMATION_VIEW_H_ |
7 | 7 |
8 #include "base/observer_list.h" | 8 #include "base/observer_list.h" |
9 #include "ui/compositor/layer_animation_observer.h" | 9 #include "ui/compositor/layer_animation_observer.h" |
10 #include "ui/views/view.h" | 10 #include "ui/views/view.h" |
(...skipping 23 matching lines...) Expand all Loading... |
34 class TopIconAnimationView : public views::View, | 34 class TopIconAnimationView : public views::View, |
35 public ui::ImplicitAnimationObserver { | 35 public ui::ImplicitAnimationObserver { |
36 public: | 36 public: |
37 // |icon|: The icon image of the item icon of full scale size. | 37 // |icon|: The icon image of the item icon of full scale size. |
38 // |scaled_rect|: Bounds of the small icon inside folder icon. | 38 // |scaled_rect|: Bounds of the small icon inside folder icon. |
39 // |open_folder|: Specify open/close folder animation to perform. | 39 // |open_folder|: Specify open/close folder animation to perform. |
40 // The view will be self-cleaned by the end of animation. | 40 // The view will be self-cleaned by the end of animation. |
41 TopIconAnimationView(const gfx::ImageSkia& icon, | 41 TopIconAnimationView(const gfx::ImageSkia& icon, |
42 const gfx::Rect& scaled_rect, | 42 const gfx::Rect& scaled_rect, |
43 bool open_folder); | 43 bool open_folder); |
44 virtual ~TopIconAnimationView(); | 44 ~TopIconAnimationView() override; |
45 | 45 |
46 void AddObserver(TopIconAnimationObserver* observer); | 46 void AddObserver(TopIconAnimationObserver* observer); |
47 void RemoveObserver(TopIconAnimationObserver* observer); | 47 void RemoveObserver(TopIconAnimationObserver* observer); |
48 | 48 |
49 // When opening a folder, transform the top item icon from the small icon | 49 // When opening a folder, transform the top item icon from the small icon |
50 // inside folder icon to the full scale icon at the target location. | 50 // inside folder icon to the full scale icon at the target location. |
51 // When closing a folder, transform the full scale item icon from its | 51 // When closing a folder, transform the full scale item icon from its |
52 // location to the small icon inside the folder icon. | 52 // location to the small icon inside the folder icon. |
53 void TransformView(); | 53 void TransformView(); |
54 | 54 |
55 private: | 55 private: |
56 // views::View overrides: | 56 // views::View overrides: |
57 virtual gfx::Size GetPreferredSize() const override; | 57 gfx::Size GetPreferredSize() const override; |
58 virtual void Layout() override; | 58 void Layout() override; |
59 | 59 |
60 // ui::ImplicitAnimationObserver overrides: | 60 // ui::ImplicitAnimationObserver overrides: |
61 virtual void OnImplicitAnimationsCompleted() override; | 61 void OnImplicitAnimationsCompleted() override; |
62 virtual bool RequiresNotificationWhenAnimatorDestroyed() const override; | 62 bool RequiresNotificationWhenAnimatorDestroyed() const override; |
63 | 63 |
64 gfx::Size icon_size_; | 64 gfx::Size icon_size_; |
65 views::ImageView* icon_; // Owned by views hierarchy. | 65 views::ImageView* icon_; // Owned by views hierarchy. |
66 // Rect of the scaled down top item icon inside folder icon's ink bubble. | 66 // Rect of the scaled down top item icon inside folder icon's ink bubble. |
67 gfx::Rect scaled_rect_; | 67 gfx::Rect scaled_rect_; |
68 // true: opening folder; false: closing folder. | 68 // true: opening folder; false: closing folder. |
69 bool open_folder_; | 69 bool open_folder_; |
70 | 70 |
71 ObserverList<TopIconAnimationObserver> observers_; | 71 ObserverList<TopIconAnimationObserver> observers_; |
72 | 72 |
73 DISALLOW_COPY_AND_ASSIGN(TopIconAnimationView); | 73 DISALLOW_COPY_AND_ASSIGN(TopIconAnimationView); |
74 }; | 74 }; |
75 | 75 |
76 } // namespace app_list | 76 } // namespace app_list |
77 | 77 |
78 #endif // UI_APP_LIST_VIEWS_TOP_ICON_ANIMATION_VIEW_H_ | 78 #endif // UI_APP_LIST_VIEWS_TOP_ICON_ANIMATION_VIEW_H_ |
OLD | NEW |