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

Side by Side Diff: chrome/browser/chromeos/login/users/avatar/user_image_sync_observer.cc

Issue 1326353002: Remove dependency of PrefSyncableService on Profile. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@pref_model_associator
Patch Set: Fixing ChromeOS and Linux compilation Created 5 years, 3 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 unified diff | Download patch
« no previous file with comments | « chrome/browser/chromeos/first_run/first_run.cc ('k') | chrome/browser/chromeos/preferences.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/chromeos/login/users/avatar/user_image_sync_observer.h" 5 #include "chrome/browser/chromeos/login/users/avatar/user_image_sync_observer.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/prefs/pref_change_registrar.h" 8 #include "base/prefs/pref_change_registrar.h"
9 #include "base/prefs/scoped_user_pref_update.h" 9 #include "base/prefs/scoped_user_pref_update.h"
10 #include "chrome/browser/chrome_notification_types.h" 10 #include "chrome/browser/chrome_notification_types.h"
11 #include "chrome/browser/chromeos/login/screens/user_image_screen.h" 11 #include "chrome/browser/chromeos/login/screens/user_image_screen.h"
12 #include "chrome/browser/chromeos/login/users/avatar/user_image_manager.h" 12 #include "chrome/browser/chromeos/login/users/avatar/user_image_manager.h"
13 #include "chrome/browser/chromeos/login/users/chrome_user_manager.h" 13 #include "chrome/browser/chromeos/login/users/chrome_user_manager.h"
14 #include "chrome/browser/chromeos/login/wizard_controller.h" 14 #include "chrome/browser/chromeos/login/wizard_controller.h"
15 #include "chrome/browser/chromeos/profiles/profile_helper.h" 15 #include "chrome/browser/chromeos/profiles/profile_helper.h"
16 #include "chrome/browser/prefs/pref_service_syncable.h" 16 #include "chrome/browser/prefs/pref_service_syncable.h"
17 #include "chrome/browser/prefs/pref_service_syncable_util.h"
17 #include "chrome/common/pref_names.h" 18 #include "chrome/common/pref_names.h"
18 #include "components/user_manager/user.h" 19 #include "components/user_manager/user.h"
19 #include "components/user_manager/user_image/default_user_images.h" 20 #include "components/user_manager/user_image/default_user_images.h"
20 #include "components/user_manager/user_manager.h" 21 #include "components/user_manager/user_manager.h"
21 #include "content/public/browser/notification_registrar.h" 22 #include "content/public/browser/notification_registrar.h"
22 #include "content/public/browser/notification_service.h" 23 #include "content/public/browser/notification_service.h"
23 24
24 namespace chromeos { 25 namespace chromeos {
25 namespace { 26 namespace {
26 27
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 75
75 void UserImageSyncObserver::AddObserver(Observer* observer) { 76 void UserImageSyncObserver::AddObserver(Observer* observer) {
76 observer_list_.AddObserver(observer); 77 observer_list_.AddObserver(observer);
77 } 78 }
78 79
79 void UserImageSyncObserver::RemoveObserver(Observer* observer) { 80 void UserImageSyncObserver::RemoveObserver(Observer* observer) {
80 observer_list_.RemoveObserver(observer); 81 observer_list_.RemoveObserver(observer);
81 } 82 }
82 83
83 void UserImageSyncObserver::OnProfileGained(Profile* profile) { 84 void UserImageSyncObserver::OnProfileGained(Profile* profile) {
84 prefs_ = PrefServiceSyncable::FromProfile(profile); 85 prefs_ = PrefServiceSyncableFromProfile(profile);
85 pref_change_registrar_.reset(new PrefChangeRegistrar); 86 pref_change_registrar_.reset(new PrefChangeRegistrar);
86 pref_change_registrar_->Init(prefs_); 87 pref_change_registrar_->Init(prefs_);
87 pref_change_registrar_->Add(kUserImageInfo, 88 pref_change_registrar_->Add(kUserImageInfo,
88 base::Bind(&UserImageSyncObserver::OnPreferenceChanged, 89 base::Bind(&UserImageSyncObserver::OnPreferenceChanged,
89 base::Unretained(this))); 90 base::Unretained(this)));
90 is_synced_ = prefs_->IsPrioritySyncing(); 91 is_synced_ = prefs_->IsPrioritySyncing();
91 if (!is_synced_) { 92 if (!is_synced_) {
92 prefs_->AddObserver(this); 93 prefs_->AddObserver(this);
93 } else { 94 } else {
94 OnInitialSync(); 95 OnInitialSync();
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
192 if (wizard_controller->current_screen() == screen) { 193 if (wizard_controller->current_screen() == screen) {
193 if (screen->user_selected_image()) 194 if (screen->user_selected_image())
194 return false; 195 return false;
195 } 196 }
196 } 197 }
197 return true; 198 return true;
198 } 199 }
199 200
200 } // namespace chromeos 201 } // namespace chromeos
201 202
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/first_run/first_run.cc ('k') | chrome/browser/chromeos/preferences.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698