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

Side by Side Diff: third_party/WebKit/Source/modules/device_orientation/DeviceMotionData.h

Issue 2720943002: Implement DeviceMotionEvent constructor. (Closed)
Patch Set: Reference Candidate Recommendation. Created 3 years, 9 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
1 /* 1 /*
2 * Copyright (C) 2010 Apple Inc. All rights reserved. 2 * Copyright (C) 2010 Apple Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * * Redistributions of source code must retain the above copyright 7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright 9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 12 matching lines...) Expand all
23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24 */ 24 */
25 25
26 #ifndef DeviceMotionData_h 26 #ifndef DeviceMotionData_h
27 #define DeviceMotionData_h 27 #define DeviceMotionData_h
28 28
29 #include "platform/heap/Handle.h" 29 #include "platform/heap/Handle.h"
30 30
31 namespace blink { 31 namespace blink {
32 32
33 class DeviceAccelerationInit;
34 class DeviceMotionEventInit;
35 class DeviceRotationRateInit;
33 class WebDeviceMotionData; 36 class WebDeviceMotionData;
34 37
35 class DeviceMotionData final : public GarbageCollected<DeviceMotionData> { 38 class DeviceMotionData final : public GarbageCollected<DeviceMotionData> {
36 public: 39 public:
37 class Acceleration final 40 class Acceleration final
38 : public GarbageCollected<DeviceMotionData::Acceleration> { 41 : public GarbageCollected<DeviceMotionData::Acceleration> {
39 public: 42 public:
40 static Acceleration* create(bool canProvideX, 43 static Acceleration* create(bool canProvideX,
41 double x, 44 double x,
42 bool canProvideY, 45 bool canProvideY,
43 double y, 46 double y,
44 bool canProvideZ, 47 bool canProvideZ,
45 double z); 48 double z);
49 static Acceleration* create(const DeviceAccelerationInit&);
46 DEFINE_INLINE_TRACE() {} 50 DEFINE_INLINE_TRACE() {}
47 51
48 bool canProvideX() const { return m_canProvideX; } 52 bool canProvideX() const { return m_canProvideX; }
49 bool canProvideY() const { return m_canProvideY; } 53 bool canProvideY() const { return m_canProvideY; }
50 bool canProvideZ() const { return m_canProvideZ; } 54 bool canProvideZ() const { return m_canProvideZ; }
51 55
52 double x() const { return m_x; } 56 double x() const { return m_x; }
53 double y() const { return m_y; } 57 double y() const { return m_y; }
54 double z() const { return m_z; } 58 double z() const { return m_z; }
55 59
(...skipping 16 matching lines...) Expand all
72 76
73 class RotationRate final 77 class RotationRate final
74 : public GarbageCollected<DeviceMotionData::RotationRate> { 78 : public GarbageCollected<DeviceMotionData::RotationRate> {
75 public: 79 public:
76 static RotationRate* create(bool canProvideAlpha, 80 static RotationRate* create(bool canProvideAlpha,
77 double alpha, 81 double alpha,
78 bool canProvideBeta, 82 bool canProvideBeta,
79 double beta, 83 double beta,
80 bool canProvideGamma, 84 bool canProvideGamma,
81 double gamma); 85 double gamma);
86 static RotationRate* create(const DeviceRotationRateInit&);
82 DEFINE_INLINE_TRACE() {} 87 DEFINE_INLINE_TRACE() {}
83 88
84 bool canProvideAlpha() const { return m_canProvideAlpha; } 89 bool canProvideAlpha() const { return m_canProvideAlpha; }
85 bool canProvideBeta() const { return m_canProvideBeta; } 90 bool canProvideBeta() const { return m_canProvideBeta; }
86 bool canProvideGamma() const { return m_canProvideGamma; } 91 bool canProvideGamma() const { return m_canProvideGamma; }
87 92
88 double alpha() const { return m_alpha; } 93 double alpha() const { return m_alpha; }
89 double beta() const { return m_beta; } 94 double beta() const { return m_beta; }
90 double gamma() const { return m_gamma; } 95 double gamma() const { return m_gamma; }
91 96
(...skipping 13 matching lines...) Expand all
105 bool m_canProvideBeta; 110 bool m_canProvideBeta;
106 bool m_canProvideGamma; 111 bool m_canProvideGamma;
107 }; 112 };
108 113
109 static DeviceMotionData* create(); 114 static DeviceMotionData* create();
110 static DeviceMotionData* create(Acceleration*, 115 static DeviceMotionData* create(Acceleration*,
111 Acceleration* accelerationIncludingGravity, 116 Acceleration* accelerationIncludingGravity,
112 RotationRate*, 117 RotationRate*,
113 bool canProvideInterval, 118 bool canProvideInterval,
114 double interval); 119 double interval);
120 static DeviceMotionData* create(const DeviceMotionEventInit&);
115 static DeviceMotionData* create(const WebDeviceMotionData&); 121 static DeviceMotionData* create(const WebDeviceMotionData&);
116 DECLARE_TRACE(); 122 DECLARE_TRACE();
117 123
118 Acceleration* getAcceleration() const { return m_acceleration.get(); } 124 Acceleration* getAcceleration() const { return m_acceleration.get(); }
119 Acceleration* getAccelerationIncludingGravity() const { 125 Acceleration* getAccelerationIncludingGravity() const {
120 return m_accelerationIncludingGravity.get(); 126 return m_accelerationIncludingGravity.get();
121 } 127 }
122 RotationRate* getRotationRate() const { return m_rotationRate.get(); } 128 RotationRate* getRotationRate() const { return m_rotationRate.get(); }
123 129
124 bool canProvideInterval() const { return m_canProvideInterval; } 130 bool canProvideInterval() const { return m_canProvideInterval; }
(...skipping 12 matching lines...) Expand all
137 Member<Acceleration> m_acceleration; 143 Member<Acceleration> m_acceleration;
138 Member<Acceleration> m_accelerationIncludingGravity; 144 Member<Acceleration> m_accelerationIncludingGravity;
139 Member<RotationRate> m_rotationRate; 145 Member<RotationRate> m_rotationRate;
140 bool m_canProvideInterval; 146 bool m_canProvideInterval;
141 double m_interval; 147 double m_interval;
142 }; 148 };
143 149
144 } // namespace blink 150 } // namespace blink
145 151
146 #endif // DeviceMotionData_h 152 #endif // DeviceMotionData_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698