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

Unified Diff: chrome/browser/ui/ash/system_tray_delegate_chromeos.cc

Issue 2568973002: chromeos: Replace user image notifications with observer (Closed)
Patch Set: rebase Created 4 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
Index: chrome/browser/ui/ash/system_tray_delegate_chromeos.cc
diff --git a/chrome/browser/ui/ash/system_tray_delegate_chromeos.cc b/chrome/browser/ui/ash/system_tray_delegate_chromeos.cc
index 0b1920ca9e086b761cfa338ad752c0f3c3c2f825..2e3eb6aa00e0111eac6378ff9aa4e5415db98eab 100644
--- a/chrome/browser/ui/ash/system_tray_delegate_chromeos.cc
+++ b/chrome/browser/ui/ash/system_tray_delegate_chromeos.cc
@@ -144,9 +144,6 @@ SystemTrayDelegateChromeOS::SystemTrayDelegateChromeOS()
// Register notifications on construction so that events such as
// PROFILE_CREATED do not get missed if they happen before Initialize().
registrar_.reset(new content::NotificationRegistrar);
- registrar_->Add(this,
- chrome::NOTIFICATION_LOGIN_USER_IMAGE_CHANGED,
- content::NotificationService::AllSources());
if (GetUserLoginStatus() == ash::LoginStatus::NOT_LOGGED_IN) {
registrar_->Add(this,
chrome::NOTIFICATION_SESSION_STARTED,
@@ -165,6 +162,7 @@ SystemTrayDelegateChromeOS::SystemTrayDelegateChromeOS()
base::Bind(&SystemTrayDelegateChromeOS::OnAccessibilityStatusChanged,
base::Unretained(this)));
+ user_manager::UserManager::Get()->AddObserver(this);
user_manager::UserManager::Get()->AddSessionStateObserver(this);
}
@@ -244,6 +242,7 @@ SystemTrayDelegateChromeOS::~SystemTrayDelegateChromeOS() {
if (policy_manager)
policy_manager->core()->store()->RemoveObserver(this);
+ user_manager::UserManager::Get()->RemoveObserver(this);
user_manager::UserManager::Get()->RemoveSessionStateObserver(this);
}
@@ -762,14 +761,6 @@ void SystemTrayDelegateChromeOS::Observe(
const content::NotificationSource& source,
const content::NotificationDetails& details) {
switch (type) {
- case chrome::NOTIFICATION_LOGIN_USER_IMAGE_CHANGED: {
- // This notification is also sent on login screen when user avatar
- // is loaded from file.
- if (GetUserLoginStatus() != ash::LoginStatus::NOT_LOGGED_IN) {
- GetSystemTrayNotifier()->NotifyUserUpdate();
- }
- break;
- }
case chrome::NOTIFICATION_PROFILE_CREATED: {
SetProfile(content::Source<Profile>(source).ptr());
registrar_->Remove(this,
@@ -899,6 +890,13 @@ void SystemTrayDelegateChromeOS::OnStoreError(policy::CloudPolicyStore* store) {
UpdateEnterpriseDomain();
}
+void SystemTrayDelegateChromeOS::OnUserImageChanged(
+ const user_manager::User& user) {
+ // This is also invoked on login screen when user avatar is loaded from file.
+ if (GetUserLoginStatus() != ash::LoginStatus::NOT_LOGGED_IN)
+ GetSystemTrayNotifier()->NotifyUserUpdate();
+}
+
// Overridden from ash::SessionStateObserver
void SystemTrayDelegateChromeOS::UserAddedToSession(
const AccountId& /*account_id*/) {
« no previous file with comments | « chrome/browser/ui/ash/system_tray_delegate_chromeos.h ('k') | chrome/browser/ui/webui/options/browser_options_handler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698