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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 return adoptPtrWillBeNoop(new PointerLockController(page)); | 45 return adoptPtrWillBeNoop(new PointerLockController(page)); |
46 } | 46 } |
47 | 47 |
48 void PointerLockController::requestPointerLock(Element* target) | 48 void PointerLockController::requestPointerLock(Element* target) |
49 { | 49 { |
50 if (!target || !target->inDocument() || m_documentOfRemovedElementWhileWaiti
ngForUnlock) { | 50 if (!target || !target->inDocument() || m_documentOfRemovedElementWhileWaiti
ngForUnlock) { |
51 enqueueEvent(EventTypeNames::pointerlockerror, target); | 51 enqueueEvent(EventTypeNames::pointerlockerror, target); |
52 return; | 52 return; |
53 } | 53 } |
54 | 54 |
| 55 UseCounter::countCrossOriginIframe(target->document(), UseCounter::ElementRe
questPointerLockIframe); |
| 56 |
55 if (target->document().isSandboxed(SandboxPointerLock)) { | 57 if (target->document().isSandboxed(SandboxPointerLock)) { |
56 // FIXME: This message should be moved off the console once a solution t
o https://bugs.webkit.org/show_bug.cgi?id=103274 exists. | 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. |
57 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.")
); | 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.")
); |
58 enqueueEvent(EventTypeNames::pointerlockerror, target); | 60 enqueueEvent(EventTypeNames::pointerlockerror, target); |
59 return; | 61 return; |
60 } | 62 } |
61 | 63 |
62 if (m_element) { | 64 if (m_element) { |
63 if (m_element->document() != target->document()) { | 65 if (m_element->document() != target->document()) { |
64 enqueueEvent(EventTypeNames::pointerlockerror, target); | 66 enqueueEvent(EventTypeNames::pointerlockerror, target); |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
158 } | 160 } |
159 | 161 |
160 DEFINE_TRACE(PointerLockController) | 162 DEFINE_TRACE(PointerLockController) |
161 { | 163 { |
162 visitor->trace(m_page); | 164 visitor->trace(m_page); |
163 visitor->trace(m_element); | 165 visitor->trace(m_element); |
164 visitor->trace(m_documentOfRemovedElementWhileWaitingForUnlock); | 166 visitor->trace(m_documentOfRemovedElementWhileWaitingForUnlock); |
165 } | 167 } |
166 | 168 |
167 } // namespace blink | 169 } // namespace blink |
OLD | NEW |