Chromium Code Reviews| Index: third_party/WebKit/public/platform/modules/device_orientation/WebDeviceMotionData.h |
| diff --git a/third_party/WebKit/Source/modules/device_orientation/DeviceMotionDispatcher.h b/third_party/WebKit/public/platform/modules/device_orientation/WebDeviceMotionData.h |
| similarity index 53% |
| copy from third_party/WebKit/Source/modules/device_orientation/DeviceMotionDispatcher.h |
| copy to third_party/WebKit/public/platform/modules/device_orientation/WebDeviceMotionData.h |
| index 97b0f61fae8dde69e4fe428c28d509cde0463be5..b796761181a387c01e8ad8ec8642d1639f51dc4e 100644 |
| --- a/third_party/WebKit/Source/modules/device_orientation/DeviceMotionDispatcher.h |
| +++ b/third_party/WebKit/public/platform/modules/device_orientation/WebDeviceMotionData.h |
| @@ -1,5 +1,5 @@ |
| /* |
| - * Copyright (C) 2013 Google Inc. All rights reserved. |
| + * Copyright (C) 2017 Google Inc. All rights reserved. |
| * |
| * Redistribution and use in source and binary forms, with or without |
| * modification, are permitted provided that the following conditions are |
| @@ -28,53 +28,55 @@ |
| * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| */ |
| -#ifndef DeviceMotionDispatcher_h |
| -#define DeviceMotionDispatcher_h |
| +#ifndef WebDeviceMotionData_h |
| +#define WebDeviceMotionData_h |
| -#include "core/frame/PlatformEventDispatcher.h" |
| -#include "platform/heap/Handle.h" |
| -#include "platform/wtf/RefPtr.h" |
| -#include "public/platform/modules/device_orientation/WebDeviceMotionListener.h" |
| - |
| -namespace device { |
| -class MotionData; |
|
timvolodine
2017/05/23 12:33:40
I think this was introduced previously to get rid
juncai
2017/05/23 21:33:55
Since the //device/sensors directory will be remov
timvolodine
2017/05/24 15:30:16
The WebDevice*Data classes were explicitly removed
juncai
2017/05/26 02:38:53
These POD definitions will eventually be removed w
|
| -} |
| +#include <string.h> |
| namespace blink { |
| -class DeviceMotionData; |
| - |
| -// This class listens to device motion data and notifies all registered |
| -// controllers. |
| -class DeviceMotionDispatcher final |
| - : public GarbageCollectedFinalized<DeviceMotionDispatcher>, |
| - public PlatformEventDispatcher, |
| - public WebDeviceMotionListener { |
| - USING_GARBAGE_COLLECTED_MIXIN(DeviceMotionDispatcher); |
| - |
| +class WebDeviceMotionData { |
| public: |
| - static DeviceMotionDispatcher& Instance(); |
| - ~DeviceMotionDispatcher() override; |
| + WebDeviceMotionData() |
| + : has_acceleration_x(false), |
| + has_acceleration_y(false), |
| + has_acceleration_z(false), |
| + has_acceleration_including_gravity_x(false), |
| + has_acceleration_including_gravity_y(false), |
| + has_acceleration_including_gravity_z(false), |
| + has_rotation_rate_alpha(false), |
| + has_rotation_rate_beta(false), |
| + has_rotation_rate_gamma(false) {} |
| + WebDeviceMotionData(const WebDeviceMotionData& other) = default; |
| + ~WebDeviceMotionData() {} |
| + |
| + double acceleration_x; |
| + double acceleration_y; |
| + double acceleration_z; |
| - // Note that the returned object is owned by this class. |
| - // FIXME: make the return value const, see crbug.com/233174. |
| - DeviceMotionData* LatestDeviceMotionData(); |
| + double acceleration_including_gravity_x; |
| + double acceleration_including_gravity_y; |
| + double acceleration_including_gravity_z; |
| - // Inherited from WebDeviceMotionListener. |
| - void DidChangeDeviceMotion(const device::MotionData&) override; |
| + double rotation_rate_alpha; |
| + double rotation_rate_beta; |
| + double rotation_rate_gamma; |
| - DECLARE_VIRTUAL_TRACE(); |
| + double interval; |
| - private: |
| - DeviceMotionDispatcher(); |
| + bool has_acceleration_x : 1; |
| + bool has_acceleration_y : 1; |
| + bool has_acceleration_z : 1; |
| - // Inherited from PlatformEventDispatcher. |
| - void StartListening() override; |
| - void StopListening() override; |
| + bool has_acceleration_including_gravity_x : 1; |
| + bool has_acceleration_including_gravity_y : 1; |
| + bool has_acceleration_including_gravity_z : 1; |
| - Member<DeviceMotionData> last_device_motion_data_; |
| + bool has_rotation_rate_alpha : 1; |
| + bool has_rotation_rate_beta : 1; |
| + bool has_rotation_rate_gamma : 1; |
| }; |
| } // namespace blink |
| -#endif // DeviceMotionDispatcher_h |
| +#endif // WebDeviceMotionData_h |