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

Unified Diff: chrome/browser/chromeos/eol_notification.cc

Issue 2081873002: Incorporate comments in Dbus code and add Eol icon (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add new vector icons and add a dismiss button. Created 4 years, 6 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/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
« no previous file with comments | « chrome/browser/chromeos/eol_notification.h ('k') | chrome/browser/chromeos/login/session/user_session_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698