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