diff options
author | mlamouri@chromium.org <mlamouri@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-06-05 17:01:49 +0000 |
---|---|---|
committer | mlamouri@chromium.org <mlamouri@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-06-05 17:01:49 +0000 |
commit | b6e8531e12a898ceb96a3f6b54e957db05c8f78f (patch) | |
tree | 084f8495d29215be4379e537dc09cc5780ead37c /content/renderer/renderer_webkitplatformsupport_impl.cc | |
parent | e7deba3cbe8e7a081d331ee547efd8755153e183 (diff) | |
download | chromium_src-b6e8531e12a898ceb96a3f6b54e957db05c8f78f.zip chromium_src-b6e8531e12a898ceb96a3f6b54e957db05c8f78f.tar.gz chromium_src-b6e8531e12a898ceb96a3f6b54e957db05c8f78f.tar.bz2 |
Basic Promise-based lockOrientation() implementation in content/.
The only missing bit is to have proper values when the promise is
succussfully resolved.
BUG=162827
Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=275058
Review URL: https://codereview.chromium.org/298193003
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@275168 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/renderer/renderer_webkitplatformsupport_impl.cc')
-rw-r--r-- | content/renderer/renderer_webkitplatformsupport_impl.cc | 24 |
1 files changed, 17 insertions, 7 deletions
diff --git a/content/renderer/renderer_webkitplatformsupport_impl.cc b/content/renderer/renderer_webkitplatformsupport_impl.cc index 5f9f398..cd8628f 100644 --- a/content/renderer/renderer_webkitplatformsupport_impl.cc +++ b/content/renderer/renderer_webkitplatformsupport_impl.cc @@ -1126,6 +1126,13 @@ void RendererWebKitPlatformSupportImpl::cancelVibration() { //------------------------------------------------------------------------------ +void RendererWebKitPlatformSupportImpl::EnsureScreenOrientationDispatcher() { + if (screen_orientation_dispatcher_) + return; + + screen_orientation_dispatcher_.reset(new ScreenOrientationDispatcher()); +} + void RendererWebKitPlatformSupportImpl::setScreenOrientationListener( blink::WebScreenOrientationListener* listener) { if (RenderThreadImpl::current() && @@ -1138,22 +1145,23 @@ void RendererWebKitPlatformSupportImpl::setScreenOrientationListener( return; } - if (!screen_orientation_dispatcher_) { - screen_orientation_dispatcher_.reset( - new ScreenOrientationDispatcher(RenderThread::Get())); - } + EnsureScreenOrientationDispatcher(); screen_orientation_dispatcher_->setListener(listener); } void RendererWebKitPlatformSupportImpl::lockOrientation( - blink::WebScreenOrientationLockType orientation) { + blink::WebScreenOrientationLockType orientation, + blink::WebLockOrientationCallback* callback) { if (RenderThreadImpl::current() && RenderThreadImpl::current()->layout_test_mode()) { g_test_screen_orientation_controller.Get().UpdateLock(orientation); return; } - RenderThread::Get()->Send(new ScreenOrientationHostMsg_Lock(orientation)); + + EnsureScreenOrientationDispatcher(); + screen_orientation_dispatcher_->LockOrientation( + orientation, scoped_ptr<blink::WebLockOrientationCallback>(callback)); } void RendererWebKitPlatformSupportImpl::unlockOrientation() { @@ -1162,7 +1170,9 @@ void RendererWebKitPlatformSupportImpl::unlockOrientation() { g_test_screen_orientation_controller.Get().ResetLock(); return; } - RenderThread::Get()->Send(new ScreenOrientationHostMsg_Unlock); + + EnsureScreenOrientationDispatcher(); + screen_orientation_dispatcher_->UnlockOrientation(); } // static |