| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "modules/screen_orientation/ScreenOrientationController.h" | 5 #include "modules/screen_orientation/ScreenOrientationController.h" |
| 6 | 6 |
| 7 #include "core/events/Event.h" | 7 #include "core/events/Event.h" |
| 8 #include "core/frame/FrameHost.h" | 8 #include "core/frame/FrameHost.h" |
| 9 #include "core/frame/FrameView.h" | 9 #include "core/frame/FrameView.h" |
| 10 #include "core/frame/LocalFrame.h" | 10 #include "core/frame/LocalFrame.h" |
| 11 #include "core/page/ChromeClient.h" | 11 #include "core/page/ChromeClient.h" |
| 12 #include "core/page/Page.h" | 12 #include "core/page/Page.h" |
| 13 #include "modules/screen_orientation/ScreenOrientation.h" | 13 #include "modules/screen_orientation/ScreenOrientation.h" |
| 14 #include "modules/screen_orientation/ScreenOrientationDispatcher.h" | 14 #include "modules/screen_orientation/ScreenOrientationDispatcher.h" |
| 15 #include "platform/LayoutTestSupport.h" | 15 #include "platform/LayoutTestSupport.h" |
| 16 #include "platform/ScopedOrientationChangeIndicator.h" | 16 #include "platform/ScopedOrientationChangeIndicator.h" |
| 17 #include "public/platform/WebScreenInfo.h" | 17 #include "public/platform/WebScreenInfo.h" |
| 18 #include "public/platform/modules/screen_orientation/WebScreenOrientationClient.
h" | 18 #include "public/platform/modules/screen_orientation/WebScreenOrientationClient.
h" |
| 19 #include <memory> |
| 19 | 20 |
| 20 namespace blink { | 21 namespace blink { |
| 21 | 22 |
| 22 ScreenOrientationController::~ScreenOrientationController() {} | 23 ScreenOrientationController::~ScreenOrientationController() {} |
| 23 | 24 |
| 24 void ScreenOrientationController::provideTo( | 25 void ScreenOrientationController::provideTo( |
| 25 LocalFrame& frame, | 26 LocalFrame& frame, |
| 26 WebScreenOrientationClient* client) { | 27 WebScreenOrientationClient* client) { |
| 27 ScreenOrientationController* controller = | 28 ScreenOrientationController* controller = |
| 28 new ScreenOrientationController(frame, client); | 29 new ScreenOrientationController(frame, client); |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 158 } | 159 } |
| 159 | 160 |
| 160 void ScreenOrientationController::setOrientation( | 161 void ScreenOrientationController::setOrientation( |
| 161 ScreenOrientation* orientation) { | 162 ScreenOrientation* orientation) { |
| 162 m_orientation = orientation; | 163 m_orientation = orientation; |
| 163 if (m_orientation) | 164 if (m_orientation) |
| 164 updateOrientation(); | 165 updateOrientation(); |
| 165 notifyDispatcher(); | 166 notifyDispatcher(); |
| 166 } | 167 } |
| 167 | 168 |
| 168 void ScreenOrientationController::lock(WebScreenOrientationLockType orientation, | 169 void ScreenOrientationController::lock( |
| 169 WebLockOrientationCallback* callback) { | 170 WebScreenOrientationLockType orientation, |
| 171 std::unique_ptr<WebLockOrientationCallback> callback) { |
| 170 // When detached, the client is no longer valid. | 172 // When detached, the client is no longer valid. |
| 171 if (!m_client) | 173 if (!m_client) |
| 172 return; | 174 return; |
| 173 m_client->lockOrientation(orientation, callback); | 175 m_client->lockOrientation(orientation, std::move(callback)); |
| 174 } | 176 } |
| 175 | 177 |
| 176 void ScreenOrientationController::unlock() { | 178 void ScreenOrientationController::unlock() { |
| 177 // When detached, the client is no longer valid. | 179 // When detached, the client is no longer valid. |
| 178 if (!m_client) | 180 if (!m_client) |
| 179 return; | 181 return; |
| 180 m_client->unlockOrientation(); | 182 m_client->unlockOrientation(); |
| 181 } | 183 } |
| 182 | 184 |
| 183 void ScreenOrientationController::dispatchEventTimerFired(TimerBase*) { | 185 void ScreenOrientationController::dispatchEventTimerFired(TimerBase*) { |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 217 } | 219 } |
| 218 | 220 |
| 219 DEFINE_TRACE(ScreenOrientationController) { | 221 DEFINE_TRACE(ScreenOrientationController) { |
| 220 visitor->trace(m_orientation); | 222 visitor->trace(m_orientation); |
| 221 DOMWindowProperty::trace(visitor); | 223 DOMWindowProperty::trace(visitor); |
| 222 Supplement<LocalFrame>::trace(visitor); | 224 Supplement<LocalFrame>::trace(visitor); |
| 223 PlatformEventController::trace(visitor); | 225 PlatformEventController::trace(visitor); |
| 224 } | 226 } |
| 225 | 227 |
| 226 } // namespace blink | 228 } // namespace blink |
| OLD | NEW |