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

Unified 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: Address review comments. 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/app_list/views/folder_header_view.cc ('k') | ui/app_list/views/top_icon_animation_view.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/app_list/views/top_icon_animation_view.h
diff --git a/ui/app_list/views/top_icon_animation_view.h b/ui/app_list/views/top_icon_animation_view.h
new file mode 100644
index 0000000000000000000000000000000000000000..88d2d0f2539cdfa8abd1c5ba04e02e763dcab012
--- /dev/null
+++ b/ui/app_list/views/top_icon_animation_view.h
@@ -0,0 +1,77 @@
+// Copyright (c) 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef UI_APP_LIST_VIEWS_TOP_ICON_ANIMATION_VIEW_H
+#define UI_APP_LIST_VIEWS_TOP_ICON_ANIMATION_VIEW_H
+
+#include "base/observer_list.h"
+#include "ui/compositor/layer_animation_observer.h"
+#include "ui/views/view.h"
+
+namespace views {
+class ImageView;
+}
+
+namespace app_list {
+
+// Observer for top icon animation completion.
+class TopIconAnimationObserver {
+ public:
+ // Called when top icon animation completes.
+ virtual void OnTopIconAnimationsComplete() {}
+
+ protected:
+ TopIconAnimationObserver() {}
+ virtual ~TopIconAnimationObserver() {}
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(TopIconAnimationObserver);
+};
+
+// Transitional view used for top item icons animation when opening or closing
+// a folder.
+class TopIconAnimationView : public views::View,
+ public ui::ImplicitAnimationObserver {
+ public:
+ // |icon|: The icon image of the item icon of full scale size.
+ // |scaled_rect|: Bounds of the small icon inside folder icon.
+ // |open_folder|: Specify open/close folder animation to perform.
+ // The view will be self-cleaned by the end of animation.
+ TopIconAnimationView(const gfx::ImageSkia& icon,
+ const gfx::Rect& scaled_rect,
+ bool open_folder);
+ virtual ~TopIconAnimationView();
+
+ void AddObserver(TopIconAnimationObserver* observer);
+ void RemoveObserver(TopIconAnimationObserver* observer);
+
+ // When opening a folder, transform the top item icon from the small icon
+ // inside folder icon to the full scale icon at the target location.
+ // When closing a folder, transform the full scale item icon from its
+ // location to the small icon inside the folder icon.
+ void TransformView();
+
+ private:
+ // views::View overrides:
+ virtual gfx::Size GetPreferredSize() OVERRIDE;
+ virtual void Layout() OVERRIDE;
+
+ // ui::ImplicitAnimationObserver overrides:
+ virtual void OnImplicitAnimationsCompleted() OVERRIDE;
+
+ gfx::Size icon_size_;
+ views::ImageView* icon_; // Owned by views hierarchy.
+ // Rect of the scaled down top item icon inside folder icon's ink bubble.
+ gfx::Rect scaled_rect_;
+ // true: opening folder; false: closing folder.
+ bool open_folder_;
+
+ ObserverList<TopIconAnimationObserver> observers_;
+
+ DISALLOW_COPY_AND_ASSIGN(TopIconAnimationView);
+};
+
+} // namespace app_list
+
+#endif // UI_APP_LIST_VIEWS_TOP_ICON_ANIMATION_VIEW_H
« no previous file with comments | « ui/app_list/views/folder_header_view.cc ('k') | ui/app_list/views/top_icon_animation_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698