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 { | 12 namespace content { |
13 | 13 |
14 DeviceOrientationDispatcher::DeviceOrientationDispatcher( | 14 DeviceOrientationDispatcher::DeviceOrientationDispatcher( |
15 RenderViewImpl* render_view) | 15 RenderViewImpl* render_view) |
16 : RenderViewObserver(render_view), | 16 : RenderViewObserver(render_view), started_(false) {} |
17 controller_(NULL), | |
18 started_(false) { | |
19 } | |
20 | 17 |
21 DeviceOrientationDispatcher::~DeviceOrientationDispatcher() { | 18 DeviceOrientationDispatcher::~DeviceOrientationDispatcher() { |
22 if (started_) | 19 if (started_) |
23 stopUpdating(); | 20 stopUpdating(); |
24 } | 21 } |
25 | 22 |
26 bool DeviceOrientationDispatcher::OnMessageReceived(const IPC::Message& msg) { | 23 bool DeviceOrientationDispatcher::OnMessageReceived(const IPC::Message& msg) { |
27 bool handled = true; | 24 bool handled = true; |
28 IPC_BEGIN_MESSAGE_MAP(DeviceOrientationDispatcher, msg) | 25 IPC_BEGIN_MESSAGE_MAP(DeviceOrientationDispatcher, msg) |
29 IPC_MESSAGE_HANDLER(DeviceOrientationMsg_Updated, | 26 IPC_MESSAGE_HANDLER(DeviceOrientationMsg_Updated, |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
88 if (p.can_provide_beta) | 85 if (p.can_provide_beta) |
89 last_orientation_.setBeta(p.beta); | 86 last_orientation_.setBeta(p.beta); |
90 if (p.can_provide_gamma) | 87 if (p.can_provide_gamma) |
91 last_orientation_.setGamma(p.gamma); | 88 last_orientation_.setGamma(p.gamma); |
92 if (p.can_provide_absolute) | 89 if (p.can_provide_absolute) |
93 last_orientation_.setAbsolute(p.absolute); | 90 last_orientation_.setAbsolute(p.absolute); |
94 controller_->didChangeDeviceOrientation(last_orientation_); | 91 controller_->didChangeDeviceOrientation(last_orientation_); |
95 } | 92 } |
96 | 93 |
97 } // namespace content | 94 } // namespace content |
OLD | NEW |