| 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 12 matching lines...) Expand all Loading... |
| 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 <wtf/PassRefPtr.h> | 29 #include <wtf/PassRefPtr.h> |
| 30 #include <wtf/RefCounted.h> | 30 #include <wtf/RefCounted.h> |
| 31 #include <wtf/RefPtr.h> | 31 #include <wtf/RefPtr.h> |
| 32 | 32 |
| 33 namespace WebKit { |
| 34 class WebDeviceMotionData; |
| 35 } |
| 36 |
| 33 namespace WebCore { | 37 namespace WebCore { |
| 34 | 38 |
| 35 class DeviceMotionData : public RefCounted<DeviceMotionData> { | 39 class DeviceMotionData : public RefCounted<DeviceMotionData> { |
| 36 public: | 40 public: |
| 37 class Acceleration : public RefCounted<DeviceMotionData::Acceleration> { | 41 class Acceleration : public RefCounted<DeviceMotionData::Acceleration> { |
| 38 public: | 42 public: |
| 39 static PassRefPtr<Acceleration> create(bool canProvideX, double x, bool
canProvideY, double y, bool canProvideZ, double z); | 43 static PassRefPtr<Acceleration> create(bool canProvideX, double x, bool
canProvideY, double y, bool canProvideZ, double z); |
| 40 | 44 |
| 41 bool canProvideX() const { return m_canProvideX; } | 45 bool canProvideX() const { return m_canProvideX; } |
| 42 bool canProvideY() const { return m_canProvideY; } | 46 bool canProvideY() const { return m_canProvideY; } |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 78 double m_gamma; | 82 double m_gamma; |
| 79 | 83 |
| 80 bool m_canProvideAlpha; | 84 bool m_canProvideAlpha; |
| 81 bool m_canProvideBeta; | 85 bool m_canProvideBeta; |
| 82 bool m_canProvideGamma; | 86 bool m_canProvideGamma; |
| 83 }; | 87 }; |
| 84 | 88 |
| 85 static PassRefPtr<DeviceMotionData> create(); | 89 static PassRefPtr<DeviceMotionData> create(); |
| 86 static PassRefPtr<DeviceMotionData> create(PassRefPtr<Acceleration> accelera
tion, PassRefPtr<Acceleration> accelerationIncludingGravity, | 90 static PassRefPtr<DeviceMotionData> create(PassRefPtr<Acceleration> accelera
tion, PassRefPtr<Acceleration> accelerationIncludingGravity, |
| 87 PassRefPtr<RotationRate> rotation
Rate, bool canProvideInterval, double interval); | 91 PassRefPtr<RotationRate> rotation
Rate, bool canProvideInterval, double interval); |
| 92 static PassRefPtr<DeviceMotionData> create(const WebKit::WebDeviceMotionData
&); |
| 88 | 93 |
| 89 PassRefPtr<Acceleration> acceleration() const { return m_acceleration; } | 94 PassRefPtr<Acceleration> acceleration() const { return m_acceleration; } |
| 90 PassRefPtr<Acceleration> accelerationIncludingGravity() const { return m_acc
elerationIncludingGravity; } | 95 PassRefPtr<Acceleration> accelerationIncludingGravity() const { return m_acc
elerationIncludingGravity; } |
| 91 PassRefPtr<RotationRate> rotationRate() const { return m_rotationRate; } | 96 PassRefPtr<RotationRate> rotationRate() const { return m_rotationRate; } |
| 92 | 97 |
| 93 bool canProvideInterval() const { return m_canProvideInterval; } | 98 bool canProvideInterval() const { return m_canProvideInterval; } |
| 94 double interval() const { return m_interval; } | 99 double interval() const { return m_interval; } |
| 95 | 100 |
| 96 private: | 101 private: |
| 97 DeviceMotionData(); | 102 DeviceMotionData(); |
| 98 DeviceMotionData(PassRefPtr<Acceleration> acceleration, PassRefPtr<Accelerat
ion> accelerationIncludingGravity, | 103 DeviceMotionData(PassRefPtr<Acceleration> acceleration, PassRefPtr<Accelerat
ion> accelerationIncludingGravity, |
| 99 PassRefPtr<RotationRate> rotationRate, bool canProvideInter
val, double interval); | 104 PassRefPtr<RotationRate> rotationRate, bool canProvideInter
val, double interval); |
| 100 | 105 |
| 101 RefPtr<Acceleration> m_acceleration; | 106 RefPtr<Acceleration> m_acceleration; |
| 102 RefPtr<Acceleration> m_accelerationIncludingGravity; | 107 RefPtr<Acceleration> m_accelerationIncludingGravity; |
| 103 RefPtr<RotationRate> m_rotationRate; | 108 RefPtr<RotationRate> m_rotationRate; |
| 104 bool m_canProvideInterval; | 109 bool m_canProvideInterval; |
| 105 double m_interval; | 110 double m_interval; |
| 106 }; | 111 }; |
| 107 | 112 |
| 108 } // namespace WebCore | 113 } // namespace WebCore |
| 109 | 114 |
| 110 #endif // DeviceMotionData_h | 115 #endif // DeviceMotionData_h |
| OLD | NEW |