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

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: Rename some arguments. 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
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..6bbb0b729af473e9c7ee6f3c77792fd1c6aaff16
--- /dev/null
+++ b/ui/app_list/views/contents_animator.h
@@ -0,0 +1,77 @@
+// 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.
+ virtual void Update(double progress, int from_page, int to_page) = 0;
calamity 2014/11/05 06:29:07 Mention that the animations need to handle this li
Matt Giuca 2014/11/06 00:32:59 Done.
+
calamity 2014/11/05 06:29:07 How are you planning to handle object creation/des
Matt Giuca 2014/11/06 00:32:58 I hadn't thought about it. It's probably safe to s
calamity 2014/11/06 05:34:47 I was more concerned about _when_ you would perfor
Matt Giuca 2014/11/10 04:08:26 Yeah I started implementing it since this discussi
calamity 2014/11/10 05:18:55 Ack.
+ 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);
+
calamity 2014/11/05 06:29:07 Destructor?
Matt Giuca 2014/11/06 00:32:59 Done.
+ // 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);
+
calamity 2014/11/05 06:29:07 Destructor?
Matt Giuca 2014/11/06 00:32:59 Done.
+ // 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_

Powered by Google App Engine
This is Rietveld 408576698