OLD | NEW |
---|---|
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 682 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
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 | 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). | 699 // (would require adding UI to prompt for the duration to download). |
700 if (mediaElement().duration() == std::numeric_limits<double>::infinity()) | 700 if (mediaElement().duration() == std::numeric_limits<double>::infinity()) |
701 return false; | 701 return false; |
702 | 702 |
703 // The attribute disables the download button. | |
704 if (mediaElement().controlsList()->tokens().contains("nodownload")) | |
705 return false; | |
mlamouri (slow - plz ping)
2017/03/01 16:20:21
Can you add a histogram for this and the ones belo
| |
706 | |
703 return true; | 707 return true; |
704 } | 708 } |
705 | 709 |
706 void MediaControlDownloadButtonElement::defaultEventHandler(Event* event) { | 710 void MediaControlDownloadButtonElement::defaultEventHandler(Event* event) { |
707 const KURL& url = mediaElement().currentSrc(); | 711 const KURL& url = mediaElement().currentSrc(); |
708 if (event->type() == EventTypeNames::click && | 712 if (event->type() == EventTypeNames::click && |
709 !(url.isNull() || url.isEmpty())) { | 713 !(url.isNull() || url.isEmpty())) { |
710 Platform::current()->recordAction( | 714 Platform::current()->recordAction( |
711 UserMetricsAction("Media.Controls.Download")); | 715 UserMetricsAction("Media.Controls.Download")); |
712 if (!m_anchor) { | 716 if (!m_anchor) { |
(...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1053 MediaControlCurrentTimeDisplayElement* | 1057 MediaControlCurrentTimeDisplayElement* |
1054 MediaControlCurrentTimeDisplayElement::create(MediaControls& mediaControls) { | 1058 MediaControlCurrentTimeDisplayElement::create(MediaControls& mediaControls) { |
1055 MediaControlCurrentTimeDisplayElement* element = | 1059 MediaControlCurrentTimeDisplayElement* element = |
1056 new MediaControlCurrentTimeDisplayElement(mediaControls); | 1060 new MediaControlCurrentTimeDisplayElement(mediaControls); |
1057 element->setShadowPseudoId( | 1061 element->setShadowPseudoId( |
1058 AtomicString("-webkit-media-controls-current-time-display")); | 1062 AtomicString("-webkit-media-controls-current-time-display")); |
1059 return element; | 1063 return element; |
1060 } | 1064 } |
1061 | 1065 |
1062 } // namespace blink | 1066 } // namespace blink |
OLD | NEW |