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

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

Issue 2293273002: Add a download button to the media player (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@media-controls
Patch Set: addressed comments Created 4 years, 3 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 609 matching lines...) Expand 10 before | Expand all | Expand 10 after
620 620
621 void MediaControlOverflowMenuListElement::defaultEventHandler(Event* event) 621 void MediaControlOverflowMenuListElement::defaultEventHandler(Event* event)
622 { 622 {
623 if (event->type() == EventTypeNames::click) 623 if (event->type() == EventTypeNames::click)
624 event->setDefaultHandled(); 624 event->setDefaultHandled();
625 625
626 MediaControlDivElement::defaultEventHandler(event); 626 MediaControlDivElement::defaultEventHandler(event);
627 } 627 }
628 628
629 // ---------------------------- 629 // ----------------------------
630 MediaControlDownloadButtonElement::MediaControlDownloadButtonElement(MediaContro ls& mediaControls)
631 : MediaControlInputElement(mediaControls, MediaDownloadButton)
632 {
633 }
634
635 MediaControlDownloadButtonElement* MediaControlDownloadButtonElement::create(Med iaControls& mediaControls, Document* document)
636 {
637 MediaControlDownloadButtonElement* button = new MediaControlDownloadButtonEl ement(mediaControls);
638 button->ensureUserAgentShadowRoot();
639 button->setType(InputTypeNames::button);
640 button->setShadowPseudoId(AtomicString("-internal-download-button"));
641 button->setIsWanted(false);
642 return button;
643 }
644
645 WebLocalizedString::Name MediaControlDownloadButtonElement::getOverflowStringNam e()
646 {
647 return WebLocalizedString::OverflowMenuDownload;
648 }
649
650 bool MediaControlDownloadButtonElement::shouldDisplayDownloadButton()
651 {
652 const KURL& url = mediaElement().currentSrc();
653 if (!HTMLMediaElement::isMediaStreamURL(url.getString()) && !url.protocolIs( "blob") && !HTMLMediaSource::lookup(url)) {
mlamouri (slow - plz ping) 2016/09/12 11:06:25 Will trust avayvod@ on this :)
654 return true;
655 }
mlamouri (slow - plz ping) 2016/09/12 11:06:25 style: no { }
kdsilva 2016/09/12 17:25:49 Done.
656 return false;
657 }
658
659 void MediaControlDownloadButtonElement::defaultEventHandler(Event* event)
660 {
661 // TODO(kdsilva): cr.bug/601247 The implementation for this download button
mlamouri (slow - plz ping) 2016/09/12 11:06:25 nit: cr.bug => https://crbug.com/ I would change
kdsilva 2016/09/12 17:25:49 Done.
662 // will be written in a CL imminently.
663 }
664
665 // ----------------------------
630 666
631 MediaControlTimelineElement::MediaControlTimelineElement(MediaControls& mediaCon trols) 667 MediaControlTimelineElement::MediaControlTimelineElement(MediaControls& mediaCon trols)
632 : MediaControlInputElement(mediaControls, MediaSlider) 668 : MediaControlInputElement(mediaControls, MediaSlider)
633 { 669 {
634 } 670 }
635 671
636 MediaControlTimelineElement* MediaControlTimelineElement::create(MediaControls& mediaControls) 672 MediaControlTimelineElement* MediaControlTimelineElement::create(MediaControls& mediaControls)
637 { 673 {
638 MediaControlTimelineElement* timeline = new MediaControlTimelineElement(medi aControls); 674 MediaControlTimelineElement* timeline = new MediaControlTimelineElement(medi aControls);
639 timeline->ensureUserAgentShadowRoot(); 675 timeline->ensureUserAgentShadowRoot();
(...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after
940 } 976 }
941 977
942 MediaControlCurrentTimeDisplayElement* MediaControlCurrentTimeDisplayElement::cr eate(MediaControls& mediaControls) 978 MediaControlCurrentTimeDisplayElement* MediaControlCurrentTimeDisplayElement::cr eate(MediaControls& mediaControls)
943 { 979 {
944 MediaControlCurrentTimeDisplayElement* element = new MediaControlCurrentTime DisplayElement(mediaControls); 980 MediaControlCurrentTimeDisplayElement* element = new MediaControlCurrentTime DisplayElement(mediaControls);
945 element->setShadowPseudoId(AtomicString("-webkit-media-controls-current-time -display")); 981 element->setShadowPseudoId(AtomicString("-webkit-media-controls-current-time -display"));
946 return element; 982 return element;
947 } 983 }
948 984
949 } // namespace blink 985 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698