OLD | NEW |
---|---|
(Empty) | |
1 // Copyright (c) 2013 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_MOTION_EVENT_PUMP_H_ | |
6 #define CONTENT_RENDERER_DEVICE_MOTION_EVENT_PUMP_H_ | |
7 | |
8 #include "base/memory/scoped_ptr.h" | |
9 #include "base/shared_memory.h" | |
10 #include "base/timer.h" | |
11 | |
12 #include "third_party/WebKit/Source/Platform/chromium/public/WebDeviceMotionList ener.h" | |
13 | |
14 namespace WebKit { | |
15 class WebDeviceMotionData; | |
16 class WebDeviceMotionListener; | |
17 } | |
18 | |
19 namespace content { | |
20 | |
21 class DeviceMotionSharedMemoryReader; | |
22 | |
23 class DeviceMotionEventPump : public WebKit::WebDeviceMotionListener { | |
24 public: | |
25 DeviceMotionEventPump(); | |
26 virtual ~DeviceMotionEventPump(); | |
27 | |
28 // Sets the listener to receive updates for device motion data at | |
29 // regular intervals. | |
30 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.
| |
31 | |
32 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.
| |
33 const WebKit::WebDeviceMotionData&) OVERRIDE; | |
34 | |
35 virtual void setDeviceMotionReader(DeviceMotionSharedMemoryReader*); | |
darin (slow to review)
2013/05/29 06:41:53
why virtual?
timvolodine
2013/05/29 18:59:06
Done.
| |
36 | |
37 private: | |
38 // Delay between subsequent firing of events. | |
39 static const double kPumpDelayMillis; | |
40 | |
41 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.
| |
42 void stopFetchingDeviceMotion(); | |
43 void fireEvent(); | |
44 | |
45 WebKit::WebDeviceMotionListener* listener_; | |
46 scoped_ptr<DeviceMotionSharedMemoryReader> reader_; | |
47 base::RepeatingTimer<DeviceMotionEventPump> timer_; | |
48 }; | |
49 | |
50 } // namespace content | |
51 | |
52 #endif // CONTENT_RENDERER_DEVICE_MOTION_EVENT_PUMP_H_ | |
OLD | NEW |