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..63c5359e300b6f7bd2f5e49a83c81ad9a9be5d23 |
--- /dev/null |
+++ b/content/renderer/device_motion_dispatcher.h |
@@ -0,0 +1,44 @@ |
+// 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/WebKit/chromium/public/WebDeviceMotionClient.h" |
+#include "third_party/WebKit/Source/WebKit/chromium/public/WebDeviceMotionController.h" |
+#include "third_party/WebKit/Source/WebKit/chromium/public/WebDeviceMotionData.h" |
+ |
+#include "base/memory/scoped_ptr.h" |
+#include "content/public/renderer/render_view_observer.h" |
+ |
+class RenderViewImpl; |
+ |
+struct DeviceMotionMsg_Updated_Params; |
+ |
+class DeviceMotionDispatcher : public content::RenderViewObserver, |
+ public WebKit::WebDeviceMotionClient { |
+ public: |
+ explicit DeviceMotionDispatcher(RenderViewImpl* render_view); |
+ virtual ~DeviceMotionDispatcher(); |
+ |
+ private: |
+ // RenderView::Observer implementation. |
+ virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; |
+ |
+ // From WebKit::WebDeviceMotionClient. |
+ virtual void setController( |
+ WebKit::WebDeviceMotionController& controller) OVERRIDE; |
+ virtual void startUpdating() OVERRIDE; |
+ virtual void stopUpdating() OVERRIDE; |
+ virtual WebKit::WebDeviceMotionData lastMotion() const OVERRIDE; |
+ |
+ void OnDeviceMotionUpdated( |
+ const DeviceMotionMsg_Updated_Params& p); |
+ |
+ WebKit::WebDeviceMotionController controller_; |
+ WebKit::WebDeviceMotionData last_motion_; |
+ bool started_; |
+}; |
+ |
+#endif // CONTENT_RENDERER_DEVICE_MOTION_DISPATCHER_H_ |