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

Unified Diff: chrome/browser/download/notification/download_item_notification.cc

Issue 2685683004: Move more vector icons to more appropriate directories. (Closed)
Patch Set: rebase Created 3 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/download/notification/download_item_notification.cc
diff --git a/chrome/browser/download/notification/download_item_notification.cc b/chrome/browser/download/notification/download_item_notification.cc
index 67c699ef748c49928c9260b75b5c9909469fd086..531d226f271e586b20edaaaba8e7824c176c8553 100644
--- a/chrome/browser/download/notification/download_item_notification.cc
+++ b/chrome/browser/download/notification/download_item_notification.cc
@@ -11,6 +11,7 @@
#include "base/strings/utf_string_conversions.h"
#include "base/task_scheduler/post_task.h"
#include "build/build_config.h"
+#include "chrome/app/vector_icons/vector_icons.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/download/download_crx_util.h"
#include "chrome/browser/download/download_item_model.h"
@@ -42,9 +43,9 @@
#include "ui/gfx/color_palette.h"
#include "ui/gfx/image/image.h"
#include "ui/gfx/paint_vector_icon.h"
-#include "ui/gfx/vector_icons_public.h"
#include "ui/message_center/message_center.h"
#include "ui/message_center/message_center_style.h"
+#include "ui/vector_icons/vector_icons.h"
#if defined(OS_CHROMEOS)
#include "chrome/browser/chromeos/note_taking_helper.h"
@@ -182,7 +183,6 @@ DownloadItemNotification::DownloadItemNotification(
: item_(item),
message_center_(manager->message_center()),
weak_factory_(this) {
-
// Creates the notification instance. |title|, |body| and |icon| will be
// overridden by UpdateNotificationData() below.
notification_.reset(new Notification(
@@ -498,9 +498,9 @@ void DownloadItemNotification::UpdateNotificationIcon() {
? IDR_DOWNLOAD_NOTIFICATION_WARNING_BAD
: IDR_DOWNLOAD_NOTIFICATION_WARNING_UNWANTED);
#else
- SetNotificationVectorIcon(
- gfx::VectorIconId::WARNING,
- model.MightBeMalicious() ? gfx::kGoogleRed700 : gfx::kGoogleYellow700);
+ SetNotificationVectorIcon(ui::kWarningIcon, model.MightBeMalicious()
+ ? gfx::kGoogleRed700
+ : gfx::kGoogleYellow700);
#endif
return;
}
@@ -514,12 +514,11 @@ void DownloadItemNotification::UpdateNotificationIcon() {
#if defined(OS_MACOSX)
SetNotificationIcon(IDR_DOWNLOAD_NOTIFICATION_INCOGNITO);
#else
- SetNotificationVectorIcon(gfx::VectorIconId::FILE_DOWNLOAD_INCOGNITO,
+ SetNotificationVectorIcon(kFileDownloadIncognitoIcon,
gfx::kChromeIconGrey);
#endif
} else {
- SetNotificationVectorIcon(gfx::VectorIconId::FILE_DOWNLOAD,
- gfx::kGoogleBlue500);
+ SetNotificationVectorIcon(kFileDownloadIcon, gfx::kGoogleBlue500);
}
break;
@@ -527,8 +526,7 @@ void DownloadItemNotification::UpdateNotificationIcon() {
#if defined(OS_MACOSX)
SetNotificationIcon(IDR_DOWNLOAD_NOTIFICATION_ERROR);
#else
- SetNotificationVectorIcon(gfx::VectorIconId::ERROR_CIRCLE,
- gfx::kGoogleRed700);
+ SetNotificationVectorIcon(ui::kErrorCircleIcon, gfx::kGoogleRed700);
#endif
break;
@@ -555,20 +553,14 @@ void DownloadItemNotification::OnDownloadRemoved(content::DownloadItem* item) {
}
void DownloadItemNotification::SetNotificationIcon(int resource_id) {
- if (image_resource_id_ == resource_id)
- return;
ui::ResourceBundle& bundle = ui::ResourceBundle::GetSharedInstance();
- image_resource_id_ = resource_id;
- notification_->set_icon(bundle.GetImageNamed(image_resource_id_));
+ notification_->set_icon(bundle.GetImageNamed(resource_id));
}
-void DownloadItemNotification::SetNotificationVectorIcon(gfx::VectorIconId id,
- SkColor color) {
- if (vector_icon_params_ == std::make_pair(id, color))
- return;
- vector_icon_params_ = std::make_pair(id, color);
- image_resource_id_ = 0;
- notification_->set_icon(gfx::Image(gfx::CreateVectorIcon(id, 40, color)));
+void DownloadItemNotification::SetNotificationVectorIcon(
+ const gfx::VectorIcon& icon,
+ SkColor color) {
+ notification_->set_icon(gfx::Image(gfx::CreateVectorIcon(icon, 40, color)));
}
void DownloadItemNotification::DisablePopup() {

Powered by Google App Engine
This is Rietveld 408576698