OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 CONTENT_RENDERER_DEVICE_ORIENTATION_DISPATCHER_H_ | 5 #ifndef CONTENT_RENDERER_DEVICE_ORIENTATION_DISPATCHER_H_ |
6 #define CONTENT_RENDERER_DEVICE_ORIENTATION_DISPATCHER_H_ | 6 #define CONTENT_RENDERER_DEVICE_ORIENTATION_DISPATCHER_H_ |
7 | 7 |
8 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDeviceOrientationC
lient.h" | 8 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDeviceOrientationC
lient.h" |
| 9 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDeviceOrientation.
h" |
9 | 10 |
10 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
11 #include "content/public/renderer/render_view_observer.h" | 12 #include "content/public/renderer/render_view_observer.h" |
12 | 13 |
13 class RenderViewImpl; | 14 class RenderViewImpl; |
14 | 15 |
15 namespace WebKit { | |
16 class WebDeviceOrientation; | |
17 } | |
18 | |
19 struct DeviceOrientationMsg_Updated_Params; | 16 struct DeviceOrientationMsg_Updated_Params; |
20 | 17 |
21 class DeviceOrientationDispatcher : public content::RenderViewObserver, | 18 class DeviceOrientationDispatcher : public content::RenderViewObserver, |
22 public WebKit::WebDeviceOrientationClient { | 19 public WebKit::WebDeviceOrientationClient { |
23 public: | 20 public: |
24 explicit DeviceOrientationDispatcher(RenderViewImpl* render_view); | 21 explicit DeviceOrientationDispatcher(RenderViewImpl* render_view); |
25 virtual ~DeviceOrientationDispatcher(); | 22 virtual ~DeviceOrientationDispatcher(); |
26 | 23 |
27 private: | 24 private: |
28 // RenderView::Observer implementation. | 25 // RenderView::Observer implementation. |
29 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; | 26 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; |
30 | 27 |
31 // From WebKit::WebDeviceOrientationClient. | 28 // From WebKit::WebDeviceOrientationClient. |
32 virtual void setController( | 29 virtual void setController( |
33 WebKit::WebDeviceOrientationController* controller); | 30 WebKit::WebDeviceOrientationController* controller); |
34 virtual void startUpdating(); | 31 virtual void startUpdating(); |
35 virtual void stopUpdating(); | 32 virtual void stopUpdating(); |
36 virtual WebKit::WebDeviceOrientation lastOrientation() const; | 33 virtual WebKit::WebDeviceOrientation lastOrientation() const; |
37 | 34 |
38 void OnDeviceOrientationUpdated( | 35 void OnDeviceOrientationUpdated( |
39 const DeviceOrientationMsg_Updated_Params& p); | 36 const DeviceOrientationMsg_Updated_Params& p); |
40 | 37 |
41 scoped_ptr<WebKit::WebDeviceOrientationController> controller_; | 38 scoped_ptr<WebKit::WebDeviceOrientationController> controller_; |
42 scoped_ptr<WebKit::WebDeviceOrientation> last_orientation_; | 39 WebKit::WebDeviceOrientation last_orientation_; |
43 bool started_; | 40 bool started_; |
44 }; | 41 }; |
45 | 42 |
46 #endif // CONTENT_RENDERER_DEVICE_ORIENTATION_DISPATCHER_H_ | 43 #endif // CONTENT_RENDERER_DEVICE_ORIENTATION_DISPATCHER_H_ |
OLD | NEW |