diff options
author | aousterh@chromium.org <aousterh@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-06-08 10:38:18 +0000 |
---|---|---|
committer | aousterh@chromium.org <aousterh@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-06-08 10:38:18 +0000 |
commit | 0253a524394485980bd0125d33322d01e7c2eff1 (patch) | |
tree | ea21fa42cae316ad4e1083b043665e0f41f92e3b /content/renderer | |
parent | 4eb9eb4f70b43c6e738144beb584545fe7fcace1 (diff) | |
download | chromium_src-0253a524394485980bd0125d33322d01e7c2eff1.zip chromium_src-0253a524394485980bd0125d33322d01e7c2eff1.tar.gz chromium_src-0253a524394485980bd0125d33322d01e7c2eff1.tar.bz2 |
Changed device_orientation_dispatcher to use default constructor in WebDeviceOrientation.h.
This depends on WebKit patch at https://bugs.webkit.org/show_bug.cgi?id=88406.
BUG=none
TEST=none
Review URL: https://chromiumcodereview.appspot.com/10542025
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@141193 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/renderer')
-rw-r--r-- | content/renderer/device_orientation_dispatcher.cc | 27 | ||||
-rw-r--r-- | content/renderer/device_orientation_dispatcher.h | 9 |
2 files changed, 15 insertions, 21 deletions
diff --git a/content/renderer/device_orientation_dispatcher.cc b/content/renderer/device_orientation_dispatcher.cc index a0a66a4..42ce18d 100644 --- a/content/renderer/device_orientation_dispatcher.cc +++ b/content/renderer/device_orientation_dispatcher.cc @@ -48,10 +48,7 @@ void DeviceOrientationDispatcher::stopUpdating() { WebKit::WebDeviceOrientation DeviceOrientationDispatcher::lastOrientation() const { - if (!last_orientation_.get()) - return WebKit::WebDeviceOrientation::nullOrientation(); - - return *last_orientation_; + return last_orientation_; } namespace { @@ -80,17 +77,17 @@ bool OrientationsEqual(const DeviceOrientationMsg_Updated_Params& a, void DeviceOrientationDispatcher::OnDeviceOrientationUpdated( const DeviceOrientationMsg_Updated_Params& p) { - if (last_orientation_.get() && OrientationsEqual(p, last_orientation_.get())) + if (!last_orientation_.isNull() && OrientationsEqual(p, &last_orientation_)) return; - last_orientation_.reset(new WebKit::WebDeviceOrientation(p.can_provide_alpha, - p.alpha, - p.can_provide_beta, - p.beta, - p.can_provide_gamma, - p.gamma, - p.can_provide_absolute, - p.absolute)); - - controller_->didChangeDeviceOrientation(*last_orientation_); + last_orientation_.setNull(false); + if (p.can_provide_alpha) + last_orientation_.setAlpha(p.alpha); + if (p.can_provide_beta) + last_orientation_.setBeta(p.beta); + if (p.can_provide_gamma) + last_orientation_.setGamma(p.gamma); + if (p.can_provide_absolute) + last_orientation_.setAbsolute(p.absolute); + controller_->didChangeDeviceOrientation(last_orientation_); } diff --git a/content/renderer/device_orientation_dispatcher.h b/content/renderer/device_orientation_dispatcher.h index 0f80c26..d643166 100644 --- a/content/renderer/device_orientation_dispatcher.h +++ b/content/renderer/device_orientation_dispatcher.h @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -6,16 +6,13 @@ #define CONTENT_RENDERER_DEVICE_ORIENTATION_DISPATCHER_H_ #include "third_party/WebKit/Source/WebKit/chromium/public/WebDeviceOrientationClient.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebDeviceOrientation.h" #include "base/memory/scoped_ptr.h" #include "content/public/renderer/render_view_observer.h" class RenderViewImpl; -namespace WebKit { -class WebDeviceOrientation; -} - struct DeviceOrientationMsg_Updated_Params; class DeviceOrientationDispatcher : public content::RenderViewObserver, @@ -39,7 +36,7 @@ class DeviceOrientationDispatcher : public content::RenderViewObserver, const DeviceOrientationMsg_Updated_Params& p); scoped_ptr<WebKit::WebDeviceOrientationController> controller_; - scoped_ptr<WebKit::WebDeviceOrientation> last_orientation_; + WebKit::WebDeviceOrientation last_orientation_; bool started_; }; |