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 661 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 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 // If we have no source, we can't download. | |
| 683 if (mediaElement().getNetworkState() == HTMLMediaElement::kNetworkEmpty || | |
| 684 mediaElement().getNetworkState() == HTMLMediaElement::kNetworkNoSource) | |
| 685 return false; | |
|
mlamouri (slow - plz ping)
2017/03/07 11:23:07
style: you need { }
steimel
2017/03/07 15:26:21
Done.
| |
| 686 | |
| 682 // Local files and blobs (including MSE) should not have a download button. | 687 // Local files and blobs (including MSE) should not have a download button. |
| 683 if (url.isLocalFile() || url.protocolIs("blob")) | 688 if (url.isLocalFile() || url.protocolIs("blob")) |
| 684 return false; | 689 return false; |
| 685 | 690 |
| 686 // MediaStream can't be downloaded. | 691 // MediaStream can't be downloaded. |
| 687 if (HTMLMediaElement::isMediaStreamURL(url.getString())) | 692 if (HTMLMediaElement::isMediaStreamURL(url.getString())) |
| 688 return false; | 693 return false; |
| 689 | 694 |
| 690 // MediaSource can't be downloaded. | 695 // MediaSource can't be downloaded. |
| 691 if (HTMLMediaSource::lookup(url)) | 696 if (HTMLMediaSource::lookup(url)) |
| (...skipping 386 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1078 MediaControlCurrentTimeDisplayElement* | 1083 MediaControlCurrentTimeDisplayElement* |
| 1079 MediaControlCurrentTimeDisplayElement::create(MediaControls& mediaControls) { | 1084 MediaControlCurrentTimeDisplayElement::create(MediaControls& mediaControls) { |
| 1080 MediaControlCurrentTimeDisplayElement* element = | 1085 MediaControlCurrentTimeDisplayElement* element = |
| 1081 new MediaControlCurrentTimeDisplayElement(mediaControls); | 1086 new MediaControlCurrentTimeDisplayElement(mediaControls); |
| 1082 element->setShadowPseudoId( | 1087 element->setShadowPseudoId( |
| 1083 AtomicString("-webkit-media-controls-current-time-display")); | 1088 AtomicString("-webkit-media-controls-current-time-display")); |
| 1084 return element; | 1089 return element; |
| 1085 } | 1090 } |
| 1086 | 1091 |
| 1087 } // namespace blink | 1092 } // namespace blink |
| OLD | NEW |