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

Unified Diff: chrome/browser/chromeos/login/multi_profile_first_run_notification.cc

Issue 110173004: Introduces the notifier id for multi-profile notifications. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years 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
« no previous file with comments | « ash/system/system_notifier.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/chromeos/login/multi_profile_first_run_notification.cc
diff --git a/chrome/browser/chromeos/login/multi_profile_first_run_notification.cc b/chrome/browser/chromeos/login/multi_profile_first_run_notification.cc
index 0b23ee3dfbde0dc6ce0a4fd84acdd6b8fb204b98..7910203ece4fb1a1fee7a1b3db8f47705bbd2733 100644
--- a/chrome/browser/chromeos/login/multi_profile_first_run_notification.cc
+++ b/chrome/browser/chromeos/login/multi_profile_first_run_notification.cc
@@ -4,6 +4,7 @@
#include "chrome/browser/chromeos/login/multi_profile_first_run_notification.h"
+#include "ash/system/system_notifier.h"
#include "base/prefs/pref_service.h"
#include "base/strings/string16.h"
#include "chrome/browser/chromeos/login/user_manager.h"
@@ -26,6 +27,30 @@ namespace {
const char kNotificationId[] = "chrome:://login/multiprofile";
+class MultiProfileFirstRunNotificationDelegate
+ : public message_center::NotificationDelegate {
+ public:
+ MultiProfileFirstRunNotificationDelegate(base::Closure callback)
xiyuan 2013/12/09 19:54:01 nit: const base::Closure&
stevenjb 2013/12/09 20:18:52 explicit Also, maybe name 'user_close_callback'?
Jun Mukai 2013/12/09 21:23:43 Done.
Jun Mukai 2013/12/09 21:23:43 Done.
+ : callback_(callback) {}
+
+ // Overridden from message_center::NotificationDelegate:
+ virtual void Display() OVERRIDE {}
+ virtual void Error() OVERRIDE {}
+ virtual void Close(bool by_user) OVERRIDE {
+ if (by_user)
+ callback_.Run();
+ }
+ virtual void Click() OVERRIDE {}
+
+ protected:
+ virtual ~MultiProfileFirstRunNotificationDelegate() {}
+
+ private:
+ base::Closure callback_;
+
+ DISALLOW_COPY_AND_ASSIGN(MultiProfileFirstRunNotificationDelegate);
+};
+
} // namespace
MultiProfileFirstRunNotification::MultiProfileFirstRunNotification()
@@ -61,9 +86,11 @@ void MultiProfileFirstRunNotification::UserProfilePrepared(
ui::ResourceBundle::GetSharedInstance().GetImageNamed(
IDR_NOTIFICATION_ALERT),
display_source,
- message_center::NotifierId(),
+ message_center::NotifierId(
+ message_center::NotifierId::SYSTEM_COMPONENT,
+ ash::system_notifier::kNotifierMultiProfileFirstRun),
message_center::RichNotificationData(),
- new message_center::HandleNotificationClickedDelegate(
+ new MultiProfileFirstRunNotificationDelegate(
base::Bind(&MultiProfileFirstRunNotification::OnDismissed,
weak_ptr_factory_.GetWeakPtr(),
user_profile))));
« no previous file with comments | « ash/system/system_notifier.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698