Index: content/renderer/device_motion_dispatcher.h |
diff --git a/content/renderer/device_motion_dispatcher.h b/content/renderer/device_motion_dispatcher.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..3c7ac0c1e0d45c1136a55c05ed95df0d4985ebf8 |
--- /dev/null |
+++ b/content/renderer/device_motion_dispatcher.h |
@@ -0,0 +1,46 @@ |
+// Copyright (c) 2012 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_DISPATCHER_H_ |
+#define CONTENT_RENDERER_DEVICE_MOTION_DISPATCHER_H_ |
+ |
+#include "third_party/WebKit/Source/Platform/chromium/public/WebDeviceMotionDetector.h" |
+#include "third_party/WebKit/Source/Platform/chromium/public/WebDeviceMotionData.h" |
+ |
+#include "base/memory/scoped_ptr.h" |
+#include "content/public/renderer/render_view_observer.h" |
+ |
+class RenderViewImpl; |
+ |
+namespace WebKit { |
+class WebDeviceMotionDetectorClient; |
+} |
+ |
+struct DeviceMotionMsg_Updated_Params; |
+ |
+class DeviceMotionDispatcher : public content::RenderViewObserver, |
+ public WebKit::WebDeviceMotionDetector { |
+ public: |
+ explicit DeviceMotionDispatcher(RenderViewImpl* render_view); |
+ virtual ~DeviceMotionDispatcher(); |
+ |
+ private: |
+ // RenderView::Observer implementation. |
+ virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; |
+ |
+ // WebKit::WebDeviceMotionDetector implementation. |
+ virtual void startUpdating(WebKit::WebDeviceMotionDetectorClient* client) |
+ OVERRIDE; |
+ virtual void stopUpdating() OVERRIDE; |
+ virtual WebKit::WebDeviceMotionData lastMotion() const OVERRIDE; |
+ |
+ void OnDeviceMotionUpdated( |
+ const DeviceMotionMsg_Updated_Params& p); |
+ |
+ scoped_ptr<WebKit::WebDeviceMotionDetectorClient> client_; |
+ WebKit::WebDeviceMotionData last_motion_; |
+ bool started_; |
+}; |
+ |
+#endif // CONTENT_RENDERER_DEVICE_MOTION_DISPATCHER_H_ |