| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CONTENT_RENDERER_DEVICE_ORIENTATION_EVENT_PUMP_H_ | 5 #ifndef CONTENT_RENDERER_DEVICE_ORIENTATION_EVENT_PUMP_H_ |
| 6 #define CONTENT_RENDERER_DEVICE_ORIENTATION_EVENT_PUMP_H_ | 6 #define CONTENT_RENDERER_DEVICE_ORIENTATION_EVENT_PUMP_H_ |
| 7 | 7 |
| 8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
| 9 #include "content/renderer/device_orientation/device_sensor_event_pump.h" | 9 #include "content/renderer/device_orientation/device_sensor_event_pump.h" |
| 10 #include "content/renderer/shared_memory_seqlock_reader.h" | 10 #include "content/renderer/shared_memory_seqlock_reader.h" |
| 11 #include "third_party/WebKit/public/platform/WebDeviceOrientationData.h" | 11 #include "third_party/WebKit/public/platform/WebDeviceOrientationData.h" |
| 12 | 12 |
| 13 namespace WebKit { | 13 namespace blink { |
| 14 class WebDeviceOrientationListener; | 14 class WebDeviceOrientationListener; |
| 15 } | 15 } |
| 16 | 16 |
| 17 namespace content { | 17 namespace content { |
| 18 | 18 |
| 19 typedef SharedMemorySeqLockReader<WebKit::WebDeviceOrientationData> | 19 typedef SharedMemorySeqLockReader<blink::WebDeviceOrientationData> |
| 20 DeviceOrientationSharedMemoryReader; | 20 DeviceOrientationSharedMemoryReader; |
| 21 | 21 |
| 22 class CONTENT_EXPORT DeviceOrientationEventPump : public DeviceSensorEventPump { | 22 class CONTENT_EXPORT DeviceOrientationEventPump : public DeviceSensorEventPump { |
| 23 public: | 23 public: |
| 24 // Angle threshold beyond which two orientation events are considered | 24 // Angle threshold beyond which two orientation events are considered |
| 25 // sufficiently different. | 25 // sufficiently different. |
| 26 static const double kOrientationThreshold; | 26 static const double kOrientationThreshold; |
| 27 | 27 |
| 28 DeviceOrientationEventPump(); | 28 DeviceOrientationEventPump(); |
| 29 explicit DeviceOrientationEventPump(int pump_delay_millis); | 29 explicit DeviceOrientationEventPump(int pump_delay_millis); |
| 30 virtual ~DeviceOrientationEventPump(); | 30 virtual ~DeviceOrientationEventPump(); |
| 31 | 31 |
| 32 // Sets the listener to receive updates for device orientation data at | 32 // Sets the listener to receive updates for device orientation data at |
| 33 // regular intervals. Returns true if the registration was successful. | 33 // regular intervals. Returns true if the registration was successful. |
| 34 bool SetListener(WebKit::WebDeviceOrientationListener* listener); | 34 bool SetListener(blink::WebDeviceOrientationListener* listener); |
| 35 | 35 |
| 36 // RenderProcessObserver implementation. | 36 // RenderProcessObserver implementation. |
| 37 virtual bool OnControlMessageReceived(const IPC::Message& message) OVERRIDE; | 37 virtual bool OnControlMessageReceived(const IPC::Message& message) OVERRIDE; |
| 38 | 38 |
| 39 protected: | 39 protected: |
| 40 virtual void FireEvent() OVERRIDE; | 40 virtual void FireEvent() OVERRIDE; |
| 41 virtual bool InitializeReader(base::SharedMemoryHandle handle) OVERRIDE; | 41 virtual bool InitializeReader(base::SharedMemoryHandle handle) OVERRIDE; |
| 42 virtual bool SendStartMessage() OVERRIDE; | 42 virtual bool SendStartMessage() OVERRIDE; |
| 43 virtual bool SendStopMessage() OVERRIDE; | 43 virtual bool SendStopMessage() OVERRIDE; |
| 44 | 44 |
| 45 bool ShouldFireEvent(const WebKit::WebDeviceOrientationData& data) const; | 45 bool ShouldFireEvent(const blink::WebDeviceOrientationData& data) const; |
| 46 | 46 |
| 47 WebKit::WebDeviceOrientationListener* listener_; | 47 blink::WebDeviceOrientationListener* listener_; |
| 48 WebKit::WebDeviceOrientationData data_; | 48 blink::WebDeviceOrientationData data_; |
| 49 scoped_ptr<DeviceOrientationSharedMemoryReader> reader_; | 49 scoped_ptr<DeviceOrientationSharedMemoryReader> reader_; |
| 50 }; | 50 }; |
| 51 | 51 |
| 52 } // namespace content | 52 } // namespace content |
| 53 | 53 |
| 54 #endif // CONTENT_RENDERER_DEVICE_ORIENTATION_EVENT_PUMP_H_ | 54 #endif // CONTENT_RENDERER_DEVICE_ORIENTATION_EVENT_PUMP_H_ |
| OLD | NEW |