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

Unified Diff: chrome/browser/ui/views/download/download_item_view.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
Index: chrome/browser/ui/views/download/download_item_view.cc
diff --git a/chrome/browser/ui/views/download/download_item_view.cc b/chrome/browser/ui/views/download/download_item_view.cc
index 9c9ce223afa2c68ee44b400b87c7c2765bcd003c..c14f2b9fdfd412c3785f45aabdd2a2a165f28f11 100644
--- a/chrome/browser/ui/views/download/download_item_view.cc
+++ b/chrome/browser/ui/views/download/download_item_view.cc
@@ -1164,7 +1164,6 @@ void DownloadItemView::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();
@@ -1241,25 +1240,9 @@ void DownloadItemView::ShowWarningDialog() {
gfx::Size DownloadItemView::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 DownloadItemView 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.h ('k') | chrome/browser/ui/views/download/download_item_view_md.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698