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

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

Issue 2657723002: [Blink, Media] Added controlsList to HTMLMediaElement (Closed)
Patch Set: Added a link to the spec. 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 20 matching lines...) Expand all
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 648 matching lines...) Expand 10 before | Expand all | Expand 10 after
699 700
700 // HLS stream shouldn't have a download button. 701 // HLS stream shouldn't have a download button.
701 if (HTMLMediaElement::isHLSURL(url)) 702 if (HTMLMediaElement::isHLSURL(url))
702 return false; 703 return false;
703 704
704 // Infinite streams don't have a clear end at which to finish the download 705 // Infinite streams don't have a clear end at which to finish the download
705 // (would require adding UI to prompt for the duration to download). 706 // (would require adding UI to prompt for the duration to download).
706 if (mediaElement().duration() == std::numeric_limits<double>::infinity()) 707 if (mediaElement().duration() == std::numeric_limits<double>::infinity())
707 return false; 708 return false;
708 709
710 // The attribute disables the download button.
711 if (mediaElement().controlsList()->shouldHideDownload()) {
712 UseCounter::count(mediaElement().document(),
713 UseCounter::HTMLMediaElementControlsListNoDownload);
714 return false;
715 }
716
709 return true; 717 return true;
710 } 718 }
711 719
712 void MediaControlDownloadButtonElement::setIsWanted(bool wanted) { 720 void MediaControlDownloadButtonElement::setIsWanted(bool wanted) {
713 MediaControlElement::setIsWanted(wanted); 721 MediaControlElement::setIsWanted(wanted);
714 722
715 if (!isWanted()) 723 if (!isWanted())
716 return; 724 return;
717 725
718 DCHECK(isWanted()); 726 DCHECK(isWanted());
(...skipping 365 matching lines...) Expand 10 before | Expand all | Expand 10 after
1084 MediaControlCurrentTimeDisplayElement* 1092 MediaControlCurrentTimeDisplayElement*
1085 MediaControlCurrentTimeDisplayElement::create(MediaControls& mediaControls) { 1093 MediaControlCurrentTimeDisplayElement::create(MediaControls& mediaControls) {
1086 MediaControlCurrentTimeDisplayElement* element = 1094 MediaControlCurrentTimeDisplayElement* element =
1087 new MediaControlCurrentTimeDisplayElement(mediaControls); 1095 new MediaControlCurrentTimeDisplayElement(mediaControls);
1088 element->setShadowPseudoId( 1096 element->setShadowPseudoId(
1089 AtomicString("-webkit-media-controls-current-time-display")); 1097 AtomicString("-webkit-media-controls-current-time-display"));
1090 return element; 1098 return element;
1091 } 1099 }
1092 1100
1093 } // namespace blink 1101 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698