OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CONTENT_RENDERER_DEVICE_SENSORS_DEVICE_LIGHT_EVENT_PUMP_H_ |
| 6 #define CONTENT_RENDERER_DEVICE_SENSORS_DEVICE_LIGHT_EVENT_PUMP_H_ |
| 7 |
| 8 #include "base/memory/scoped_ptr.h" |
| 9 #include "content/renderer/device_sensors/device_sensor_event_pump.h" |
| 10 #include "content/renderer/shared_memory_seqlock_reader.h" |
| 11 |
| 12 namespace blink { |
| 13 class WebDeviceLightListener; |
| 14 } |
| 15 |
| 16 namespace content { |
| 17 |
| 18 typedef SharedMemorySeqLockReader<double> |
| 19 DeviceLightSharedMemoryReader; |
| 20 |
| 21 class CONTENT_EXPORT DeviceLightEventPump : public DeviceSensorEventPump { |
| 22 public: |
| 23 DeviceLightEventPump(); |
| 24 explicit DeviceLightEventPump(int pump_delay_millis); |
| 25 virtual ~DeviceLightEventPump(); |
| 26 |
| 27 // Sets the listener to receive updates for device light data at |
| 28 // regular intervals. Returns true if the registration was successful. |
| 29 bool SetListener(blink::WebDeviceLightListener* listener); |
| 30 |
| 31 // RenderProcessObserver implementation. |
| 32 virtual bool OnControlMessageReceived(const IPC::Message& message) OVERRIDE; |
| 33 |
| 34 protected: |
| 35 virtual void FireEvent() OVERRIDE; |
| 36 virtual bool InitializeReader(base::SharedMemoryHandle handle) OVERRIDE; |
| 37 virtual bool SendStartMessage() OVERRIDE; |
| 38 virtual bool SendStopMessage() OVERRIDE; |
| 39 |
| 40 blink::WebDeviceLightListener* listener_; |
| 41 scoped_ptr<DeviceLightSharedMemoryReader> reader_; |
| 42 }; |
| 43 |
| 44 } // namespace content |
| 45 |
| 46 #endif // CONTENT_RENDERER_DEVICE_SENSORS_DEVICE_LIGHT_EVENT_PUMP_H_ |
OLD | NEW |