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

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

Issue 2710713003: Media Controls: Remove download button for infinite streams (Closed)
Patch Set: Created 3 years, 10 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) 2008, 2009, 2010, 2011 Apple Inc. All rights reserved. 2 * Copyright (C) 2008, 2009, 2010, 2011 Apple Inc. All rights reserved.
3 * Copyright (C) 2012 Google Inc. All rights reserved. 3 * Copyright (C) 2012 Google Inc. All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 8 *
9 * 1. Redistributions of source code must retain the above copyright 9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 661 matching lines...) Expand 10 before | Expand all | Expand 10 after
672 const KURL& url = mediaElement().currentSrc(); 672 const KURL& url = mediaElement().currentSrc();
673 673
674 // Check page settings to see if download is disabled. 674 // Check page settings to see if download is disabled.
675 if (document().page() && document().page()->settings().getHideDownloadUI()) 675 if (document().page() && document().page()->settings().getHideDownloadUI())
676 return false; 676 return false;
677 677
678 // URLs that lead to nowhere are ignored. 678 // URLs that lead to nowhere are ignored.
679 if (url.isNull() || url.isEmpty()) 679 if (url.isNull() || url.isEmpty())
680 return false; 680 return false;
681 681
682 // Local files and blobs should not have a download button. 682 // Local files and blobs (including MSE) should not have a download button.
683 if (url.isLocalFile() || url.protocolIs("blob")) 683 if (url.isLocalFile() || url.protocolIs("blob"))
684 return false; 684 return false;
685 685
686 // MediaStream can't be downloaded. 686 // MediaStream can't be downloaded.
687 if (HTMLMediaElement::isMediaStreamURL(url.getString())) 687 if (HTMLMediaElement::isMediaStreamURL(url.getString()))
688 return false; 688 return false;
689 689
690 // MediaSource can't be downloaded. 690 // MediaSource can't be downloaded.
691 if (HTMLMediaSource::lookup(url)) 691 if (HTMLMediaSource::lookup(url))
692 return false; 692 return false;
693 693
694 // HLS stream shouldn't have a download button. 694 // HLS stream shouldn't have a download button.
695 if (HTMLMediaElement::isHLSURL(url)) 695 if (HTMLMediaElement::isHLSURL(url))
696 return false; 696 return false;
697 697
698 // Infinite streams don't have a clear end at which to finish the download
699 // (would require adding UI to prompt for the duration to download).
700 if (mediaElement().duration() == std::numeric_limits<double>::infinity())
701 return false;
702
698 return true; 703 return true;
699 } 704 }
700 705
701 void MediaControlDownloadButtonElement::defaultEventHandler(Event* event) { 706 void MediaControlDownloadButtonElement::defaultEventHandler(Event* event) {
702 const KURL& url = mediaElement().currentSrc(); 707 const KURL& url = mediaElement().currentSrc();
703 if (event->type() == EventTypeNames::click && 708 if (event->type() == EventTypeNames::click &&
704 !(url.isNull() || url.isEmpty())) { 709 !(url.isNull() || url.isEmpty())) {
705 Platform::current()->recordAction( 710 Platform::current()->recordAction(
706 UserMetricsAction("Media.Controls.Download")); 711 UserMetricsAction("Media.Controls.Download"));
707 if (!m_anchor) { 712 if (!m_anchor) {
(...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after
1041 MediaControlCurrentTimeDisplayElement* 1046 MediaControlCurrentTimeDisplayElement*
1042 MediaControlCurrentTimeDisplayElement::create(MediaControls& mediaControls) { 1047 MediaControlCurrentTimeDisplayElement::create(MediaControls& mediaControls) {
1043 MediaControlCurrentTimeDisplayElement* element = 1048 MediaControlCurrentTimeDisplayElement* element =
1044 new MediaControlCurrentTimeDisplayElement(mediaControls); 1049 new MediaControlCurrentTimeDisplayElement(mediaControls);
1045 element->setShadowPseudoId( 1050 element->setShadowPseudoId(
1046 AtomicString("-webkit-media-controls-current-time-display")); 1051 AtomicString("-webkit-media-controls-current-time-display"));
1047 return element; 1052 return element;
1048 } 1053 }
1049 1054
1050 } // namespace blink 1055 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698