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

Unified Diff: chrome/browser/ui/views/download/download_item_view_md.cc

Issue 1672983002: Fix download danger prompt buttons/actions. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix for tests Created 4 years, 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/ui/views/download/download_item_view_md.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/views/download/download_item_view_md.cc
diff --git a/chrome/browser/ui/views/download/download_item_view_md.cc b/chrome/browser/ui/views/download/download_item_view_md.cc
index 0cb0b6df23357ea348ef6933ac2b2a087b5c0449..359bf407307f3976e917904ff41e25f79b273417 100644
--- a/chrome/browser/ui/views/download/download_item_view_md.cc
+++ b/chrome/browser/ui/views/download/download_item_view_md.cc
@@ -860,7 +860,6 @@ void DownloadItemViewMd::ClearWarningDialog() {
delete dangerous_download_label_;
dangerous_download_label_ = NULL;
dangerous_download_label_sized_ = false;
- cached_button_size_.SetSize(0, 0);
// We need to load the icon now that the download has the real path.
LoadIcon();
@@ -944,25 +943,9 @@ gfx::ImageSkia DownloadItemViewMd::GetWarningIcon() {
gfx::Size DownloadItemViewMd::GetButtonSize() const {
DCHECK(discard_button_ && (mode_ == MALICIOUS_MODE || save_button_));
- gfx::Size size;
-
- // We cache the size when successfully retrieved, not for performance reasons
- // but because if this DownloadItemViewMd is being animated while the tab is
- // not showing, the native buttons are not parented and their preferred size
- // is 0, messing-up the layout.
- if (cached_button_size_.width() != 0)
- return cached_button_size_;
-
+ gfx::Size size = discard_button_->GetPreferredSize();
if (save_button_)
- size = save_button_->GetMinimumSize();
- gfx::Size discard_size = discard_button_->GetMinimumSize();
-
- size.SetSize(std::max(size.width(), discard_size.width()),
- std::max(size.height(), discard_size.height()));
-
- if (size.width() != 0)
- cached_button_size_ = size;
-
+ size.SetToMax(save_button_->GetPreferredSize());
return size;
}
« no previous file with comments | « chrome/browser/ui/views/download/download_item_view_md.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698