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

Unified Diff: chrome/browser/chromeos/login/users/avatar/user_image_manager_impl.cc

Issue 1165323004: We should use UserID object to identify users instead of username. Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 6 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/login/users/avatar/user_image_manager_impl.cc
diff --git a/chrome/browser/chromeos/login/users/avatar/user_image_manager_impl.cc b/chrome/browser/chromeos/login/users/avatar/user_image_manager_impl.cc
index 805423e21e6c2f82bfbf2e77581017e45b4e1a17..f282a141666c6670d6fa8e93675a765f6084088e 100644
--- a/chrome/browser/chromeos/login/users/avatar/user_image_manager_impl.cc
+++ b/chrome/browser/chromeos/login/users/avatar/user_image_manager_impl.cc
@@ -264,7 +264,7 @@ class UserImageManagerImpl::Job {
// Notifies the |parent_| that the Job is done.
void NotifyJobDone();
- const std::string& user_id() const { return parent_->user_id(); }
+ const user_manager::UserID& user_id() const { return parent_->user_id(); }
UserImageManagerImpl* parent_;
@@ -433,7 +433,7 @@ void UserImageManagerImpl::Job::UpdateUser() {
void UserImageManagerImpl::Job::SaveImageAndUpdateLocalState() {
base::FilePath user_data_dir;
PathService::Get(chrome::DIR_USER_DATA, &user_data_dir);
- image_path_ = user_data_dir.Append(user_id() + kSafeImagePathExtension);
+ image_path_ = user_data_dir.Append(user_id().GetUserEmail() + kSafeImagePathExtension);
base::PostTaskAndReplyWithResult(
parent_->background_task_runner_.get(),
@@ -461,7 +461,7 @@ void UserImageManagerImpl::Job::UpdateLocalState() {
entry->Set(kImageURLNodeName, new base::StringValue(image_url_.spec()));
DictionaryPrefUpdate update(g_browser_process->local_state(),
kUserImageProperties);
- update->SetWithoutPathExpansion(user_id(), entry.release());
+ update->SetWithoutPathExpansion(user_id().GetUserEmail(), entry.release());
parent_->user_manager_->NotifyLocalStateChanged();
}
@@ -471,7 +471,7 @@ void UserImageManagerImpl::Job::NotifyJobDone() {
}
UserImageManagerImpl::UserImageManagerImpl(
- const std::string& user_id,
+ const user_manager::UserID& user_id,
user_manager::UserManager* user_manager)
: UserImageManager(user_id),
user_manager_(user_manager),
@@ -511,12 +511,12 @@ void UserImageManagerImpl::LoadUserImage() {
const base::DictionaryValue* image_properties = NULL;
if (prefs_images_unsafe) {
needs_migration = prefs_images_unsafe->GetDictionaryWithoutPathExpansion(
- user_id(), &image_properties);
+ user_id().GetUserEmail(), &image_properties);
if (needs_migration)
user_needs_migration_ = true;
}
if (prefs_images) {
- prefs_images->GetDictionaryWithoutPathExpansion(user_id(),
+ prefs_images->GetDictionaryWithoutPathExpansion(user_id().GetUserEmail(),
&image_properties);
}
@@ -588,7 +588,7 @@ void UserImageManagerImpl::UserLoggedIn(bool user_is_new,
g_browser_process->local_state()->GetDictionary(kUserImages);
const base::DictionaryValue* image_properties = NULL;
if (prefs_images_unsafe->GetDictionaryWithoutPathExpansion(
- user_id(), &image_properties)) {
+ user_id().GetUserEmail(), &image_properties)) {
std::string image_path;
image_properties->GetString(kImagePathNodeName, &image_path);
job_.reset(new Job(this));
@@ -923,7 +923,7 @@ void UserImageManagerImpl::DeleteUserImageAndLocalStateEntry(
DictionaryPrefUpdate update(g_browser_process->local_state(),
prefs_dict_root);
const base::DictionaryValue* image_properties;
- if (!update->GetDictionaryWithoutPathExpansion(user_id(), &image_properties))
+ if (!update->GetDictionaryWithoutPathExpansion(user_id().GetUserEmail(), &image_properties))
return;
std::string image_path;
@@ -935,7 +935,7 @@ void UserImageManagerImpl::DeleteUserImageAndLocalStateEntry(
base::FilePath(image_path),
false));
}
- update->RemoveWithoutPathExpansion(user_id(), NULL);
+ update->RemoveWithoutPathExpansion(user_id().GetUserEmail(), NULL);
}
void UserImageManagerImpl::OnJobChangedUserImage() {
@@ -963,7 +963,7 @@ void UserImageManagerImpl::OnJobDone() {
g_browser_process->local_state()->GetDictionary(kUserImages);
const base::DictionaryValue* image_properties = NULL;
if (!prefs_images_unsafe->GetDictionaryWithoutPathExpansion(
- user_id(), &image_properties)) {
+ user_id().GetUserEmail(), &image_properties)) {
NOTREACHED();
return;
}
@@ -998,7 +998,7 @@ void UserImageManagerImpl::OnJobDone() {
void UserImageManagerImpl::UpdateLocalStateAfterMigration() {
DictionaryPrefUpdate update(g_browser_process->local_state(),
kUserImages);
- update->RemoveWithoutPathExpansion(user_id(), NULL);
+ update->RemoveWithoutPathExpansion(user_id().GetUserEmail(), NULL);
}
void UserImageManagerImpl::TryToCreateImageSyncObserver() {

Powered by Google App Engine
This is Rietveld 408576698