Chromium Code Reviews| Index: chrome/browser/chromeos/eol_notification.cc |
| diff --git a/chrome/browser/chromeos/eol_notification.cc b/chrome/browser/chromeos/eol_notification.cc |
| index 8b5f49eb2e14b5fde57624419b074d185921ecb8..e7f3afa7f1eb6b77b7625c0acc7a4a3134c5c3dd 100644 |
| --- a/chrome/browser/chromeos/eol_notification.cc |
| +++ b/chrome/browser/chromeos/eol_notification.cc |
| @@ -15,10 +15,10 @@ |
| #include "chromeos/dbus/dbus_thread_manager.h" |
| #include "chromeos/dbus/update_engine_client.h" |
| #include "components/prefs/pref_service.h" |
| -#include "grit/ash_resources.h" |
| -#include "third_party/cros_system_api/dbus/update_engine/dbus-constants.h" |
| #include "ui/base/l10n/l10n_util.h" |
| -#include "ui/base/resource/resource_bundle.h" |
| +#include "ui/gfx/color_palette.h" |
| +#include "ui/gfx/paint_vector_icon.h" |
| +#include "ui/gfx/vector_icons_public.h" |
| using message_center::MessageCenter; |
| @@ -33,10 +33,12 @@ class EolNotificationDelegate : public NotificationDelegate { |
| explicit EolNotificationDelegate(Profile* profile); |
| private: |
| + // Buttons that appear in notifications. |
| + enum EOL_Button { BUTTON_MORE_INFO, BUTTON_DISMISS }; |
| + |
| ~EolNotificationDelegate() override; |
| // NotificationDelegate overrides: |
| - void Close(bool by_user) override; |
| void ButtonClick(int button_index) override; |
| std::string id() const override; |
| @@ -52,16 +54,17 @@ EolNotificationDelegate::EolNotificationDelegate(Profile* profile) |
| EolNotificationDelegate::~EolNotificationDelegate() {} |
| -void EolNotificationDelegate::Close(bool by_user) { |
| - if (by_user) { |
| - // set dismiss pref. |
| - profile_->GetPrefs()->SetBoolean(prefs::kEolNotificationDismissed, true); |
| - } |
| -} |
| - |
| void EolNotificationDelegate::ButtonClick(int button_index) { |
| - // show eol link |
| - OpenMoreInfoPage(); |
| + switch (button_index) { |
|
xiyuan
2016/06/23 21:19:54
Should we close the notification when either of th
|
| + case BUTTON_MORE_INFO: |
| + // show eol link |
| + OpenMoreInfoPage(); |
| + break; |
| + case BUTTON_DISMISS: |
| + // set dismiss pref. |
| + profile_->GetPrefs()->SetBoolean(prefs::kEolNotificationDismissed, true); |
| + break; |
| + } |
| } |
| std::string EolNotificationDelegate::id() const { |
| @@ -94,7 +97,7 @@ void EolNotification::CheckEolStatus() { |
| base::Bind(&EolNotification::OnEolStatus, weak_factory_.GetWeakPtr())); |
| } |
| -void EolNotification::OnEolStatus(int status) { |
| +void EolNotification::OnEolStatus(update_engine::EndOfLifeStatus status) { |
| status_ = status; |
| const int pre_eol_status = |
| @@ -124,16 +127,17 @@ void EolNotification::OnEolStatus(int status) { |
| } |
| void EolNotification::Update() { |
| - ui::ResourceBundle& bundle = ui::ResourceBundle::GetSharedInstance(); |
| message_center::RichNotificationData data; |
| data.buttons.push_back(message_center::ButtonInfo( |
| l10n_util::GetStringUTF16(IDS_EOL_MORE_INFO_BUTTON))); |
| + data.buttons.push_back(message_center::ButtonInfo( |
| + l10n_util::GetStringUTF16(IDS_EOL_DISMISS_BUTTON))); |
| Notification notification( |
| message_center::NOTIFICATION_TYPE_SIMPLE, |
| base::string16(), // title |
| - // TODO(xiaoyinh): Update the Eol icon once it's ready. |
| - GetEolMessage(), bundle.GetImageNamed(IDR_AURA_NOTIFICATION_DISPLAY), |
| + GetEolMessage(), gfx::Image(CreateVectorIcon(gfx::VectorIconId::EOL, |
| + gfx::kPlaceholderColor)), |
| message_center::NotifierId(message_center::NotifierId::SYSTEM_COMPONENT, |
| kEolNotificationId), |
| base::string16(), // display_source |