OLD | NEW |
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 10 matching lines...) Expand all Loading... |
21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
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 device { | |
32 class MotionData; | |
33 } | |
34 | |
35 namespace blink { | 31 namespace blink { |
36 | 32 |
37 class DeviceAccelerationInit; | 33 class DeviceAccelerationInit; |
38 class DeviceMotionEventInit; | 34 class DeviceMotionEventInit; |
39 class DeviceRotationRateInit; | 35 class DeviceRotationRateInit; |
| 36 class WebDeviceMotionData; |
40 | 37 |
41 class DeviceMotionData final : public GarbageCollected<DeviceMotionData> { | 38 class DeviceMotionData final : public GarbageCollected<DeviceMotionData> { |
42 public: | 39 public: |
43 class Acceleration final | 40 class Acceleration final |
44 : public GarbageCollected<DeviceMotionData::Acceleration> { | 41 : public GarbageCollected<DeviceMotionData::Acceleration> { |
45 public: | 42 public: |
46 static Acceleration* Create(bool can_provide_x, | 43 static Acceleration* Create(bool can_provide_x, |
47 double x, | 44 double x, |
48 bool can_provide_y, | 45 bool can_provide_y, |
49 double y, | 46 double y, |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
113 bool can_provide_beta_; | 110 bool can_provide_beta_; |
114 bool can_provide_gamma_; | 111 bool can_provide_gamma_; |
115 }; | 112 }; |
116 | 113 |
117 static DeviceMotionData* Create(); | 114 static DeviceMotionData* Create(); |
118 static DeviceMotionData* Create(Acceleration*, | 115 static DeviceMotionData* Create(Acceleration*, |
119 Acceleration* acceleration_including_gravity, | 116 Acceleration* acceleration_including_gravity, |
120 RotationRate*, | 117 RotationRate*, |
121 double interval); | 118 double interval); |
122 static DeviceMotionData* Create(const DeviceMotionEventInit&); | 119 static DeviceMotionData* Create(const DeviceMotionEventInit&); |
123 static DeviceMotionData* Create(const device::MotionData&); | 120 static DeviceMotionData* Create(const WebDeviceMotionData&); |
124 DECLARE_TRACE(); | 121 DECLARE_TRACE(); |
125 | 122 |
126 Acceleration* GetAcceleration() const { return acceleration_.Get(); } | 123 Acceleration* GetAcceleration() const { return acceleration_.Get(); } |
127 Acceleration* GetAccelerationIncludingGravity() const { | 124 Acceleration* GetAccelerationIncludingGravity() const { |
128 return acceleration_including_gravity_.Get(); | 125 return acceleration_including_gravity_.Get(); |
129 } | 126 } |
130 RotationRate* GetRotationRate() const { return rotation_rate_.Get(); } | 127 RotationRate* GetRotationRate() const { return rotation_rate_.Get(); } |
131 | 128 |
132 double Interval() const { return interval_; } | 129 double Interval() const { return interval_; } |
133 | 130 |
134 bool CanProvideEventData() const; | 131 bool CanProvideEventData() const; |
135 | 132 |
136 private: | 133 private: |
137 DeviceMotionData(); | 134 DeviceMotionData(); |
138 DeviceMotionData(Acceleration*, | 135 DeviceMotionData(Acceleration*, |
139 Acceleration* acceleration_including_gravity, | 136 Acceleration* acceleration_including_gravity, |
140 RotationRate*, | 137 RotationRate*, |
141 double interval); | 138 double interval); |
142 | 139 |
143 Member<Acceleration> acceleration_; | 140 Member<Acceleration> acceleration_; |
144 Member<Acceleration> acceleration_including_gravity_; | 141 Member<Acceleration> acceleration_including_gravity_; |
145 Member<RotationRate> rotation_rate_; | 142 Member<RotationRate> rotation_rate_; |
146 double interval_; | 143 double interval_; |
147 }; | 144 }; |
148 | 145 |
149 } // namespace blink | 146 } // namespace blink |
150 | 147 |
151 #endif // DeviceMotionData_h | 148 #endif // DeviceMotionData_h |
OLD | NEW |