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

Side by Side Diff: mojo/services/view_manager/scheduled_animation_group.h

Issue 1049993002: Get mojo_shell building inside chromium checkout. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix presubmit Created 5 years, 8 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 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 SERVICES_VIEW_MANAGER_SCHEDULED_ANIMATION_GROUP_H_
6 #define SERVICES_VIEW_MANAGER_SCHEDULED_ANIMATION_GROUP_H_
7
8 #include <vector>
9
10 #include "base/memory/scoped_ptr.h"
11 #include "base/time/time.h"
12 #include "third_party/mojo_services/src/view_manager/public/interfaces/animation s.mojom.h"
13 #include "ui/gfx/animation/tween.h"
14 #include "ui/gfx/transform.h"
15
16 namespace view_manager {
17
18 class ServerView;
19
20 struct ScheduledAnimationValue {
21 ScheduledAnimationValue();
22 ~ScheduledAnimationValue();
23
24 float float_value;
25 gfx::Transform transform;
26 };
27
28 struct ScheduledAnimationElement {
29 ScheduledAnimationElement();
30 ~ScheduledAnimationElement();
31
32 mojo::AnimationProperty property;
33 base::TimeDelta duration;
34 gfx::Tween::Type tween_type;
35 bool is_start_valid;
36 ScheduledAnimationValue start_value;
37 ScheduledAnimationValue target_value;
38 // Start time is based on scheduled time and relative to any other elements
39 // in the sequence.
40 base::TimeTicks start_time;
41 };
42
43 struct ScheduledAnimationSequence {
44 ScheduledAnimationSequence();
45 ~ScheduledAnimationSequence();
46
47 bool run_until_stopped;
48 std::vector<ScheduledAnimationElement> elements;
49
50 // Sum of the duration of all elements. This does not take into account
51 // |cycle_count|.
52 base::TimeDelta duration;
53
54 // The following values are updated as the animation progresses.
55
56 // Number of cycles remaining. This is only used if |run_until_stopped| is
57 // false.
58 uint32_t cycle_count;
59
60 // Index into |elements| of the element currently animating.
61 size_t current_index;
62 };
63
64 // Corresponds to a mojo::AnimationGroup and is responsible for running the
65 // actual animation.
66 class ScheduledAnimationGroup {
67 public:
68 ~ScheduledAnimationGroup();
69
70 // Returns a new ScheduledAnimationGroup from the supplied parameters, or
71 // null if |transport_group| isn't valid.
72 static scoped_ptr<ScheduledAnimationGroup> Create(
73 ServerView* view,
74 base::TimeTicks now,
75 uint32_t id,
76 const mojo::AnimationGroup& transport_group);
77
78 uint32_t id() const { return id_; }
79
80 // Gets the start value for any elements that don't have an explicit start.
81 // value.
82 void ObtainStartValues();
83
84 // Sets the values of any properties that are not in |other| to their final
85 // value.
86 void SetValuesToTargetValuesForPropertiesNotIn(
87 const ScheduledAnimationGroup& other);
88
89 // Advances the group. |time| is the current time. Returns true if the group
90 // is done (nothing left to animate).
91 bool Tick(base::TimeTicks time);
92
93 ServerView* view() { return view_; }
94
95 private:
96 ScheduledAnimationGroup(ServerView* view,
97 uint32_t id,
98 base::TimeTicks time_scheduled);
99
100 ServerView* view_;
101 const uint32_t id_;
102 base::TimeTicks time_scheduled_;
103 std::vector<ScheduledAnimationSequence> sequences_;
104
105 DISALLOW_COPY_AND_ASSIGN(ScheduledAnimationGroup);
106 };
107
108 } // namespace view_manager
109
110 #endif // SERVICES_VIEW_MANAGER_SCHEDULED_ANIMATION_GROUP_H_
OLDNEW
« no previous file with comments | « mojo/services/view_manager/main.cc ('k') | mojo/services/view_manager/scheduled_animation_group.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698