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

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

Issue 106433007: Update some uses of Value in chrome/browser to use the base:: namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix Created 6 years, 12 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 | Annotate | Revision Log
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/user_image_sync_observer.h" 5 #include "chrome/browser/chromeos/login/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/browser_process.h" 10 #include "chrome/browser/browser_process.h"
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 162
163 void UserImageSyncObserver::UpdateSyncedImageFromLocal() { 163 void UserImageSyncObserver::UpdateSyncedImageFromLocal() {
164 int local_index = user_->image_index(); 164 int local_index = user_->image_index();
165 if (!IsIndexSupported(local_index)) { 165 if (!IsIndexSupported(local_index)) {
166 local_index = User::kInvalidImageIndex; 166 local_index = User::kInvalidImageIndex;
167 } 167 }
168 int synced_index; 168 int synced_index;
169 if (GetSyncedImageIndex(&synced_index) && (synced_index == local_index)) 169 if (GetSyncedImageIndex(&synced_index) && (synced_index == local_index))
170 return; 170 return;
171 DictionaryPrefUpdate update(prefs_, kUserImageInfo); 171 DictionaryPrefUpdate update(prefs_, kUserImageInfo);
172 DictionaryValue* dict = update.Get(); 172 base::DictionaryValue* dict = update.Get();
173 dict->SetInteger(kImageIndex, local_index); 173 dict->SetInteger(kImageIndex, local_index);
174 LOG(INFO) << "Saved avatar index " << local_index << " to sync."; 174 LOG(INFO) << "Saved avatar index " << local_index << " to sync.";
175 } 175 }
176 176
177 void UserImageSyncObserver::UpdateLocalImageFromSynced() { 177 void UserImageSyncObserver::UpdateLocalImageFromSynced() {
178 int synced_index; 178 int synced_index;
179 GetSyncedImageIndex(&synced_index); 179 GetSyncedImageIndex(&synced_index);
180 int local_index = user_->image_index(); 180 int local_index = user_->image_index();
181 if ((synced_index == local_index) || !IsIndexSupported(synced_index)) 181 if ((synced_index == local_index) || !IsIndexSupported(synced_index))
182 return; 182 return;
183 UserImageManager* image_manager = UserManager::Get()->GetUserImageManager(); 183 UserImageManager* image_manager = UserManager::Get()->GetUserImageManager();
184 if (synced_index == User::kProfileImageIndex) { 184 if (synced_index == User::kProfileImageIndex) {
185 image_manager->SaveUserImageFromProfileImage(user_->email()); 185 image_manager->SaveUserImageFromProfileImage(user_->email());
186 } else { 186 } else {
187 image_manager->SaveUserDefaultImageIndex(user_->email(), synced_index); 187 image_manager->SaveUserDefaultImageIndex(user_->email(), synced_index);
188 } 188 }
189 LOG(INFO) << "Loaded avatar index " << synced_index << " from sync."; 189 LOG(INFO) << "Loaded avatar index " << synced_index << " from sync.";
190 } 190 }
191 191
192 bool UserImageSyncObserver::GetSyncedImageIndex(int* index) { 192 bool UserImageSyncObserver::GetSyncedImageIndex(int* index) {
193 *index = User::kInvalidImageIndex; 193 *index = User::kInvalidImageIndex;
194 const DictionaryValue* dict = prefs_->GetDictionary(kUserImageInfo); 194 const base::DictionaryValue* dict = prefs_->GetDictionary(kUserImageInfo);
195 return dict && dict->GetInteger(kImageIndex, index); 195 return dict && dict->GetInteger(kImageIndex, index);
196 } 196 }
197 197
198 bool UserImageSyncObserver::CanUpdateLocalImageNow() { 198 bool UserImageSyncObserver::CanUpdateLocalImageNow() {
199 if (WizardController* wizard_controller = 199 if (WizardController* wizard_controller =
200 WizardController::default_controller()) { 200 WizardController::default_controller()) {
201 UserImageScreen* screen = wizard_controller->GetUserImageScreen(); 201 UserImageScreen* screen = wizard_controller->GetUserImageScreen();
202 if (wizard_controller->current_screen() == screen) { 202 if (wizard_controller->current_screen() == screen) {
203 if (screen->user_selected_image()) 203 if (screen->user_selected_image())
204 return false; 204 return false;
205 } 205 }
206 } 206 }
207 return true; 207 return true;
208 } 208 }
209 209
210 } // namespace chromeos 210 } // namespace chromeos
211 211
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/login/user_image_manager_impl.cc ('k') | chrome/browser/chromeos/login/user_manager_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698