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