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