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