OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2012 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. |
| 4 |
| 5 #ifndef CONTENT_RENDERER_DEVICE_MOTION_DISPATCHER_H_ |
| 6 #define CONTENT_RENDERER_DEVICE_MOTION_DISPATCHER_H_ |
| 7 |
| 8 #include "base/memory/scoped_ptr.h" |
| 9 #include "content/public/renderer/render_view_observer.h" |
| 10 #include "third_party/WebKit/Source/Platform/chromium/public/WebDeviceMotionData
.h" |
| 11 #include "third_party/WebKit/Source/Platform/chromium/public/WebDeviceMotionDete
ctor.h" |
| 12 |
| 13 class RenderViewImpl; |
| 14 |
| 15 namespace WebKit { |
| 16 class WebDeviceMotionDetectorClient; |
| 17 } |
| 18 |
| 19 struct DeviceMotionMsg_Updated_Params; |
| 20 |
| 21 class DeviceMotionDispatcher : public content::RenderViewObserver, |
| 22 public WebKit::WebDeviceMotionDetector { |
| 23 public: |
| 24 explicit DeviceMotionDispatcher(RenderViewImpl* render_view); |
| 25 virtual ~DeviceMotionDispatcher(); |
| 26 |
| 27 private: |
| 28 // RenderView::Observer implementation. |
| 29 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; |
| 30 |
| 31 // WebKit::WebDeviceMotionDetector implementation. |
| 32 virtual void startUpdating(WebKit::WebDeviceMotionDetectorClient* client) |
| 33 OVERRIDE; |
| 34 virtual void stopUpdating() OVERRIDE; |
| 35 virtual WebKit::WebDeviceMotionData lastMotion() const OVERRIDE; |
| 36 |
| 37 void OnDeviceMotionUpdated( |
| 38 const DeviceMotionMsg_Updated_Params& p); |
| 39 |
| 40 scoped_ptr<WebKit::WebDeviceMotionDetectorClient> client_; |
| 41 WebKit::WebDeviceMotionData last_motion_; |
| 42 bool started_; |
| 43 }; |
| 44 |
| 45 #endif // CONTENT_RENDERER_DEVICE_MOTION_DISPATCHER_H_ |
OLD | NEW |