Chromium Code Reviews| 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 655 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 666 return false; | 666 return false; |
| 667 | 667 |
| 668 // MediaStream can't be downloaded. | 668 // MediaStream can't be downloaded. |
| 669 if (HTMLMediaElement::isMediaStreamURL(url.getString())) | 669 if (HTMLMediaElement::isMediaStreamURL(url.getString())) |
| 670 return false; | 670 return false; |
| 671 | 671 |
| 672 // MediaSource can't be downloaded. | 672 // MediaSource can't be downloaded. |
| 673 if (HTMLMediaSource::lookup(url)) | 673 if (HTMLMediaSource::lookup(url)) |
| 674 return false; | 674 return false; |
| 675 | 675 |
| 676 // HLS stream shouldn't have a download button. Keep the same logic as in | |
| 677 // media_codec_util.h. | |
| 678 if (url.getString().contains("m3u8")) | |
|
mlamouri (slow - plz ping)
2016/10/08 09:57:54
Can you make this a static method on HTMLMediaElem
qinmin
2016/10/10 19:17:42
Done. IsHLSURL is more correct compared to IsHLSPa
| |
| 679 return false; | |
| 680 | |
| 676 return true; | 681 return true; |
| 677 } | 682 } |
| 678 | 683 |
| 679 void MediaControlDownloadButtonElement::defaultEventHandler(Event* event) { | 684 void MediaControlDownloadButtonElement::defaultEventHandler(Event* event) { |
| 680 const KURL& url = mediaElement().currentSrc(); | 685 const KURL& url = mediaElement().currentSrc(); |
| 681 if (event->type() == EventTypeNames::click && | 686 if (event->type() == EventTypeNames::click && |
| 682 !(url.isNull() || url.isEmpty())) { | 687 !(url.isNull() || url.isEmpty())) { |
| 683 Platform::current()->recordAction( | 688 Platform::current()->recordAction( |
| 684 UserMetricsAction("Media.Controls.Download")); | 689 UserMetricsAction("Media.Controls.Download")); |
| 685 if (!m_anchor) { | 690 if (!m_anchor) { |
| (...skipping 339 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1025 MediaControlCurrentTimeDisplayElement* | 1030 MediaControlCurrentTimeDisplayElement* |
| 1026 MediaControlCurrentTimeDisplayElement::create(MediaControls& mediaControls) { | 1031 MediaControlCurrentTimeDisplayElement::create(MediaControls& mediaControls) { |
| 1027 MediaControlCurrentTimeDisplayElement* element = | 1032 MediaControlCurrentTimeDisplayElement* element = |
| 1028 new MediaControlCurrentTimeDisplayElement(mediaControls); | 1033 new MediaControlCurrentTimeDisplayElement(mediaControls); |
| 1029 element->setShadowPseudoId( | 1034 element->setShadowPseudoId( |
| 1030 AtomicString("-webkit-media-controls-current-time-display")); | 1035 AtomicString("-webkit-media-controls-current-time-display")); |
| 1031 return element; | 1036 return element; |
| 1032 } | 1037 } |
| 1033 | 1038 |
| 1034 } // namespace blink | 1039 } // namespace blink |
| OLD | NEW |