Chromium Code Reviews| Index: content/renderer/device_orientation/device_motion_event_pump.h |
| diff --git a/content/renderer/device_orientation/device_motion_event_pump.h b/content/renderer/device_orientation/device_motion_event_pump.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..551d61e32d639f960eaab848535d12fc7c96a23f |
| --- /dev/null |
| +++ b/content/renderer/device_orientation/device_motion_event_pump.h |
| @@ -0,0 +1,52 @@ |
| +// Copyright (c) 2013 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef CONTENT_RENDERER_DEVICE_MOTION_EVENT_PUMP_H_ |
| +#define CONTENT_RENDERER_DEVICE_MOTION_EVENT_PUMP_H_ |
| + |
| +#include "base/memory/scoped_ptr.h" |
| +#include "base/shared_memory.h" |
| +#include "base/timer.h" |
| + |
| +#include "third_party/WebKit/Source/Platform/chromium/public/WebDeviceMotionListener.h" |
| + |
| +namespace WebKit { |
| +class WebDeviceMotionData; |
| +class WebDeviceMotionListener; |
| +} |
| + |
| +namespace content { |
| + |
| +class DeviceMotionSharedMemoryReader; |
| + |
| +class DeviceMotionEventPump : public WebKit::WebDeviceMotionListener { |
| + public: |
| + DeviceMotionEventPump(); |
| + virtual ~DeviceMotionEventPump(); |
| + |
| + // Sets the listener to receive updates for device motion data at |
| + // regular intervals. |
| + virtual void setListener(WebKit::WebDeviceMotionListener*) OVERRIDE; |
|
darin (slow to review)
2013/05/29 06:41:53
s/setListener/SetListener/? not an OVERRIDE. doe
timvolodine
2013/05/29 18:59:06
Done.
|
| + |
| + virtual void didChangeDeviceMotion( |
|
darin (slow to review)
2013/05/29 06:41:53
nit: add a comment indicating that this is the imp
timvolodine
2013/05/29 18:59:06
Done.
|
| + const WebKit::WebDeviceMotionData&) OVERRIDE; |
| + |
| + virtual void setDeviceMotionReader(DeviceMotionSharedMemoryReader*); |
|
darin (slow to review)
2013/05/29 06:41:53
why virtual?
timvolodine
2013/05/29 18:59:06
Done.
|
| + |
| + private: |
| + // Delay between subsequent firing of events. |
| + static const double kPumpDelayMillis; |
| + |
| + void startFetchingDeviceMotion(); |
|
darin (slow to review)
2013/05/29 06:41:53
nit: use google C++ style for method naming
timvolodine
2013/05/29 18:59:06
Done.
|
| + void stopFetchingDeviceMotion(); |
| + void fireEvent(); |
| + |
| + WebKit::WebDeviceMotionListener* listener_; |
| + scoped_ptr<DeviceMotionSharedMemoryReader> reader_; |
| + base::RepeatingTimer<DeviceMotionEventPump> timer_; |
| +}; |
| + |
| +} // namespace content |
| + |
| +#endif // CONTENT_RENDERER_DEVICE_MOTION_EVENT_PUMP_H_ |