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

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: 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 unified diff | 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 »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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. The
35 // animation should be linear (not eased in or out) so that it can be played
36 // forwards or reversed. Easing will be applied by the PaginationModel.
37 virtual void Update(double progress, int from_page, int to_page) = 0;
38
39 protected:
40 ContentsView* contents_view() { return contents_view_; }
41
42 // Gets the origin (the off-screen resting place) for a given launcher page
43 // with index |page_index|.
44 gfx::Rect GetOffscreenPageBounds(int page_index) const;
45
46 private:
47 ContentsView* contents_view_;
48
49 DISALLOW_COPY_AND_ASSIGN(ContentsAnimator);
50 };
51
52 // Simple animator that slides pages in and out vertically. Appropriate for any
53 // page pair.
54 class DefaultAnimator : public ContentsAnimator {
55 public:
56 DefaultAnimator(ContentsView* contents_view);
57
58 ~DefaultAnimator() override {}
59
60 // ContentsAnimator overrides:
61 std::string NameForTests() const override;
62 void Update(double progress, int from_page, int to_page) override;
63
64 DISALLOW_COPY_AND_ASSIGN(DefaultAnimator);
65 };
66
67 // Animator between the start page and apps grid page.
68 class StartToAppsAnimator : public ContentsAnimator {
69 public:
70 StartToAppsAnimator(ContentsView* contents_view);
71
72 ~StartToAppsAnimator() override {}
73
74 // ContentsAnimator overrides:
75 std::string NameForTests() const override;
76 void Update(double progress, int start_page, int apps_page) override;
77
78 DISALLOW_COPY_AND_ASSIGN(StartToAppsAnimator);
79 };
80
81 } // app_list
82
83 #endif // UI_APP_LIST_VIEWS_CONTENTS_ANIMATOR_H_
OLDNEW
« 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