Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(235)

Side by Side Diff: third_party/WebKit/Source/core/html/shadow/MediaControlElements.cpp

Issue 2657723002: [Blink, Media] Added controlsList to HTMLMediaElement (Closed)
Patch Set: Rebased and readded the tests Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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/03 17:32:44 Can you add a histogram that reports how many time
whywhat 2017/03/07 12:59:46 Done.
706
703 return true; 707 return true;
704 } 708 }
705 709
706 void MediaControlDownloadButtonElement::setIsWanted(bool wanted) { 710 void MediaControlDownloadButtonElement::setIsWanted(bool wanted) {
707 MediaControlElement::setIsWanted(wanted); 711 MediaControlElement::setIsWanted(wanted);
708 712
709 if (!isWanted()) 713 if (!isWanted())
710 return; 714 return;
711 715
712 DCHECK(isWanted()); 716 DCHECK(isWanted());
(...skipping 365 matching lines...) Expand 10 before | Expand all | Expand 10 after
1078 MediaControlCurrentTimeDisplayElement* 1082 MediaControlCurrentTimeDisplayElement*
1079 MediaControlCurrentTimeDisplayElement::create(MediaControls& mediaControls) { 1083 MediaControlCurrentTimeDisplayElement::create(MediaControls& mediaControls) {
1080 MediaControlCurrentTimeDisplayElement* element = 1084 MediaControlCurrentTimeDisplayElement* element =
1081 new MediaControlCurrentTimeDisplayElement(mediaControls); 1085 new MediaControlCurrentTimeDisplayElement(mediaControls);
1082 element->setShadowPseudoId( 1086 element->setShadowPseudoId(
1083 AtomicString("-webkit-media-controls-current-time-display")); 1087 AtomicString("-webkit-media-controls-current-time-display"));
1084 return element; 1088 return element;
1085 } 1089 }
1086 1090
1087 } // namespace blink 1091 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698