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

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

Issue 600773002: Notify in console when an API fails because it needs to be invoked on user action. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Review comments added with reset -expected.txt files. Created 6 years, 3 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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 intiated by a user gesture."));
meacer 2014/09/26 17:47:38 Same here, no need for paranthesis and intiated ->
Mayur Kankanwadi 2014/09/29 11:22:13 Done.
55 }
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
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
OLDNEW
« Source/core/dom/Fullscreen.cpp ('K') | « Source/core/dom/Fullscreen.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698