Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(154)

Side by Side Diff: Source/core/page/PointerLockController.cpp

Issue 376213002: DevTools: Make FrameConsole methods accept ConsoleMessage objects. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@scriptFailedToParse
Patch Set: Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 10 matching lines...) Expand all
21 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 21 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
22 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 22 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
23 */ 23 */
24 24
25 #include "config.h" 25 #include "config.h"
26 #include "core/page/PointerLockController.h" 26 #include "core/page/PointerLockController.h"
27 27
28 #include "core/dom/Element.h" 28 #include "core/dom/Element.h"
29 #include "core/events/Event.h" 29 #include "core/events/Event.h"
30 #include "core/frame/LocalDOMWindow.h" 30 #include "core/frame/LocalDOMWindow.h"
31 #include "core/inspector/ConsoleMessage.h"
31 #include "core/page/Chrome.h" 32 #include "core/page/Chrome.h"
32 #include "core/page/ChromeClient.h" 33 #include "core/page/ChromeClient.h"
33 #include "core/page/Page.h" 34 #include "core/page/Page.h"
34 #include "platform/PlatformMouseEvent.h" 35 #include "platform/PlatformMouseEvent.h"
35 36
36 namespace WebCore { 37 namespace WebCore {
37 38
38 PointerLockController::PointerLockController(Page* page) 39 PointerLockController::PointerLockController(Page* page)
39 : m_page(page) 40 : m_page(page)
40 , m_lockPending(false) 41 , m_lockPending(false)
41 { 42 {
42 } 43 }
43 44
44 PassOwnPtrWillBeRawPtr<PointerLockController> PointerLockController::create(Page * page) 45 PassOwnPtrWillBeRawPtr<PointerLockController> PointerLockController::create(Page * page)
45 { 46 {
46 return adoptPtrWillBeNoop(new PointerLockController(page)); 47 return adoptPtrWillBeNoop(new PointerLockController(page));
47 } 48 }
48 49
49 void PointerLockController::requestPointerLock(Element* target) 50 void PointerLockController::requestPointerLock(Element* target)
50 { 51 {
51 if (!target || !target->inDocument() || m_documentOfRemovedElementWhileWaiti ngForUnlock) { 52 if (!target || !target->inDocument() || m_documentOfRemovedElementWhileWaiti ngForUnlock) {
52 enqueueEvent(EventTypeNames::pointerlockerror, target); 53 enqueueEvent(EventTypeNames::pointerlockerror, target);
53 enqueueEvent(EventTypeNames::webkitpointerlockerror, target); 54 enqueueEvent(EventTypeNames::webkitpointerlockerror, target);
54 return; 55 return;
55 } 56 }
56 57
57 if (target->document().isSandboxed(SandboxPointerLock)) { 58 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. 59 // 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(SecurityMessageSource, ErrorMessage Level, "Blocked pointer lock on an element because the element's frame is sandbo xed and the 'allow-pointer-lock' permission is not set."); 60 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); 61 enqueueEvent(EventTypeNames::pointerlockerror, target);
61 enqueueEvent(EventTypeNames::webkitpointerlockerror, target); 62 enqueueEvent(EventTypeNames::webkitpointerlockerror, target);
62 return; 63 return;
63 } 64 }
64 65
65 if (m_element) { 66 if (m_element) {
66 if (m_element->document() != target->document()) { 67 if (m_element->document() != target->document()) {
67 enqueueEvent(EventTypeNames::pointerlockerror, target); 68 enqueueEvent(EventTypeNames::pointerlockerror, target);
68 enqueueEvent(EventTypeNames::webkitpointerlockerror, target); 69 enqueueEvent(EventTypeNames::webkitpointerlockerror, target);
69 return; 70 return;
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
167 } 168 }
168 169
169 void PointerLockController::trace(Visitor* visitor) 170 void PointerLockController::trace(Visitor* visitor)
170 { 171 {
171 visitor->trace(m_page); 172 visitor->trace(m_page);
172 visitor->trace(m_element); 173 visitor->trace(m_element);
173 visitor->trace(m_documentOfRemovedElementWhileWaitingForUnlock); 174 visitor->trace(m_documentOfRemovedElementWhileWaitingForUnlock);
174 } 175 }
175 176
176 } // namespace WebCore 177 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698