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

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

Issue 2744463002: Add VectorIconButton functionality to ImageButton. (Closed)
Patch Set: tests Created 3 years, 9 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_shelf_view.cc
diff --git a/chrome/browser/ui/views/download/download_shelf_view.cc b/chrome/browser/ui/views/download/download_shelf_view.cc
index 23b32978b9c7f763f8fb1da9c346a56a417695ee..05a7c85669737e89ed4f063b0ea2b7f2f9db2063 100644
--- a/chrome/browser/ui/views/download/download_shelf_view.cc
+++ b/chrome/browser/ui/views/download/download_shelf_view.cc
@@ -34,8 +34,9 @@
#include "ui/vector_icons/vector_icons.h"
#include "ui/views/background.h"
#include "ui/views/border.h"
+#include "ui/views/controls/button/image_button.h"
+#include "ui/views/controls/button/image_button_util.h"
#include "ui/views/controls/button/md_text_button.h"
-#include "ui/views/controls/button/vector_icon_button.h"
#include "ui/views/controls/link.h"
#include "ui/views/mouse_watcher_view_host.h"
@@ -95,7 +96,7 @@ DownloadShelfView::DownloadShelfView(Browser* browser, BrowserView* parent)
new_item_animation_(this),
shelf_animation_(this),
show_all_view_(nullptr),
- close_button_(nullptr),
+ close_button_(views::CreateImageButtonWithVectorIconStyling(this)),
parent_(parent),
mouse_watcher_(new views::MouseWatcherViewHost(this, gfx::Insets()),
this) {
@@ -112,12 +113,10 @@ DownloadShelfView::DownloadShelfView(Browser* browser, BrowserView* parent)
this, l10n_util::GetStringUTF16(IDS_SHOW_ALL_DOWNLOADS));
AddChildView(show_all_view_);
- views::VectorIconButton* close_button = new views::VectorIconButton(this);
- close_button->SetIcon(ui::kCloseIcon);
- close_button_ = close_button;
close_button_->SetAccessibleName(
l10n_util::GetStringUTF16(IDS_ACCNAME_CLOSE));
AddChildView(close_button_);
+ UpdateCloseButton();
Evan Stade 2017/03/17 13:54:44 is this necessary? We do it when added to the view
Bret 2017/03/17 23:41:41 This one isn't necessary. Removed.
new_item_animation_.SetSlideDuration(kNewItemAnimationDurationMs);
shelf_animation_.SetSlideDuration(kShelfAnimationDurationMs);
@@ -335,12 +334,20 @@ void DownloadShelfView::UpdateColorsFromTheme() {
set_background(views::Background::CreateSolidBackground(
GetThemeProvider()->GetColor(ThemeProperties::COLOR_TOOLBAR)));
+
+ UpdateCloseButton();
}
void DownloadShelfView::OnThemeChanged() {
UpdateColorsFromTheme();
}
+void DownloadShelfView::UpdateCloseButton() {
+ views::SetImageFromVectorIcon(
+ close_button_, ui::kCloseIcon,
+ DownloadItemView::GetTextColorForThemeProvider(GetThemeProvider()));
+}
+
void DownloadShelfView::LinkClicked(views::Link* source, int event_flags) {
chrome::ShowDownloads(browser_);
}
@@ -355,10 +362,6 @@ void DownloadShelfView::ButtonPressed(
NOTREACHED();
}
-SkColor DownloadShelfView::GetVectorIconBaseColor() const {
- return DownloadItemView::GetTextColorForThemeProvider(GetThemeProvider());
-}
-
bool DownloadShelfView::IsShowing() const {
return visible() && shelf_animation_.IsShowing();
}

Powered by Google App Engine
This is Rietveld 408576698