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

Unified Diff: content/renderer/device_motion_dispatcher.h

Issue 10827415: Chromium-side implementation of DeviceMotion. Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Test should set the kEnableDeviceMotion flag Created 8 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/content_renderer.gypi ('k') | content/renderer/device_motion_dispatcher.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..b49622fc68ad3901f9d5e4ebb0bdacf00b22671f
--- /dev/null
+++ b/content/renderer/device_motion_dispatcher.h
@@ -0,0 +1,45 @@
+// 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 "base/memory/scoped_ptr.h"
+#include "content/public/renderer/render_view_observer.h"
+#include "third_party/WebKit/Source/Platform/chromium/public/WebDeviceMotionData.h"
+#include "third_party/WebKit/Source/Platform/chromium/public/WebDeviceMotionDetector.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_
« no previous file with comments | « content/content_renderer.gypi ('k') | content/renderer/device_motion_dispatcher.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698