| 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/ScreenOrientation.h" | 5 #include "modules/screen_orientation/ScreenOrientation.h" |
| 6 | 6 |
| 7 #include "bindings/core/v8/ScriptPromise.h" | 7 #include "bindings/core/v8/ScriptPromise.h" |
| 8 #include "bindings/core/v8/ScriptPromiseResolver.h" | 8 #include "bindings/core/v8/ScriptPromiseResolver.h" |
| 9 #include "core/dom/DOMException.h" | 9 #include "core/dom/DOMException.h" |
| 10 #include "core/dom/Document.h" | 10 #include "core/dom/Document.h" |
| (...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 164 if (document->isSandboxed(SandboxOrientationLock)) { | 164 if (document->isSandboxed(SandboxOrientationLock)) { |
| 165 DOMException* exception = | 165 DOMException* exception = |
| 166 DOMException::create(SecurityError, | 166 DOMException::create(SecurityError, |
| 167 "The document is sandboxed and lacks the " | 167 "The document is sandboxed and lacks the " |
| 168 "'allow-orientation-lock' flag."); | 168 "'allow-orientation-lock' flag."); |
| 169 resolver->reject(exception); | 169 resolver->reject(exception); |
| 170 return promise; | 170 return promise; |
| 171 } | 171 } |
| 172 | 172 |
| 173 controller()->lock(stringToOrientationLock(lockString), | 173 controller()->lock(stringToOrientationLock(lockString), |
| 174 new LockOrientationCallback(resolver)); | 174 WTF::makeUnique<LockOrientationCallback>(resolver)); |
| 175 return promise; | 175 return promise; |
| 176 } | 176 } |
| 177 | 177 |
| 178 void ScreenOrientation::unlock() { | 178 void ScreenOrientation::unlock() { |
| 179 if (!controller()) | 179 if (!controller()) |
| 180 return; | 180 return; |
| 181 | 181 |
| 182 controller()->unlock(); | 182 controller()->unlock(); |
| 183 } | 183 } |
| 184 | 184 |
| 185 ScreenOrientationController* ScreenOrientation::controller() { | 185 ScreenOrientationController* ScreenOrientation::controller() { |
| 186 if (!frame()) | 186 if (!frame()) |
| 187 return 0; | 187 return 0; |
| 188 | 188 |
| 189 return ScreenOrientationController::from(*frame()); | 189 return ScreenOrientationController::from(*frame()); |
| 190 } | 190 } |
| 191 | 191 |
| 192 DEFINE_TRACE(ScreenOrientation) { | 192 DEFINE_TRACE(ScreenOrientation) { |
| 193 EventTargetWithInlineData::trace(visitor); | 193 EventTargetWithInlineData::trace(visitor); |
| 194 DOMWindowProperty::trace(visitor); | 194 DOMWindowProperty::trace(visitor); |
| 195 } | 195 } |
| 196 | 196 |
| 197 } // namespace blink | 197 } // namespace blink |
| OLD | NEW |