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 670 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
681 return false; | 681 return false; |
682 | 682 |
683 // MediaSource can't be downloaded. | 683 // MediaSource can't be downloaded. |
684 if (HTMLMediaSource::lookup(url)) | 684 if (HTMLMediaSource::lookup(url)) |
685 return false; | 685 return false; |
686 | 686 |
687 // HLS stream shouldn't have a download button. | 687 // HLS stream shouldn't have a download button. |
688 if (HTMLMediaElement::isHLSURL(url)) | 688 if (HTMLMediaElement::isHLSURL(url)) |
689 return false; | 689 return false; |
690 | 690 |
| 691 if (mediaElement().controlsList()->tokens().contains("nodownload")) |
| 692 return false; |
| 693 |
691 return true; | 694 return true; |
692 } | 695 } |
693 | 696 |
694 void MediaControlDownloadButtonElement::defaultEventHandler(Event* event) { | 697 void MediaControlDownloadButtonElement::defaultEventHandler(Event* event) { |
695 const KURL& url = mediaElement().currentSrc(); | 698 const KURL& url = mediaElement().currentSrc(); |
696 if (event->type() == EventTypeNames::click && | 699 if (event->type() == EventTypeNames::click && |
697 !(url.isNull() || url.isEmpty())) { | 700 !(url.isNull() || url.isEmpty())) { |
698 Platform::current()->recordAction( | 701 Platform::current()->recordAction( |
699 UserMetricsAction("Media.Controls.Download")); | 702 UserMetricsAction("Media.Controls.Download")); |
700 if (!m_anchor) { | 703 if (!m_anchor) { |
(...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1045 MediaControlCurrentTimeDisplayElement* | 1048 MediaControlCurrentTimeDisplayElement* |
1046 MediaControlCurrentTimeDisplayElement::create(MediaControls& mediaControls) { | 1049 MediaControlCurrentTimeDisplayElement::create(MediaControls& mediaControls) { |
1047 MediaControlCurrentTimeDisplayElement* element = | 1050 MediaControlCurrentTimeDisplayElement* element = |
1048 new MediaControlCurrentTimeDisplayElement(mediaControls); | 1051 new MediaControlCurrentTimeDisplayElement(mediaControls); |
1049 element->setShadowPseudoId( | 1052 element->setShadowPseudoId( |
1050 AtomicString("-webkit-media-controls-current-time-display")); | 1053 AtomicString("-webkit-media-controls-current-time-display")); |
1051 return element; | 1054 return element; |
1052 } | 1055 } |
1053 | 1056 |
1054 } // namespace blink | 1057 } // namespace blink |
OLD | NEW |