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

Unified Diff: third_party/WebKit/Source/core/html/shadow/MediaControlElements.cpp

Issue 2376293004: Don't show media controls download button on local files. (Closed)
Patch Set: rebaseline again \o/ Created 4 years, 3 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
« no previous file with comments | « third_party/WebKit/LayoutTests/platform/win/media/video-zoom-controls-expected.txt ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/html/shadow/MediaControlElements.cpp
diff --git a/third_party/WebKit/Source/core/html/shadow/MediaControlElements.cpp b/third_party/WebKit/Source/core/html/shadow/MediaControlElements.cpp
index 1e2d37e22b6b41441314c1bca25866c3b0bef056..1ec2b78c6c0089c4f50728b931ce20eb51f294e5 100644
--- a/third_party/WebKit/Source/core/html/shadow/MediaControlElements.cpp
+++ b/third_party/WebKit/Source/core/html/shadow/MediaControlElements.cpp
@@ -653,10 +653,23 @@ bool MediaControlDownloadButtonElement::shouldDisplayDownloadButton()
{
const KURL& url = mediaElement().currentSrc();
- if (!url.isNull() && !url.isEmpty() && !HTMLMediaElement::isMediaStreamURL(url.getString()) && !url.protocolIs("blob") && !HTMLMediaSource::lookup(url)) {
- return true;
- }
- return false;
+ // URLs that lead to nowhere are ignored.
+ if (url.isNull() || url.isEmpty())
+ return false;
+
+ // Local files and blobs should not have a download button.
+ if (url.isLocalFile() || url.protocolIs("blob"))
+ return false;
+
+ // MediaStream can't be downloaded.
+ if (HTMLMediaElement::isMediaStreamURL(url.getString()))
+ return false;
+
+ // MediaSource can't be downloaded.
+ if (HTMLMediaSource::lookup(url))
+ return false;
+
+ return true;
}
void MediaControlDownloadButtonElement::defaultEventHandler(Event* event)
« no previous file with comments | « third_party/WebKit/LayoutTests/platform/win/media/video-zoom-controls-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698