Chromium Code Reviews| 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" |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 76 | 76 |
| 77 return true; | 77 return true; |
| 78 } | 78 } |
| 79 } // namespace | 79 } // namespace |
| 80 | 80 |
| 81 void DeviceOrientationDispatcher::OnDeviceOrientationUpdated( | 81 void DeviceOrientationDispatcher::OnDeviceOrientationUpdated( |
| 82 const DeviceOrientationMsg_Updated_Params& p) { | 82 const DeviceOrientationMsg_Updated_Params& p) { |
| 83 if (last_orientation_.get() && OrientationsEqual(p, last_orientation_.get())) | 83 if (last_orientation_.get() && OrientationsEqual(p, last_orientation_.get())) |
| 84 return; | 84 return; |
| 85 | 85 |
| 86 last_orientation_.reset(new WebKit::WebDeviceOrientation(p.can_provide_alpha, | 86 WebKit::WebDeviceOrientation *orientation = |
|
jamesr
2012/06/06 23:09:05
why is the allocated on the heap? it looks like th
| |
| 87 p.alpha, | 87 new WebKit::WebDeviceOrientation(); |
| 88 p.can_provide_beta, | 88 orientation->setNull(false); |
| 89 p.beta, | 89 if (p.can_provide_alpha) |
| 90 p.can_provide_gamma, | 90 orientation->setAlpha(p.alpha); |
| 91 p.gamma, | 91 if (p.can_provide_beta) |
| 92 p.can_provide_absolute, | 92 orientation->setBeta(p.beta); |
| 93 p.absolute)); | 93 if (p.can_provide_gamma) |
| 94 | 94 orientation->setGamma(p.gamma); |
| 95 if (p.can_provide_absolute) | |
| 96 orientation->setAbsolute(p.absolute); | |
| 97 last_orientation_.reset(orientation); | |
| 95 controller_->didChangeDeviceOrientation(*last_orientation_); | 98 controller_->didChangeDeviceOrientation(*last_orientation_); |
| 96 } | 99 } |
| OLD | NEW |