| Index: chrome/browser/chromeos/login/users/avatar/user_image_sync_observer.cc
|
| diff --git a/chrome/browser/chromeos/login/users/avatar/user_image_sync_observer.cc b/chrome/browser/chromeos/login/users/avatar/user_image_sync_observer.cc
|
| index b9348c374d3bd4c6408550e72a0319f7f5eac665..9ec5471cc52d2c4a0bf15da4ff7fc406cbf89d08 100644
|
| --- a/chrome/browser/chromeos/login/users/avatar/user_image_sync_observer.cc
|
| +++ b/chrome/browser/chromeos/login/users/avatar/user_image_sync_observer.cc
|
| @@ -45,10 +45,9 @@ UserImageSyncObserver::UserImageSyncObserver(const user_manager::User* user)
|
| prefs_(NULL),
|
| is_synced_(false),
|
| local_image_changed_(false) {
|
| + user_manager::UserManager::Get()->AddObserver(this);
|
| +
|
| notification_registrar_.reset(new content::NotificationRegistrar);
|
| - notification_registrar_->Add(this,
|
| - chrome::NOTIFICATION_LOGIN_USER_IMAGE_CHANGED,
|
| - content::NotificationService::AllSources());
|
| if (Profile* profile = ProfileHelper::Get()->GetProfileByUser(user)) {
|
| OnProfileGained(profile);
|
| } else {
|
| @@ -63,6 +62,8 @@ UserImageSyncObserver::~UserImageSyncObserver() {
|
| prefs_->RemoveObserver(this);
|
| if (pref_change_registrar_)
|
| pref_change_registrar_->RemoveAll();
|
| +
|
| + user_manager::UserManager::Get()->RemoveObserver(this);
|
| }
|
|
|
| // static
|
| @@ -124,24 +125,23 @@ void UserImageSyncObserver::Observe(
|
| int type,
|
| const content::NotificationSource& source,
|
| const content::NotificationDetails& details) {
|
| - if (type == chrome::NOTIFICATION_LOGIN_USER_PROFILE_PREPARED) {
|
| - if (Profile* profile = ProfileHelper::Get()->GetProfileByUser(user_)) {
|
| - notification_registrar_->Remove(
|
| - this,
|
| - chrome::NOTIFICATION_LOGIN_USER_PROFILE_PREPARED,
|
| - content::NotificationService::AllSources());
|
| - OnProfileGained(profile);
|
| - }
|
| - } else if (type == chrome::NOTIFICATION_LOGIN_USER_IMAGE_CHANGED) {
|
| - if (is_synced_)
|
| - UpdateSyncedImageFromLocal();
|
| - else
|
| - local_image_changed_ = true;
|
| - } else {
|
| - NOTREACHED();
|
| + DCHECK_EQ(chrome::NOTIFICATION_LOGIN_USER_PROFILE_PREPARED, type);
|
| +
|
| + if (Profile* profile = ProfileHelper::Get()->GetProfileByUser(user_)) {
|
| + notification_registrar_->Remove(
|
| + this, chrome::NOTIFICATION_LOGIN_USER_PROFILE_PREPARED,
|
| + content::NotificationService::AllSources());
|
| + OnProfileGained(profile);
|
| }
|
| }
|
|
|
| +void UserImageSyncObserver::OnUserImageChanged(const user_manager::User& user) {
|
| + if (is_synced_)
|
| + UpdateSyncedImageFromLocal();
|
| + else
|
| + local_image_changed_ = true;
|
| +}
|
| +
|
| void UserImageSyncObserver::OnIsSyncingChanged() {
|
| is_synced_ = prefs_->IsPrioritySyncing();
|
| if (is_synced_) {
|
|
|