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

Unified Diff: content/renderer/device_motion_dispatcher.h

Issue 10698046: Implements part of Device Motion in the Renderer (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 8 years, 6 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
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_

Powered by Google App Engine
This is Rietveld 408576698