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

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

Issue 2394653002: Disable download for overlay panel content (Closed)
Patch Set: rebase Created 4 years, 2 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 18 matching lines...) Expand all
29 29
30 #include "core/html/shadow/MediaControlElements.h" 30 #include "core/html/shadow/MediaControlElements.h"
31 31
32 #include "bindings/core/v8/ExceptionStatePlaceholder.h" 32 #include "bindings/core/v8/ExceptionStatePlaceholder.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/Text.h" 35 #include "core/dom/Text.h"
36 #include "core/dom/shadow/ShadowRoot.h" 36 #include "core/dom/shadow/ShadowRoot.h"
37 #include "core/events/MouseEvent.h" 37 #include "core/events/MouseEvent.h"
38 #include "core/frame/LocalFrame.h" 38 #include "core/frame/LocalFrame.h"
39 #include "core/frame/Settings.h"
39 #include "core/html/HTMLAnchorElement.h" 40 #include "core/html/HTMLAnchorElement.h"
40 #include "core/html/HTMLLabelElement.h" 41 #include "core/html/HTMLLabelElement.h"
41 #include "core/html/HTMLMediaSource.h" 42 #include "core/html/HTMLMediaSource.h"
42 #include "core/html/HTMLSpanElement.h" 43 #include "core/html/HTMLSpanElement.h"
43 #include "core/html/HTMLVideoElement.h" 44 #include "core/html/HTMLVideoElement.h"
44 #include "core/html/TimeRanges.h" 45 #include "core/html/TimeRanges.h"
45 #include "core/html/shadow/MediaControls.h" 46 #include "core/html/shadow/MediaControls.h"
46 #include "core/html/track/TextTrackList.h" 47 #include "core/html/track/TextTrackList.h"
47 #include "core/input/EventHandler.h" 48 #include "core/input/EventHandler.h"
48 #include "core/layout/api/LayoutSliderItem.h" 49 #include "core/layout/api/LayoutSliderItem.h"
50 #include "core/page/Page.h"
49 #include "platform/EventDispatchForbiddenScope.h" 51 #include "platform/EventDispatchForbiddenScope.h"
50 #include "platform/Histogram.h" 52 #include "platform/Histogram.h"
51 #include "platform/RuntimeEnabledFeatures.h" 53 #include "platform/RuntimeEnabledFeatures.h"
52 #include "platform/text/PlatformLocale.h" 54 #include "platform/text/PlatformLocale.h"
53 #include "public/platform/Platform.h" 55 #include "public/platform/Platform.h"
54 #include "public/platform/UserMetricsAction.h" 56 #include "public/platform/UserMetricsAction.h"
55 57
56 namespace blink { 58 namespace blink {
57 59
58 using namespace HTMLNames; 60 using namespace HTMLNames;
(...skipping 590 matching lines...) Expand 10 before | Expand all | Expand 10 after
649 } 651 }
650 652
651 WebLocalizedString::Name 653 WebLocalizedString::Name
652 MediaControlDownloadButtonElement::getOverflowStringName() { 654 MediaControlDownloadButtonElement::getOverflowStringName() {
653 return WebLocalizedString::OverflowMenuDownload; 655 return WebLocalizedString::OverflowMenuDownload;
654 } 656 }
655 657
656 bool MediaControlDownloadButtonElement::shouldDisplayDownloadButton() { 658 bool MediaControlDownloadButtonElement::shouldDisplayDownloadButton() {
657 const KURL& url = mediaElement().currentSrc(); 659 const KURL& url = mediaElement().currentSrc();
658 660
661 // Check page settings to see if download is disabled.
662 if (document().page() && document().page()->settings().hideDownloadUI())
663 return false;
664
659 // URLs that lead to nowhere are ignored. 665 // URLs that lead to nowhere are ignored.
660 if (url.isNull() || url.isEmpty()) 666 if (url.isNull() || url.isEmpty())
661 return false; 667 return false;
662 668
663 // Local files and blobs should not have a download button. 669 // Local files and blobs should not have a download button.
664 if (url.isLocalFile() || url.protocolIs("blob")) 670 if (url.isLocalFile() || url.protocolIs("blob"))
665 return false; 671 return false;
666 672
667 // MediaStream can't be downloaded. 673 // MediaStream can't be downloaded.
668 if (HTMLMediaElement::isMediaStreamURL(url.getString())) 674 if (HTMLMediaElement::isMediaStreamURL(url.getString()))
(...skipping 359 matching lines...) Expand 10 before | Expand all | Expand 10 after
1028 MediaControlCurrentTimeDisplayElement* 1034 MediaControlCurrentTimeDisplayElement*
1029 MediaControlCurrentTimeDisplayElement::create(MediaControls& mediaControls) { 1035 MediaControlCurrentTimeDisplayElement::create(MediaControls& mediaControls) {
1030 MediaControlCurrentTimeDisplayElement* element = 1036 MediaControlCurrentTimeDisplayElement* element =
1031 new MediaControlCurrentTimeDisplayElement(mediaControls); 1037 new MediaControlCurrentTimeDisplayElement(mediaControls);
1032 element->setShadowPseudoId( 1038 element->setShadowPseudoId(
1033 AtomicString("-webkit-media-controls-current-time-display")); 1039 AtomicString("-webkit-media-controls-current-time-display"));
1034 return element; 1040 return element;
1035 } 1041 }
1036 1042
1037 } // namespace blink 1043 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/frame/Settings.in ('k') | third_party/WebKit/Source/web/WebSettingsImpl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698