| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_MOTION_EVENT_PUMP_H_ | 5 #ifndef CONTENT_RENDERER_DEVICE_LIGHT_DEVICE_LIGHT_EVENT_PUMP_H_ |
| 6 #define CONTENT_RENDERER_DEVICE_MOTION_EVENT_PUMP_H_ | 6 #define CONTENT_RENDERER_DEVICE_LIGHT_DEVICE_LIGHT_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/WebDeviceMotionData.h" | |
| 12 | 11 |
| 13 namespace blink { | 12 namespace blink { |
| 14 class WebDeviceMotionListener; | 13 class WebDeviceLightListener; |
| 15 } | 14 } |
| 16 | 15 |
| 17 namespace content { | 16 namespace content { |
| 18 | 17 |
| 19 typedef SharedMemorySeqLockReader<blink::WebDeviceMotionData> | 18 typedef SharedMemorySeqLockReader<double> |
| 20 DeviceMotionSharedMemoryReader; | 19 DeviceLightSharedMemoryReader; |
| 21 | 20 |
| 22 class CONTENT_EXPORT DeviceMotionEventPump : public DeviceSensorEventPump { | 21 class CONTENT_EXPORT DeviceLightEventPump : public DeviceSensorEventPump { |
| 23 public: | 22 public: |
| 24 DeviceMotionEventPump(); | 23 DeviceLightEventPump(); |
| 25 explicit DeviceMotionEventPump(int pump_delay_millis); | 24 explicit DeviceLightEventPump(int pump_delay_millis); |
| 26 virtual ~DeviceMotionEventPump(); | 25 virtual ~DeviceLightEventPump(); |
| 27 | 26 |
| 28 // Sets the listener to receive updates for device motion data at | 27 // Sets the listener to receive updates for device motion data at |
| 29 // regular intervals. Returns true if the registration was successful. | 28 // regular intervals. Returns true if the registration was successful. |
| 30 bool SetListener(blink::WebDeviceMotionListener* listener); | 29 bool SetListener(blink::WebDeviceLightListener* listener); |
| 31 | 30 |
| 32 // RenderProcessObserver implementation. | 31 // RenderProcessObserver implementation. |
| 33 virtual bool OnControlMessageReceived(const IPC::Message& message) OVERRIDE; | 32 virtual bool OnControlMessageReceived(const IPC::Message& message) OVERRIDE; |
| 34 | 33 |
| 35 protected: | 34 protected: |
| 36 virtual void FireEvent() OVERRIDE; | 35 virtual void FireEvent() OVERRIDE; |
| 37 virtual bool InitializeReader(base::SharedMemoryHandle handle) OVERRIDE; | 36 virtual bool InitializeReader(base::SharedMemoryHandle handle) OVERRIDE; |
| 38 virtual bool SendStartMessage() OVERRIDE; | 37 virtual bool SendStartMessage() OVERRIDE; |
| 39 virtual bool SendStopMessage() OVERRIDE; | 38 virtual bool SendStopMessage() OVERRIDE; |
| 40 | 39 |
| 41 blink::WebDeviceMotionListener* listener_; | 40 blink::WebDeviceLightListener* listener_; |
| 42 scoped_ptr<DeviceMotionSharedMemoryReader> reader_; | 41 scoped_ptr<DeviceLightSharedMemoryReader> reader_; |
| 43 }; | 42 }; |
| 44 | 43 |
| 45 } // namespace content | 44 } // namespace content |
| 46 | 45 |
| 47 #endif // CONTENT_RENDERER_DEVICE_MOTION_EVENT_PUMP_H_ | 46 #endif // CONTENT_RENDERER_DEVICE_LIGHT_DEVICE_LIGHT_EVENT_PUMP_H_ |
| OLD | NEW |