Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(58)

Side by Side Diff: ui/app_list/views/top_icon_animation_view.h

Issue 136303008: Implement ui for re-parenting an item from an app list folder to another position or folder in the … (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright (c) 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef UI_APP_LIST_VIEWS_TOP_ICON_ANIMATION_VIEW_H
6 #define UI_APP_LIST_VIEWS_TOP_ICON_ANIMATION_VIEW_H
7
8 #include "ui/compositor/layer_animation_observer.h"
9 #include "ui/views/view.h"
10
11 namespace views {
12 class ImageView;
13 }
14
15 namespace app_list {
16
17 // Observer for top icon animation completion.
18 class TopIconAnimationObserver {
19 public:
20 // Called when top icon animation completes.
21 virtual void OnTopIconAnimationsComplete(views::View* icon_view) {}
22
23 protected:
24 TopIconAnimationObserver() {}
25 virtual ~TopIconAnimationObserver() {}
26
27 private:
28 DISALLOW_COPY_AND_ASSIGN(TopIconAnimationObserver);
29 };
30
31 // Transitional view used for top item icons animation when opening or closing
32 // a folder.
33 class TopIconAnimationView : public views::View,
34 public ui::ImplicitAnimationObserver {
35 public:
36 // |icon|: The icon image of the item icon of full scale size.
37 // |scaled_rect|: Bounds of the small icon inside folder icon.
38 // |open_folder|: Specify open/close folder animation to perform.
39 // |self_clean|: True if the view should be cleaned by the end of animation.
40 TopIconAnimationView(const gfx::ImageSkia& icon,
41 const gfx::Rect& scaled_rect,
42 bool open_folder,
43 bool self_clean);
44 virtual ~TopIconAnimationView();
45
46 void AddObserver(TopIconAnimationObserver* observer);
47 void RemoveObserver(TopIconAnimationObserver* observer);
48
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.
51 // When closing a folder, transform the full scale item icon from its
52 // location to the small icon inside the folder icon.
53 void TransformView();
54
55 private:
56 // views::View overrides:
57 virtual gfx::Size GetPreferredSize() OVERRIDE;
58 virtual void Layout() OVERRIDE;
59
60 // ui::ImplicitAnimationObserver overrides:
61 virtual void OnImplicitAnimationsCompleted() OVERRIDE;
62
63 gfx::Size icon_size_;
64 views::ImageView* icon_; // Owned by views hierarchy.
65 // Rect of the scaled down top item icon inside folder icon's ink bubble.
66 gfx::Rect scaled_rect_;
67 // true: opening folder; false: closing folder.
68 bool open_folder_;
69 // If true, delete the object by the end of the animation.
70 bool self_clean_;
71
72 ObserverList<TopIconAnimationObserver> observers_;
xiyuan 2014/02/06 22:45:12 nit: #include "base/observer_list.h"
jennyz 2014/02/07 00:03:10 Done.
73
74 DISALLOW_COPY_AND_ASSIGN(TopIconAnimationView);
75 };
76
77 } // namespace app_list
78
79 #endif // UI_APP_LIST_VIEWS_TOP_ICON_ANIMATION_VIEW_H
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698