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

Unified Diff: chrome/browser/chromeos/system/ash_system_tray_delegate.cc

Issue 15695010: Add ProfileManager::AllowGetDefaultProfile() (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 7 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/system/ash_system_tray_delegate.cc
diff --git a/chrome/browser/chromeos/system/ash_system_tray_delegate.cc b/chrome/browser/chromeos/system/ash_system_tray_delegate.cc
index c7f2bb045f288a8d6a4d48ef45972a72c66539b8..bf62266bb41725b6bace6f8a84414b484a2c753b 100644
--- a/chrome/browser/chromeos/system/ash_system_tray_delegate.cc
+++ b/chrome/browser/chromeos/system/ash_system_tray_delegate.cc
@@ -250,32 +250,33 @@ class SystemTrayDelegate : public ash::SystemTrayDelegate,
volume_control_delegate_(new VolumeController()) {
// Register notifications on construction so that events such as
// PROFILE_CREATED do not get missed if they happen before Initialize().
- registrar_.Add(this,
+ registrar_.reset(new content::NotificationRegistrar);
+ registrar_->Add(this,
chrome::NOTIFICATION_UPGRADE_RECOMMENDED,
content::NotificationService::AllSources());
- registrar_.Add(this,
+ registrar_->Add(this,
chrome::NOTIFICATION_LOGIN_USER_IMAGE_CHANGED,
content::NotificationService::AllSources());
if (GetUserLoginStatus() == ash::user::LOGGED_IN_NONE) {
- registrar_.Add(this,
+ registrar_->Add(this,
chrome::NOTIFICATION_SESSION_STARTED,
content::NotificationService::AllSources());
}
- registrar_.Add(this,
+ registrar_->Add(this,
chrome::NOTIFICATION_PROFILE_CREATED,
content::NotificationService::AllSources());
- registrar_.Add(this,
+ registrar_->Add(this,
chrome::NOTIFICATION_LOGIN_USER_PROFILE_PREPARED,
content::NotificationService::AllSources());
- registrar_.Add(
+ registrar_->Add(
this,
chrome::NOTIFICATION_CROS_ACCESSIBILITY_TOGGLE_SCREEN_MAGNIFIER,
content::NotificationService::AllSources());
- registrar_.Add(
+ registrar_->Add(
this,
chrome::NOTIFICATION_CROS_ACCESSIBILITY_TOGGLE_SPOKEN_FEEDBACK,
content::NotificationService::AllSources());
- registrar_.Add(
+ registrar_->Add(
this,
chrome::NOTIFICATION_CROS_ACCESSIBILITY_TOGGLE_HIGH_CONTRAST_MODE,
content::NotificationService::AllSources());
@@ -339,6 +340,9 @@ class SystemTrayDelegate : public ash::SystemTrayDelegate,
}
virtual ~SystemTrayDelegate() {
+ // Unregister content notifications befure destroying any components.
+ registrar_.reset();
+
if (!ash::switches::UseNewAudioHandler() && AudioHandler::GetInstance()) {
AudioHandler::GetInstance()->RemoveVolumeObserver(this);
}
@@ -1072,9 +1076,9 @@ class SystemTrayDelegate : public ash::SystemTrayDelegate,
}
case chrome::NOTIFICATION_PROFILE_CREATED: {
SetProfile(content::Source<Profile>(source).ptr());
- registrar_.Remove(this,
- chrome::NOTIFICATION_PROFILE_CREATED,
- content::NotificationService::AllSources());
+ registrar_->Remove(this,
+ chrome::NOTIFICATION_PROFILE_CREATED,
+ content::NotificationService::AllSources());
break;
}
case chrome::NOTIFICATION_SESSION_STARTED: {
@@ -1283,7 +1287,7 @@ class SystemTrayDelegate : public ash::SystemTrayDelegate,
}
scoped_ptr<base::WeakPtrFactory<SystemTrayDelegate> > ui_weak_ptr_factory_;
- content::NotificationRegistrar registrar_;
+ scoped_ptr<content::NotificationRegistrar> registrar_;
PrefChangeRegistrar local_state_registrar_;
scoped_ptr<PrefChangeRegistrar> user_pref_registrar_;
std::string active_network_path_;

Powered by Google App Engine
This is Rietveld 408576698