| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CHROME_RENDERER_DEVICE_ORIENTATION_DISPATCHER_H_ | 5 #ifndef CHROME_RENDERER_DEVICE_ORIENTATION_DISPATCHER_H_ |
| 6 #define CHROME_RENDERER_DEVICE_ORIENTATION_DISPATCHER_H_ | 6 #define CHROME_RENDERER_DEVICE_ORIENTATION_DISPATCHER_H_ |
| 7 | 7 |
| 8 #include "third_party/WebKit/WebKit/chromium/public/WebDeviceOrientationClient.h
" | 8 #include "third_party/WebKit/WebKit/chromium/public/WebDeviceOrientationClient.h
" |
| 9 | 9 |
| 10 #include "chrome/common/render_messages.h" | 10 #include "base/scoped_ptr.h" |
| 11 | 11 |
| 12 class RenderView; | 12 class RenderView; |
| 13 namespace IPC { class Message; } | 13 namespace IPC { class Message; } |
| 14 | 14 |
| 15 struct ViewMsg_DeviceOrientationUpdated_Params; |
| 16 |
| 15 class DeviceOrientationDispatcher : public WebKit::WebDeviceOrientationClient { | 17 class DeviceOrientationDispatcher : public WebKit::WebDeviceOrientationClient { |
| 16 public: | 18 public: |
| 17 explicit DeviceOrientationDispatcher(RenderView* render_view); | 19 explicit DeviceOrientationDispatcher(RenderView* render_view); |
| 18 virtual ~DeviceOrientationDispatcher(); | 20 virtual ~DeviceOrientationDispatcher(); |
| 19 | 21 |
| 20 bool OnMessageReceived(const IPC::Message& msg); | 22 bool OnMessageReceived(const IPC::Message& msg); |
| 21 | 23 |
| 22 // From WebKit::WebDeviceOrientationClient. | 24 // From WebKit::WebDeviceOrientationClient. |
| 23 virtual void setController( | 25 virtual void setController( |
| 24 WebKit::WebDeviceOrientationController* controller); | 26 WebKit::WebDeviceOrientationController* controller); |
| 25 virtual void startUpdating(); | 27 virtual void startUpdating(); |
| 26 virtual void stopUpdating(); | 28 virtual void stopUpdating(); |
| 27 virtual WebKit::WebDeviceOrientation lastOrientation() const; | 29 virtual WebKit::WebDeviceOrientation lastOrientation() const; |
| 28 | 30 |
| 29 private: | 31 private: |
| 30 void OnDeviceOrientationUpdated( | 32 void OnDeviceOrientationUpdated( |
| 31 const ViewMsg_DeviceOrientationUpdated_Params& p); | 33 const ViewMsg_DeviceOrientationUpdated_Params& p); |
| 32 | 34 |
| 33 RenderView* render_view_; | 35 RenderView* render_view_; |
| 34 scoped_ptr<WebKit::WebDeviceOrientationController> controller_; | 36 scoped_ptr<WebKit::WebDeviceOrientationController> controller_; |
| 35 scoped_ptr<ViewMsg_DeviceOrientationUpdated_Params> last_update_; | 37 scoped_ptr<ViewMsg_DeviceOrientationUpdated_Params> last_update_; |
| 36 bool started_; | 38 bool started_; |
| 37 }; | 39 }; |
| 38 | 40 |
| 39 #endif // CHROME_RENDERER_DEVICE_ORIENTATION_DISPATCHER_H_ | 41 #endif // CHROME_RENDERER_DEVICE_ORIENTATION_DISPATCHER_H_ |
| OLD | NEW |