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 #include "content/renderer/device_orientation_dispatcher.h" | 5 #include "content/renderer/device_orientation_dispatcher.h" |
6 | 6 |
7 #include "content/common/device_orientation_messages.h" | 7 #include "content/common/device_orientation_messages.h" |
8 #include "content/renderer/render_view_impl.h" | 8 #include "content/renderer/render_view_impl.h" |
9 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDeviceOrientation.
h" | 9 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDeviceOrientation.
h" |
10 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDeviceOrientationC
ontroller.h" | 10 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDeviceOrientationC
ontroller.h" |
11 | 11 |
| 12 namespace content { |
| 13 |
| 14 |
12 DeviceOrientationDispatcher::DeviceOrientationDispatcher( | 15 DeviceOrientationDispatcher::DeviceOrientationDispatcher( |
13 RenderViewImpl* render_view) | 16 RenderViewImpl* render_view) |
14 : content::RenderViewObserver(render_view), | 17 : RenderViewObserver(render_view), |
15 controller_(NULL), | 18 controller_(NULL), |
16 started_(false) { | 19 started_(false) { |
17 } | 20 } |
18 | 21 |
19 DeviceOrientationDispatcher::~DeviceOrientationDispatcher() { | 22 DeviceOrientationDispatcher::~DeviceOrientationDispatcher() { |
20 if (started_) | 23 if (started_) |
21 stopUpdating(); | 24 stopUpdating(); |
22 } | 25 } |
23 | 26 |
24 bool DeviceOrientationDispatcher::OnMessageReceived(const IPC::Message& msg) { | 27 bool DeviceOrientationDispatcher::OnMessageReceived(const IPC::Message& msg) { |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 if (p.can_provide_alpha) | 87 if (p.can_provide_alpha) |
85 last_orientation_.setAlpha(p.alpha); | 88 last_orientation_.setAlpha(p.alpha); |
86 if (p.can_provide_beta) | 89 if (p.can_provide_beta) |
87 last_orientation_.setBeta(p.beta); | 90 last_orientation_.setBeta(p.beta); |
88 if (p.can_provide_gamma) | 91 if (p.can_provide_gamma) |
89 last_orientation_.setGamma(p.gamma); | 92 last_orientation_.setGamma(p.gamma); |
90 if (p.can_provide_absolute) | 93 if (p.can_provide_absolute) |
91 last_orientation_.setAbsolute(p.absolute); | 94 last_orientation_.setAbsolute(p.absolute); |
92 controller_->didChangeDeviceOrientation(last_orientation_); | 95 controller_->didChangeDeviceOrientation(last_orientation_); |
93 } | 96 } |
| 97 |
| 98 } // namespace content |
OLD | NEW |