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

Side by Side 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 unified diff | Download patch
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef UI_APP_LIST_VIEWS_CONTENTS_ANIMATOR_H_
6 #define UI_APP_LIST_VIEWS_CONTENTS_ANIMATOR_H_
7
8 #include <string>
9
10 #include "base/macros.h"
11
12 namespace gfx {
13 class Rect;
14 }
15
16 namespace app_list {
17
18 class ContentsView;
19
20 // Manages an animation between two specific pages of the ContentsView.
21 // Different subclasses implement different animations, so we can have a custom
22 // animation for each pair of pages. Animations are reversible (if A -> B is
23 // implemented, B -> A will implicitly be the inverse animation).
24 class ContentsAnimator {
25 public:
26 ContentsAnimator(ContentsView* contents_view);
27
28 virtual ~ContentsAnimator();
29
30 // Gets the name of the animator, for testing.
31 virtual std::string NameForTests() const = 0;
32
33 // Updates the state of the ContentsView. |progress| is the amount of progress
34 // made on the animation, where 0.0 is the beginning and 1.0 is the end.
35 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.
36
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.
37 protected:
38 ContentsView* contents_view() { return contents_view_; }
39
40 // Gets the origin (the off-screen resting place) for a given launcher page
41 // with index |page_index|.
42 gfx::Rect GetOffscreenPageBounds(int page_index) const;
43
44 private:
45 ContentsView* contents_view_;
46
47 DISALLOW_COPY_AND_ASSIGN(ContentsAnimator);
48 };
49
50 // Simple animator that slides pages in and out vertically. Appropriate for any
51 // page pair.
52 class DefaultAnimator : public ContentsAnimator {
53 public:
54 DefaultAnimator(ContentsView* contents_view);
55
calamity 2014/11/05 06:29:07 Destructor?
Matt Giuca 2014/11/06 00:32:59 Done.
56 // ContentsAnimator overrides:
57 std::string NameForTests() const override;
58 void Update(double progress, int from_page, int to_page) override;
59
60 DISALLOW_COPY_AND_ASSIGN(DefaultAnimator);
61 };
62
63 // Animator between the start page and apps grid page.
64 class StartToAppsAnimator : public ContentsAnimator {
65 public:
66 StartToAppsAnimator(ContentsView* contents_view);
67
calamity 2014/11/05 06:29:07 Destructor?
Matt Giuca 2014/11/06 00:32:59 Done.
68 // ContentsAnimator overrides:
69 std::string NameForTests() const override;
70 void Update(double progress, int start_page, int apps_page) override;
71
72 DISALLOW_COPY_AND_ASSIGN(StartToAppsAnimator);
73 };
74
75 } // app_list
76
77 #endif // UI_APP_LIST_VIEWS_CONTENTS_ANIMATOR_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698