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 20 matching lines...) Expand all Loading... |
31 | 31 |
32 #include "bindings/core/v8/ExceptionState.h" | 32 #include "bindings/core/v8/ExceptionState.h" |
33 #include "core/InputTypeNames.h" | 33 #include "core/InputTypeNames.h" |
34 #include "core/dom/ClientRect.h" | 34 #include "core/dom/ClientRect.h" |
35 #include "core/dom/TaskRunnerHelper.h" | 35 #include "core/dom/TaskRunnerHelper.h" |
36 #include "core/dom/Text.h" | 36 #include "core/dom/Text.h" |
37 #include "core/dom/shadow/ShadowRoot.h" | 37 #include "core/dom/shadow/ShadowRoot.h" |
38 #include "core/events/MouseEvent.h" | 38 #include "core/events/MouseEvent.h" |
39 #include "core/frame/LocalFrame.h" | 39 #include "core/frame/LocalFrame.h" |
40 #include "core/frame/Settings.h" | 40 #include "core/frame/Settings.h" |
| 41 #include "core/frame/UseCounter.h" |
41 #include "core/html/HTMLAnchorElement.h" | 42 #include "core/html/HTMLAnchorElement.h" |
42 #include "core/html/HTMLLabelElement.h" | 43 #include "core/html/HTMLLabelElement.h" |
43 #include "core/html/HTMLMediaSource.h" | 44 #include "core/html/HTMLMediaSource.h" |
44 #include "core/html/HTMLSpanElement.h" | 45 #include "core/html/HTMLSpanElement.h" |
45 #include "core/html/HTMLVideoElement.h" | 46 #include "core/html/HTMLVideoElement.h" |
46 #include "core/html/TimeRanges.h" | 47 #include "core/html/TimeRanges.h" |
47 #include "core/html/shadow/MediaControls.h" | 48 #include "core/html/shadow/MediaControls.h" |
48 #include "core/html/track/TextTrackList.h" | 49 #include "core/html/track/TextTrackList.h" |
49 #include "core/input/EventHandler.h" | 50 #include "core/input/EventHandler.h" |
50 #include "core/layout/api/LayoutSliderItem.h" | 51 #include "core/layout/api/LayoutSliderItem.h" |
(...skipping 642 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
693 | 694 |
694 // HLS stream shouldn't have a download button. | 695 // HLS stream shouldn't have a download button. |
695 if (HTMLMediaElement::isHLSURL(url)) | 696 if (HTMLMediaElement::isHLSURL(url)) |
696 return false; | 697 return false; |
697 | 698 |
698 // Infinite streams don't have a clear end at which to finish the download | 699 // 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 // (would require adding UI to prompt for the duration to download). |
700 if (mediaElement().duration() == std::numeric_limits<double>::infinity()) | 701 if (mediaElement().duration() == std::numeric_limits<double>::infinity()) |
701 return false; | 702 return false; |
702 | 703 |
| 704 // The attribute disables the download button. |
| 705 if (mediaElement().controlsList()->shouldHideDownload()) { |
| 706 UseCounter::count(mediaElement().document(), |
| 707 UseCounter::HTMLMediaElementControlsListNoDownload); |
| 708 return false; |
| 709 } |
| 710 |
703 return true; | 711 return true; |
704 } | 712 } |
705 | 713 |
706 void MediaControlDownloadButtonElement::setIsWanted(bool wanted) { | 714 void MediaControlDownloadButtonElement::setIsWanted(bool wanted) { |
707 MediaControlElement::setIsWanted(wanted); | 715 MediaControlElement::setIsWanted(wanted); |
708 | 716 |
709 if (!isWanted()) | 717 if (!isWanted()) |
710 return; | 718 return; |
711 | 719 |
712 DCHECK(isWanted()); | 720 DCHECK(isWanted()); |
(...skipping 365 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1078 MediaControlCurrentTimeDisplayElement* | 1086 MediaControlCurrentTimeDisplayElement* |
1079 MediaControlCurrentTimeDisplayElement::create(MediaControls& mediaControls) { | 1087 MediaControlCurrentTimeDisplayElement::create(MediaControls& mediaControls) { |
1080 MediaControlCurrentTimeDisplayElement* element = | 1088 MediaControlCurrentTimeDisplayElement* element = |
1081 new MediaControlCurrentTimeDisplayElement(mediaControls); | 1089 new MediaControlCurrentTimeDisplayElement(mediaControls); |
1082 element->setShadowPseudoId( | 1090 element->setShadowPseudoId( |
1083 AtomicString("-webkit-media-controls-current-time-display")); | 1091 AtomicString("-webkit-media-controls-current-time-display")); |
1084 return element; | 1092 return element; |
1085 } | 1093 } |
1086 | 1094 |
1087 } // namespace blink | 1095 } // namespace blink |
OLD | NEW |