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

Side by Side Diff: third_party/WebKit/Source/core/dom/Fullscreen.cpp

Issue 2499373002: Implementation for feature policy - fullscreen (Closed)
Patch Set: Codereview update and added layout tests Created 4 years 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) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * (C) 2001 Dirk Mueller (mueller@kde.org) 4 * (C) 2001 Dirk Mueller (mueller@kde.org)
5 * (C) 2006 Alexey Proskuryakov (ap@webkit.org) 5 * (C) 2006 Alexey Proskuryakov (ap@webkit.org)
6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012 Apple Inc. All 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012 Apple Inc. All
7 * rights reserved. 7 * rights reserved.
8 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. 8 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved.
9 * (http://www.torchmobile.com/) 9 * (http://www.torchmobile.com/)
10 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) 10 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies)
(...skipping 11 matching lines...) Expand all
22 * 22 *
23 * You should have received a copy of the GNU Library General Public License 23 * You should have received a copy of the GNU Library General Public License
24 * along with this library; see the file COPYING.LIB. If not, write to 24 * along with this library; see the file COPYING.LIB. If not, write to
25 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 25 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
26 * Boston, MA 02110-1301, USA. 26 * Boston, MA 02110-1301, USA.
27 * 27 *
28 */ 28 */
29 29
30 #include "core/dom/Fullscreen.h" 30 #include "core/dom/Fullscreen.h"
31 31
32 #include "bindings/core/v8/ConditionalFeatures.h"
32 #include "core/dom/Document.h" 33 #include "core/dom/Document.h"
33 #include "core/dom/ElementTraversal.h" 34 #include "core/dom/ElementTraversal.h"
34 #include "core/dom/StyleEngine.h" 35 #include "core/dom/StyleEngine.h"
35 #include "core/events/Event.h" 36 #include "core/events/Event.h"
36 #include "core/frame/FrameHost.h" 37 #include "core/frame/FrameHost.h"
37 #include "core/frame/HostsUsingFeatures.h" 38 #include "core/frame/HostsUsingFeatures.h"
38 #include "core/frame/LocalFrame.h" 39 #include "core/frame/LocalFrame.h"
39 #include "core/frame/Settings.h" 40 #include "core/frame/Settings.h"
40 #include "core/frame/UseCounter.h" 41 #include "core/frame/UseCounter.h"
41 #include "core/html/HTMLIFrameElement.h" 42 #include "core/html/HTMLIFrameElement.h"
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 String message = ExceptionMessages::failedToExecute( 94 String message = ExceptionMessages::failedToExecute(
94 "requestFullscreen", "Element", 95 "requestFullscreen", "Element",
95 "API can only be initiated by a user gesture."); 96 "API can only be initiated by a user gesture.");
96 document.addConsoleMessage( 97 document.addConsoleMessage(
97 ConsoleMessage::create(JSMessageSource, WarningMessageLevel, message)); 98 ConsoleMessage::create(JSMessageSource, WarningMessageLevel, message));
98 99
99 return false; 100 return false;
100 } 101 }
101 102
102 // https://fullscreen.spec.whatwg.org/#fullscreen-is-supported 103 // https://fullscreen.spec.whatwg.org/#fullscreen-is-supported
103 bool fullscreenIsSupported(const Document& document) { 104 // TODO(lunalu): update the placement of the feature policy code once it is in
105 // https://fullscreen.spec.whatwg.org/.
106 bool fullscreenIsSupported(Document& document) {
107 Frame* frame = document.frame();
foolip 2016/12/02 10:52:09 document.frame() returns a LocalFrame*, so you can
lunalu1 2016/12/02 19:22:07 Done.
108 DCHECK(frame->isLocalFrame());
109 if (!isFeatureEnabledInFrame(blink::kFullscreenFeature,
110 toLocalFrame(frame))) {
111 if (RuntimeEnabledFeatures::featurePolicyEnabled()) {
112 document.addConsoleMessage(ConsoleMessage::create(
113 JSMessageSource, WarningMessageLevel,
114 "Fullscreen API is disabled by feature policy for this frame"));
115 return false;
116 }
117 }
104 // Fullscreen is supported if there is no previously-established user 118 // Fullscreen is supported if there is no previously-established user
105 // preference, security risk, or platform limitation. 119 // preference, security risk, or platform limitation.
106 return !document.settings() || document.settings()->fullscreenSupported(); 120 return !document.settings() || document.settings()->fullscreenSupported();
107 } 121 }
108 122
109 // https://fullscreen.spec.whatwg.org/#fullscreen-element-ready-check 123 // https://fullscreen.spec.whatwg.org/#fullscreen-element-ready-check
110 bool fullscreenElementReady(const Element& element) { 124 bool fullscreenElementReady(const Element& element) {
111 // A fullscreen element ready check for an element |element| returns true if 125 // A fullscreen element ready check for an element |element| returns true if
112 // all of the following are true, and false otherwise: 126 // all of the following are true, and false otherwise:
113 127
(...skipping 653 matching lines...) Expand 10 before | Expand all | Expand 10 after
767 781
768 DEFINE_TRACE(Fullscreen) { 782 DEFINE_TRACE(Fullscreen) {
769 visitor->trace(m_currentFullScreenElement); 783 visitor->trace(m_currentFullScreenElement);
770 visitor->trace(m_fullscreenElementStack); 784 visitor->trace(m_fullscreenElementStack);
771 visitor->trace(m_eventQueue); 785 visitor->trace(m_eventQueue);
772 Supplement<Document>::trace(visitor); 786 Supplement<Document>::trace(visitor);
773 ContextLifecycleObserver::trace(visitor); 787 ContextLifecycleObserver::trace(visitor);
774 } 788 }
775 789
776 } // namespace blink 790 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698