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

Unified Diff: ui/app_list/views/contents_animator.h

Issue 701773002: App list: Added contents view custom animation framework. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed default animator reverse not being set. Oooops. Created 6 years, 1 month 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/app_list.gyp ('k') | ui/app_list/views/contents_animator.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/app_list/views/contents_animator.h
diff --git a/ui/app_list/views/contents_animator.h b/ui/app_list/views/contents_animator.h
new file mode 100644
index 0000000000000000000000000000000000000000..84366618c426d4ead592a996feb3b1ef5fedf259
--- /dev/null
+++ b/ui/app_list/views/contents_animator.h
@@ -0,0 +1,83 @@
+// Copyright 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_CONTENTS_ANIMATOR_H_
+#define UI_APP_LIST_VIEWS_CONTENTS_ANIMATOR_H_
+
+#include <string>
+
+#include "base/macros.h"
+
+namespace gfx {
+class Rect;
+}
+
+namespace app_list {
+
+class ContentsView;
+
+// Manages an animation between two specific pages of the ContentsView.
+// Different subclasses implement different animations, so we can have a custom
+// animation for each pair of pages. Animations are reversible (if A -> B is
+// implemented, B -> A will implicitly be the inverse animation).
+class ContentsAnimator {
+ public:
+ ContentsAnimator(ContentsView* contents_view);
+
+ virtual ~ContentsAnimator();
+
+ // Gets the name of the animator, for testing.
+ virtual std::string NameForTests() const = 0;
+
+ // Updates the state of the ContentsView. |progress| is the amount of progress
+ // made on the animation, where 0.0 is the beginning and 1.0 is the end. The
+ // animation should be linear (not eased in or out) so that it can be played
+ // forwards or reversed. Easing will be applied by the PaginationModel.
+ virtual void Update(double progress, int from_page, int to_page) = 0;
+
+ protected:
+ ContentsView* contents_view() { return contents_view_; }
+
+ // Gets the origin (the off-screen resting place) for a given launcher page
+ // with index |page_index|.
+ gfx::Rect GetOffscreenPageBounds(int page_index) const;
+
+ private:
+ ContentsView* contents_view_;
+
+ DISALLOW_COPY_AND_ASSIGN(ContentsAnimator);
+};
+
+// Simple animator that slides pages in and out vertically. Appropriate for any
+// page pair.
+class DefaultAnimator : public ContentsAnimator {
+ public:
+ DefaultAnimator(ContentsView* contents_view);
+
+ ~DefaultAnimator() override {}
+
+ // ContentsAnimator overrides:
+ std::string NameForTests() const override;
+ void Update(double progress, int from_page, int to_page) override;
+
+ DISALLOW_COPY_AND_ASSIGN(DefaultAnimator);
+};
+
+// Animator between the start page and apps grid page.
+class StartToAppsAnimator : public ContentsAnimator {
+ public:
+ StartToAppsAnimator(ContentsView* contents_view);
+
+ ~StartToAppsAnimator() override {}
+
+ // ContentsAnimator overrides:
+ std::string NameForTests() const override;
+ void Update(double progress, int start_page, int apps_page) override;
+
+ DISALLOW_COPY_AND_ASSIGN(StartToAppsAnimator);
+};
+
+} // app_list
+
+#endif // UI_APP_LIST_VIEWS_CONTENTS_ANIMATOR_H_
« no previous file with comments | « ui/app_list/app_list.gyp ('k') | ui/app_list/views/contents_animator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698