Refactor WebsiteSettings to operate on a SecurityInfo
[chromium-blink-merge.git] / content / renderer / device_sensors / device_orientation_event_pump.h
blob8f0ce5ef55d81ae7cc3fdd98498cbcecfe4d7d50
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.
5 #ifndef CONTENT_RENDERER_DEVICE_SENSORS_DEVICE_ORIENTATION_EVENT_PUMP_H_
6 #define CONTENT_RENDERER_DEVICE_SENSORS_DEVICE_ORIENTATION_EVENT_PUMP_H_
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 #include "third_party/WebKit/public/platform/modules/device_orientation/WebDeviceOrientationData.h"
13 namespace blink {
14 class WebDeviceOrientationListener;
17 namespace content {
19 typedef SharedMemorySeqLockReader<blink::WebDeviceOrientationData>
20 DeviceOrientationSharedMemoryReader;
22 class CONTENT_EXPORT DeviceOrientationEventPump
23 : public DeviceSensorEventPump<blink::WebDeviceOrientationListener> {
24 public:
25 // Angle threshold beyond which two orientation events are considered
26 // sufficiently different.
27 static const double kOrientationThreshold;
29 explicit DeviceOrientationEventPump(RenderThread* thread);
30 ~DeviceOrientationEventPump() override;
32 // PlatformEventObserver.
33 bool OnControlMessageReceived(const IPC::Message& message) override;
34 void SendFakeDataForTesting(void* data) override;
36 protected:
37 void FireEvent() override;
38 bool InitializeReader(base::SharedMemoryHandle handle) override;
40 // PlatformEventObserver.
41 void SendStartMessage() override;
42 void SendStopMessage() override;
44 bool ShouldFireEvent(const blink::WebDeviceOrientationData& data) const;
46 blink::WebDeviceOrientationData data_;
47 scoped_ptr<DeviceOrientationSharedMemoryReader> reader_;
49 DISALLOW_COPY_AND_ASSIGN(DeviceOrientationEventPump);
52 } // namespace content
54 #endif // CONTENT_RENDERER_DEVICE_SENSORS_DEVICE_ORIENTATION_EVENT_PUMP_H_