| 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> |
| 20 #include <utility> |
| 19 | 21 |
| 20 namespace blink { | 22 namespace blink { |
| 21 | 23 |
| 22 ScreenOrientationController::~ScreenOrientationController() {} | 24 ScreenOrientationController::~ScreenOrientationController() {} |
| 23 | 25 |
| 24 void ScreenOrientationController::provideTo( | 26 void ScreenOrientationController::provideTo( |
| 25 LocalFrame& frame, | 27 LocalFrame& frame, |
| 26 WebScreenOrientationClient* client) { | 28 WebScreenOrientationClient* client) { |
| 27 ScreenOrientationController* controller = | 29 ScreenOrientationController* controller = |
| 28 new ScreenOrientationController(frame, client); | 30 new ScreenOrientationController(frame, client); |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 158 } | 160 } |
| 159 | 161 |
| 160 void ScreenOrientationController::setOrientation( | 162 void ScreenOrientationController::setOrientation( |
| 161 ScreenOrientation* orientation) { | 163 ScreenOrientation* orientation) { |
| 162 m_orientation = orientation; | 164 m_orientation = orientation; |
| 163 if (m_orientation) | 165 if (m_orientation) |
| 164 updateOrientation(); | 166 updateOrientation(); |
| 165 notifyDispatcher(); | 167 notifyDispatcher(); |
| 166 } | 168 } |
| 167 | 169 |
| 168 void ScreenOrientationController::lock(WebScreenOrientationLockType orientation, | 170 void ScreenOrientationController::lock( |
| 169 WebLockOrientationCallback* callback) { | 171 WebScreenOrientationLockType orientation, |
| 172 std::unique_ptr<WebLockOrientationCallback> callback) { |
| 170 // When detached, the client is no longer valid. | 173 // When detached, the client is no longer valid. |
| 171 if (!m_client) | 174 if (!m_client) |
| 172 return; | 175 return; |
| 173 m_client->lockOrientation(orientation, callback); | 176 m_client->lockOrientation(orientation, std::move(callback)); |
| 174 } | 177 } |
| 175 | 178 |
| 176 void ScreenOrientationController::unlock() { | 179 void ScreenOrientationController::unlock() { |
| 177 // When detached, the client is no longer valid. | 180 // When detached, the client is no longer valid. |
| 178 if (!m_client) | 181 if (!m_client) |
| 179 return; | 182 return; |
| 180 m_client->unlockOrientation(); | 183 m_client->unlockOrientation(); |
| 181 } | 184 } |
| 182 | 185 |
| 183 void ScreenOrientationController::dispatchEventTimerFired(TimerBase*) { | 186 void ScreenOrientationController::dispatchEventTimerFired(TimerBase*) { |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 217 } | 220 } |
| 218 | 221 |
| 219 DEFINE_TRACE(ScreenOrientationController) { | 222 DEFINE_TRACE(ScreenOrientationController) { |
| 220 visitor->trace(m_orientation); | 223 visitor->trace(m_orientation); |
| 221 DOMWindowProperty::trace(visitor); | 224 DOMWindowProperty::trace(visitor); |
| 222 Supplement<LocalFrame>::trace(visitor); | 225 Supplement<LocalFrame>::trace(visitor); |
| 223 PlatformEventController::trace(visitor); | 226 PlatformEventController::trace(visitor); |
| 224 } | 227 } |
| 225 | 228 |
| 226 } // namespace blink | 229 } // namespace blink |
| OLD | NEW |