| 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 "base/scoped_ptr.h" | 10 #include "base/scoped_ptr.h" |
| 11 #include "ipc/ipc_channel.h" |
| 11 | 12 |
| 12 class RenderView; | 13 class RenderView; |
| 13 namespace IPC { class Message; } | |
| 14 namespace WebKit { class WebDeviceOrientation; } | 14 namespace WebKit { class WebDeviceOrientation; } |
| 15 | 15 |
| 16 struct ViewMsg_DeviceOrientationUpdated_Params; | 16 struct ViewMsg_DeviceOrientationUpdated_Params; |
| 17 | 17 |
| 18 class DeviceOrientationDispatcher : public WebKit::WebDeviceOrientationClient { | 18 class DeviceOrientationDispatcher : public WebKit::WebDeviceOrientationClient, |
| 19 public IPC::Channel::Listener { |
| 19 public: | 20 public: |
| 20 explicit DeviceOrientationDispatcher(RenderView* render_view); | 21 explicit DeviceOrientationDispatcher(RenderView* render_view); |
| 21 virtual ~DeviceOrientationDispatcher(); | 22 virtual ~DeviceOrientationDispatcher(); |
| 22 | 23 |
| 24 // IPC::Channel::Implementation. |
| 23 bool OnMessageReceived(const IPC::Message& msg); | 25 bool OnMessageReceived(const IPC::Message& msg); |
| 24 | 26 |
| 25 // From WebKit::WebDeviceOrientationClient. | 27 // From WebKit::WebDeviceOrientationClient. |
| 26 virtual void setController( | 28 virtual void setController( |
| 27 WebKit::WebDeviceOrientationController* controller); | 29 WebKit::WebDeviceOrientationController* controller); |
| 28 virtual void startUpdating(); | 30 virtual void startUpdating(); |
| 29 virtual void stopUpdating(); | 31 virtual void stopUpdating(); |
| 30 virtual WebKit::WebDeviceOrientation lastOrientation() const; | 32 virtual WebKit::WebDeviceOrientation lastOrientation() const; |
| 31 | 33 |
| 32 private: | 34 private: |
| 33 void OnDeviceOrientationUpdated( | 35 void OnDeviceOrientationUpdated( |
| 34 const ViewMsg_DeviceOrientationUpdated_Params& p); | 36 const ViewMsg_DeviceOrientationUpdated_Params& p); |
| 35 | 37 |
| 36 RenderView* render_view_; | 38 RenderView* render_view_; |
| 37 scoped_ptr<WebKit::WebDeviceOrientationController> controller_; | 39 scoped_ptr<WebKit::WebDeviceOrientationController> controller_; |
| 38 scoped_ptr<WebKit::WebDeviceOrientation> last_orientation_; | 40 scoped_ptr<WebKit::WebDeviceOrientation> last_orientation_; |
| 39 bool started_; | 41 bool started_; |
| 40 }; | 42 }; |
| 41 | 43 |
| 42 #endif // CHROME_RENDERER_DEVICE_ORIENTATION_DISPATCHER_H_ | 44 #endif // CHROME_RENDERER_DEVICE_ORIENTATION_DISPATCHER_H_ |
| OLD | NEW |