Disable download for overlay panel content
When content is overlayed(eg. reader mode), enabling download is quite troublesome.
The main issue is that download may cause infobar to show up.
As a result, this CL disables download for overlay content.
Currently it only affects the download button on media controls.
Will disable other elements in later CLs if I found that they can
trigger download.
Because the media control download button uses an internal css, cannot
use distilledpage.css to hide it.
BUG=650738
Review-Url: https://chromiumcodereview.appspot.com/2394653002
Cr-Commit-Position: refs/heads/master@{#426863}
diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc
index 3157d73..bc2bfbb 100644
--- a/content/browser/web_contents/web_contents_impl.cc
+++ b/content/browser/web_contents/web_contents_impl.cc
@@ -451,6 +451,7 @@
virtual_keyboard_requested_(false),
page_scale_factor_is_one_(true),
mouse_lock_widget_(nullptr),
+ is_overlay_content_(false),
loading_weak_factory_(this),
weak_factory_(this) {
frame_tree_.SetFrameRemoveListener(
@@ -3820,6 +3821,10 @@
controller_.ssl_manager()->DidShowCreditCardInputOnHttp();
}
+void WebContentsImpl::SetIsOverlayContent(bool is_overlay_content) {
+ is_overlay_content_ = is_overlay_content;
+}
+
void WebContentsImpl::OnFirstVisuallyNonEmptyPaint() {
for (auto& observer : observers_)
observer.DidFirstVisuallyNonEmptyPaint();
@@ -4152,6 +4157,10 @@
url.scheme(), net::GetHostOrSpecFromURL(url));
}
+bool WebContentsImpl::HideDownloadUI() const {
+ return is_overlay_content_;
+}
+
bool WebContentsImpl::IsNeverVisible() {
if (!delegate_)
return false;