Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2012 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 42 { | 42 { |
| 43 } | 43 } |
| 44 | 44 |
| 45 PassOwnPtrWillBeRawPtr<PointerLockController> PointerLockController::create(Page * page) | 45 PassOwnPtrWillBeRawPtr<PointerLockController> PointerLockController::create(Page * page) |
| 46 { | 46 { |
| 47 return adoptPtrWillBeNoop(new PointerLockController(page)); | 47 return adoptPtrWillBeNoop(new PointerLockController(page)); |
| 48 } | 48 } |
| 49 | 49 |
| 50 void PointerLockController::requestPointerLock(Element* target) | 50 void PointerLockController::requestPointerLock(Element* target) |
| 51 { | 51 { |
| 52 if (!UserGestureIndicator::processingUserGesture()) { | |
| 53 target->document().executionContext()->addConsoleMessage(ConsoleMessage: :create(JSMessageSource, WarningMessageLevel, | |
| 54 "requestPointerLock can only be initiated by a user gesture.")); | |
|
Mike West
2014/09/29 12:24:08
Same here.
Mayur Kankanwadi
2014/09/30 13:56:40
Done.
| |
| 55 } | |
|
Mike West
2014/09/29 12:24:08
You should return early here, right? Otherwise you
Mayur Kankanwadi
2014/09/30 13:56:40
The existing code flow does not do anything notici
Mike West
2014/09/30 14:18:11
Then I don't understand why you're adding a messag
| |
| 56 | |
| 52 if (!target || !target->inDocument() || m_documentOfRemovedElementWhileWaiti ngForUnlock) { | 57 if (!target || !target->inDocument() || m_documentOfRemovedElementWhileWaiti ngForUnlock) { |
| 53 enqueueEvent(EventTypeNames::pointerlockerror, target); | 58 enqueueEvent(EventTypeNames::pointerlockerror, target); |
| 54 return; | 59 return; |
| 55 } | 60 } |
| 56 | 61 |
| 57 if (target->document().isSandboxed(SandboxPointerLock)) { | 62 if (target->document().isSandboxed(SandboxPointerLock)) { |
| 58 // FIXME: This message should be moved off the console once a solution t o https://bugs.webkit.org/show_bug.cgi?id=103274 exists. | 63 // FIXME: This message should be moved off the console once a solution t o https://bugs.webkit.org/show_bug.cgi?id=103274 exists. |
| 59 target->document().addConsoleMessage(ConsoleMessage::create(SecurityMess ageSource, ErrorMessageLevel, "Blocked pointer lock on an element because the el ement's frame is sandboxed and the 'allow-pointer-lock' permission is not set.") ); | 64 target->document().addConsoleMessage(ConsoleMessage::create(SecurityMess ageSource, ErrorMessageLevel, "Blocked pointer lock on an element because the el ement's frame is sandboxed and the 'allow-pointer-lock' permission is not set.") ); |
| 60 enqueueEvent(EventTypeNames::pointerlockerror, target); | 65 enqueueEvent(EventTypeNames::pointerlockerror, target); |
| 61 return; | 66 return; |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 160 } | 165 } |
| 161 | 166 |
| 162 void PointerLockController::trace(Visitor* visitor) | 167 void PointerLockController::trace(Visitor* visitor) |
| 163 { | 168 { |
| 164 visitor->trace(m_page); | 169 visitor->trace(m_page); |
| 165 visitor->trace(m_element); | 170 visitor->trace(m_element); |
| 166 visitor->trace(m_documentOfRemovedElementWhileWaitingForUnlock); | 171 visitor->trace(m_documentOfRemovedElementWhileWaitingForUnlock); |
| 167 } | 172 } |
| 168 | 173 |
| 169 } // namespace blink | 174 } // namespace blink |
| OLD | NEW |