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

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

Issue 2651883008: Make content::FeaturePolicy implement WebFeaturePolicy, and use it in blink code (Closed)
Patch Set: Rebasing intensifies... Created 3 years, 9 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) 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 "bindings/core/v8/ConditionalFeaturesForCore.h"
33 #include "core/dom/Document.h" 33 #include "core/dom/Document.h"
34 #include "core/dom/ElementTraversal.h" 34 #include "core/dom/ElementTraversal.h"
35 #include "core/dom/StyleEngine.h" 35 #include "core/dom/StyleEngine.h"
36 #include "core/dom/TaskRunnerHelper.h" 36 #include "core/dom/TaskRunnerHelper.h"
37 #include "core/events/Event.h" 37 #include "core/events/Event.h"
38 #include "core/frame/FrameView.h" 38 #include "core/frame/FrameView.h"
39 #include "core/frame/HostsUsingFeatures.h" 39 #include "core/frame/HostsUsingFeatures.h"
40 #include "core/frame/LocalFrame.h" 40 #include "core/frame/LocalFrame.h"
41 #include "core/frame/Settings.h" 41 #include "core/frame/Settings.h"
42 #include "core/frame/UseCounter.h" 42 #include "core/frame/UseCounter.h"
43 #include "core/html/HTMLIFrameElement.h" 43 #include "core/html/HTMLIFrameElement.h"
44 #include "core/input/EventHandler.h" 44 #include "core/input/EventHandler.h"
45 #include "core/inspector/ConsoleMessage.h" 45 #include "core/inspector/ConsoleMessage.h"
46 #include "core/layout/LayoutBlockFlow.h" 46 #include "core/layout/LayoutBlockFlow.h"
47 #include "core/layout/LayoutFullScreen.h" 47 #include "core/layout/LayoutFullScreen.h"
48 #include "core/layout/api/LayoutFullScreenItem.h" 48 #include "core/layout/api/LayoutFullScreenItem.h"
49 #include "core/page/ChromeClient.h" 49 #include "core/page/ChromeClient.h"
50 #include "core/svg/SVGSVGElement.h" 50 #include "core/svg/SVGSVGElement.h"
51 #include "platform/ScopedOrientationChangeIndicator.h" 51 #include "platform/ScopedOrientationChangeIndicator.h"
52 #include "platform/UserGestureIndicator.h" 52 #include "platform/UserGestureIndicator.h"
53 #include "public/platform/Platform.h"
53 54
54 namespace blink { 55 namespace blink {
55 56
56 namespace { 57 namespace {
57 58
58 // https://html.spec.whatwg.org/multipage/embedded-content.html#allowed-to-use 59 // https://html.spec.whatwg.org/multipage/embedded-content.html#allowed-to-use
59 bool allowedToUseFullscreen(const Frame* frame) { 60 bool allowedToUseFullscreen(const Frame* frame) {
60 // To determine whether a Document object |document| is allowed to use the 61 // To determine whether a Document object |document| is allowed to use the
61 // feature indicated by attribute name |allowattribute|, run these steps: 62 // feature indicated by attribute name |allowattribute|, run these steps:
62 63
(...skipping 16 matching lines...) Expand all
79 80
80 // 4. Return false. 81 // 4. Return false.
81 return false; 82 return false;
82 } 83 }
83 84
84 // If Feature Policy is enabled, then we need this hack to support it, until 85 // If Feature Policy is enabled, then we need this hack to support it, until
85 // we have proper support for <iframe allowfullscreen> in FP: 86 // we have proper support for <iframe allowfullscreen> in FP:
86 87
87 // 1. If FP, by itself, enables fullscreen in this document, then fullscreen 88 // 1. If FP, by itself, enables fullscreen in this document, then fullscreen
88 // is allowed. 89 // is allowed.
89 if (frame->securityContext()->getFeaturePolicy()->isFeatureEnabled( 90 if (isFeatureEnabledInFrame(WebFeaturePolicyFeature::Fullscreen, frame)) {
90 kFullscreenFeature)) {
91 return true; 91 return true;
92 } 92 }
93 93
94 // 2. Otherwise, if the embedding frame's document is allowed to use 94 // 2. Otherwise, if the embedding frame's document is allowed to use
95 // fullscreen (either through FP or otherwise), and either: 95 // fullscreen (either through FP or otherwise), and either:
96 // a) this is a same-origin embedded document, or 96 // a) this is a same-origin embedded document, or
97 // b) this document's iframe has the allowfullscreen attribute set, 97 // b) this document's iframe has the allowfullscreen attribute set,
98 // then fullscreen is allowed. 98 // then fullscreen is allowed.
99 if (!frame->isMainFrame()) { 99 if (!frame->isMainFrame()) {
100 if (allowedToUseFullscreen(frame->tree().parent())) { 100 if (allowedToUseFullscreen(frame->tree().parent())) {
(...skipping 766 matching lines...) Expand 10 before | Expand all | Expand 10 after
867 DEFINE_TRACE(Fullscreen) { 867 DEFINE_TRACE(Fullscreen) {
868 visitor->trace(m_pendingFullscreenElement); 868 visitor->trace(m_pendingFullscreenElement);
869 visitor->trace(m_fullscreenElementStack); 869 visitor->trace(m_fullscreenElementStack);
870 visitor->trace(m_currentFullScreenElement); 870 visitor->trace(m_currentFullScreenElement);
871 visitor->trace(m_eventQueue); 871 visitor->trace(m_eventQueue);
872 Supplement<Document>::trace(visitor); 872 Supplement<Document>::trace(visitor);
873 ContextLifecycleObserver::trace(visitor); 873 ContextLifecycleObserver::trace(visitor);
874 } 874 }
875 875
876 } // namespace blink 876 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698