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

Unified Diff: Source/core/html/MediaDocument.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/MediaDocument.cpp
diff --git a/Source/core/html/MediaDocument.cpp b/Source/core/html/MediaDocument.cpp
index aabd99a748aaffce13cc659b514fe27dacd56212..ea699d632441ea8e7cceb029720ab475f3b01fe4 100644
--- a/Source/core/html/MediaDocument.cpp
+++ b/Source/core/html/MediaDocument.cpp
@@ -33,6 +33,7 @@
#include "core/dom/RawDataDocumentParser.h"
#include "core/events/KeyboardEvent.h"
#include "core/events/ThreadLocalEventNames.h"
+#include "core/frame/Frame.h"
#include "core/html/HTMLBodyElement.h"
#include "core/html/HTMLHeadElement.h"
#include "core/html/HTMLHtmlElement.h"
@@ -41,7 +42,8 @@
#include "core/html/HTMLVideoElement.h"
#include "core/loader/DocumentLoader.h"
#include "core/loader/FrameLoader.h"
-#include "core/frame/Frame.h"
+#include "core/loader/FrameLoaderClient.h"
+#include "core/page/Settings.h"
#include "platform/KeyboardCodes.h"
namespace WebCore {
@@ -110,6 +112,11 @@ void MediaDocumentParser::createDocumentStructure()
size_t MediaDocumentParser::appendBytes(const char*, size_t)
{
+ Frame* frame = document()->frame();
+ Settings* settings = frame->settings();
+ if (!frame->loader()->client()->allowMedia(!settings || settings->isMediaLoadingEnabled(), document()->url()))
+ return 0;
+
if (m_didBuildDocumentStructure)
return 0;

Powered by Google App Engine
This is Rietveld 408576698