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

Unified Diff: Source/core/html/HTMLMediaElement.cpp

Issue 27694002: Ability to block <audio> and <video> media. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rename "video" to "media". Created 7 years, 2 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 side-by-side diff with in-line comments
Download patch
Index: Source/core/html/HTMLMediaElement.cpp
diff --git a/Source/core/html/HTMLMediaElement.cpp b/Source/core/html/HTMLMediaElement.cpp
index 6bbaa55e159f88b6aba19211a46898769f8962ff..5d77a0f8eac327840360adc6a8be7fc5850eebe6 100644
--- a/Source/core/html/HTMLMediaElement.cpp
+++ b/Source/core/html/HTMLMediaElement.cpp
@@ -41,6 +41,8 @@
#include "core/dom/shadow/ShadowRoot.h"
#include "core/events/Event.h"
#include "core/events/ThreadLocalEventNames.h"
+#include "core/frame/ContentSecurityPolicy.h"
+#include "core/frame/Frame.h"
#include "core/html/HTMLMediaSource.h"
#include "core/html/HTMLSourceElement.h"
#include "core/html/HTMLTrackElement.h"
@@ -55,8 +57,7 @@
#include "core/html/track/TextTrackCueList.h"
#include "core/html/track/TextTrackList.h"
#include "core/loader/FrameLoader.h"
-#include "core/frame/ContentSecurityPolicy.h"
-#include "core/frame/Frame.h"
+#include "core/loader/FrameLoaderClient.h"
#include "core/page/Page.h"
#include "core/page/Settings.h"
#include "core/platform/MIMETypeFromURL.h"
@@ -1309,6 +1310,12 @@ bool HTMLMediaElement::isSafeToLoadURL(const KURL& url, InvalidURLAction actionI
return false;
}
+ Settings* settings = frame->settings();
+ if (!frame->loader()->client()->allowMedia(!settings || settings->isMediaLoadingEnabled(), url)) {
+ LOG(Media, "HTMLMEdiaElement::isSafeToLoadURL(%s) -> rejected by FrameLoaderClient", urlForLoggingMedia(url).utf8().data());
+ return false;
+ }
+
return true;
}

Powered by Google App Engine
This is Rietveld 408576698