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

Side by Side 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2007, 2008, 2009, 2010, 2011, 2012, 2013 Apple Inc. All rights reserved. 2 * Copyright (C) 2007, 2008, 2009, 2010, 2011, 2012, 2013 Apple Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 23 matching lines...) Expand all
34 #include "bindings/v8/ScriptController.h" 34 #include "bindings/v8/ScriptController.h"
35 #include "bindings/v8/ScriptEventListener.h" 35 #include "bindings/v8/ScriptEventListener.h"
36 #include "core/css/MediaList.h" 36 #include "core/css/MediaList.h"
37 #include "core/css/MediaQueryEvaluator.h" 37 #include "core/css/MediaQueryEvaluator.h"
38 #include "core/dom/Attribute.h" 38 #include "core/dom/Attribute.h"
39 #include "core/dom/ExceptionCode.h" 39 #include "core/dom/ExceptionCode.h"
40 #include "core/dom/FullscreenElementStack.h" 40 #include "core/dom/FullscreenElementStack.h"
41 #include "core/dom/shadow/ShadowRoot.h" 41 #include "core/dom/shadow/ShadowRoot.h"
42 #include "core/events/Event.h" 42 #include "core/events/Event.h"
43 #include "core/events/ThreadLocalEventNames.h" 43 #include "core/events/ThreadLocalEventNames.h"
44 #include "core/frame/ContentSecurityPolicy.h"
45 #include "core/frame/Frame.h"
44 #include "core/html/HTMLMediaSource.h" 46 #include "core/html/HTMLMediaSource.h"
45 #include "core/html/HTMLSourceElement.h" 47 #include "core/html/HTMLSourceElement.h"
46 #include "core/html/HTMLTrackElement.h" 48 #include "core/html/HTMLTrackElement.h"
47 #include "core/html/MediaController.h" 49 #include "core/html/MediaController.h"
48 #include "core/html/MediaError.h" 50 #include "core/html/MediaError.h"
49 #include "core/html/MediaFragmentURIParser.h" 51 #include "core/html/MediaFragmentURIParser.h"
50 #include "core/html/MediaKeyError.h" 52 #include "core/html/MediaKeyError.h"
51 #include "core/html/MediaKeyEvent.h" 53 #include "core/html/MediaKeyEvent.h"
52 #include "core/html/TimeRanges.h" 54 #include "core/html/TimeRanges.h"
53 #include "core/html/shadow/MediaControls.h" 55 #include "core/html/shadow/MediaControls.h"
54 #include "core/html/track/InbandTextTrack.h" 56 #include "core/html/track/InbandTextTrack.h"
55 #include "core/html/track/TextTrackCueList.h" 57 #include "core/html/track/TextTrackCueList.h"
56 #include "core/html/track/TextTrackList.h" 58 #include "core/html/track/TextTrackList.h"
57 #include "core/loader/FrameLoader.h" 59 #include "core/loader/FrameLoader.h"
58 #include "core/frame/ContentSecurityPolicy.h" 60 #include "core/loader/FrameLoaderClient.h"
59 #include "core/frame/Frame.h"
60 #include "core/page/Page.h" 61 #include "core/page/Page.h"
61 #include "core/page/Settings.h" 62 #include "core/page/Settings.h"
62 #include "core/platform/MIMETypeFromURL.h" 63 #include "core/platform/MIMETypeFromURL.h"
63 #include "core/platform/MIMETypeRegistry.h" 64 #include "core/platform/MIMETypeRegistry.h"
64 #include "core/platform/graphics/InbandTextTrackPrivate.h" 65 #include "core/platform/graphics/InbandTextTrackPrivate.h"
65 #include "core/platform/graphics/MediaPlayer.h" 66 #include "core/platform/graphics/MediaPlayer.h"
66 #include "core/rendering/RenderLayerCompositor.h" 67 #include "core/rendering/RenderLayerCompositor.h"
67 #include "core/rendering/RenderVideo.h" 68 #include "core/rendering/RenderVideo.h"
68 #include "core/rendering/RenderView.h" 69 #include "core/rendering/RenderView.h"
69 #include "modules/mediastream/MediaStreamRegistry.h" 70 #include "modules/mediastream/MediaStreamRegistry.h"
(...skipping 1232 matching lines...) Expand 10 before | Expand all | Expand 10 after
1302 FrameLoader::reportLocalLoadFailed(frame, url.elidedString()); 1303 FrameLoader::reportLocalLoadFailed(frame, url.elidedString());
1303 LOG(Media, "HTMLMediaElement::isSafeToLoadURL(%s) -> FALSE rejected by S ecurityOrigin", urlForLoggingMedia(url).utf8().data()); 1304 LOG(Media, "HTMLMediaElement::isSafeToLoadURL(%s) -> FALSE rejected by S ecurityOrigin", urlForLoggingMedia(url).utf8().data());
1304 return false; 1305 return false;
1305 } 1306 }
1306 1307
1307 if (!document().contentSecurityPolicy()->allowMediaFromSource(url)) { 1308 if (!document().contentSecurityPolicy()->allowMediaFromSource(url)) {
1308 LOG(Media, "HTMLMediaElement::isSafeToLoadURL(%s) -> rejected by Content Security Policy", urlForLoggingMedia(url).utf8().data()); 1309 LOG(Media, "HTMLMediaElement::isSafeToLoadURL(%s) -> rejected by Content Security Policy", urlForLoggingMedia(url).utf8().data());
1309 return false; 1310 return false;
1310 } 1311 }
1311 1312
1313 Settings* settings = frame->settings();
1314 if (!frame->loader()->client()->allowMedia(!settings || settings->isMediaLoa dingEnabled(), url)) {
1315 LOG(Media, "HTMLMEdiaElement::isSafeToLoadURL(%s) -> rejected by FrameLo aderClient", urlForLoggingMedia(url).utf8().data());
1316 return false;
1317 }
1318
1312 return true; 1319 return true;
1313 } 1320 }
1314 1321
1315 void HTMLMediaElement::startProgressEventTimer() 1322 void HTMLMediaElement::startProgressEventTimer()
1316 { 1323 {
1317 if (m_progressEventTimer.isActive()) 1324 if (m_progressEventTimer.isActive())
1318 return; 1325 return;
1319 1326
1320 m_previousProgressTime = WTF::currentTime(); 1327 m_previousProgressTime = WTF::currentTime();
1321 // 350ms is not magic, it is in the spec! 1328 // 350ms is not magic, it is in the spec!
(...skipping 2564 matching lines...) Expand 10 before | Expand all | Expand 10 after
3886 { 3893 {
3887 scheduleLayerUpdate(); 3894 scheduleLayerUpdate();
3888 } 3895 }
3889 3896
3890 bool HTMLMediaElement::isInteractiveContent() const 3897 bool HTMLMediaElement::isInteractiveContent() const
3891 { 3898 {
3892 return fastHasAttribute(controlsAttr); 3899 return fastHasAttribute(controlsAttr);
3893 } 3900 }
3894 3901
3895 } 3902 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698