Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(575)

Side by Side Diff: content/renderer/device_motion_event_pump.h

Issue 14678012: Implement the content/renderer and content/browser part of the Device Motion API. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 7 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(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/time.h"
11 #include "third_party/WebKit/Source/Platform/chromium/public/WebDeviceMotionHand ler.h"
12
13 namespace WebKit {
14 class WebDeviceMotionData;
15 class WebDeviceMotionListener;
16 }
17
18 namespace content {
19
20 class DeviceMotionSharedMemoryReader;
21
22 class DeviceMotionEventPump : public WebKit::WebDeviceMotionHandler {
23 public:
24 DeviceMotionEventPump();
25 virtual ~DeviceMotionEventPump();
26
27 // Delay between subsequent firing of events.
28 const static double pump_delay_millis = 40;
jamesr 2013/05/16 19:53:06 put the definition in a translation unit or you'll
timvolodine 2013/05/20 18:18:48 Done.
29
30 // Sets the listener to receive updates for device motion data at
31 // regular intervals.
32 virtual void startListeningToDeviceMotion(
33 WebKit::WebDeviceMotionListener*) OVERRIDE;
34
35 // Removes the current listener after which it will not receive any updates.
36 virtual void stopListeningToDeviceMotion() OVERRIDE;
37
38 private:
39 WebKit::WebDeviceMotionListener* listener_;
40
41 void fire();
42 bool shouldFireEvent(WebKit::WebDeviceMotionData&);
43
44 bool fire_pending_;
45 base::TimeTicks last_fire_event_time_;
46 scoped_ptr<DeviceMotionSharedMemoryReader> reader_;
47 base::TimeDelta pump_delay_;
48 };
49
50 } // namespace content
51
52 #endif // CONTENT_RENDERER_DEVICE_MOTION_EVENT_PUMP_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698