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

Unified Diff: third_party/WebKit/Source/core/dom/Fullscreen.cpp

Issue 2499373002: Implementation for feature policy - fullscreen (Closed)
Patch Set: Codereview update 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/dom/Fullscreen.cpp
diff --git a/third_party/WebKit/Source/core/dom/Fullscreen.cpp b/third_party/WebKit/Source/core/dom/Fullscreen.cpp
index ff1331bd4cadc423dc311e1626746ce7ce733867..a1969cd2a570421f9dd0e2b76b255a65b20d5433 100644
--- a/third_party/WebKit/Source/core/dom/Fullscreen.cpp
+++ b/third_party/WebKit/Source/core/dom/Fullscreen.cpp
@@ -29,6 +29,7 @@
#include "core/dom/Fullscreen.h"
+#include "bindings/core/v8/ConditionalFeatures.h"
#include "core/dom/Document.h"
#include "core/dom/ElementTraversal.h"
#include "core/dom/StyleEngine.h"
@@ -100,10 +101,38 @@ bool allowedToRequestFullscreen(Document& document) {
}
// https://fullscreen.spec.whatwg.org/#fullscreen-is-supported
-bool fullscreenIsSupported(const Document& document) {
+// TODO(lunalu): update the placement of the feature policy code once it is in
+// https://fullscreen.spec.whatwg.org/.
+bool fullscreenIsSupported(Document& document) {
+ LocalFrame* frame = document.frame();
+ if (!frame)
+ return false;
+
// Fullscreen is supported if there is no previously-established user
// preference, security risk, or platform limitation.
- return !document.settings() || document.settings()->fullscreenSupported();
+ bool fullscreenSupported =
+ !document.settings() || document.settings()->fullscreenSupported();
+
+ if (!RuntimeEnabledFeatures::featurePolicyEnabled()) {
+ return fullscreenSupported;
+ }
+
+ if (fullscreenSupported) {
iclelland 2016/12/05 20:48:30 Can we add a comment here? Something like "If Fea
lunalu1 2016/12/05 21:07:32 Done.
+ if (frame->tree()
+ .parent()
+ ->securityContext()
+ ->getFeaturePolicy()
+ ->isFeatureEnabled(kFullscreenFeature)) {
+ return true;
+ }
+ } else if (isFeatureEnabledInFrame(kFullscreenFeature, frame)) {
iclelland 2016/12/05 20:48:30 And I'd add a comment here that says "Even if the
lunalu1 2016/12/05 21:07:32 Done.
+ return true;
+ }
+
+ document.addConsoleMessage(ConsoleMessage::create(
+ JSMessageSource, WarningMessageLevel,
+ "Fullscreen API is disabled by feature policy for this frame"));
+ return false;
}
// https://fullscreen.spec.whatwg.org/#fullscreen-element-ready-check

Powered by Google App Engine
This is Rietveld 408576698