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

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

Issue 9580023: Enable user change background image in settings page in Aura build. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: More refactor Created 8 years, 9 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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_manager.h" 5 #include "chrome/browser/chromeos/login/user_manager.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 821 matching lines...) Expand 10 before | Expand all | Expand 10 after
832 base::Bind(&UserManager::CheckOwnership, 832 base::Bind(&UserManager::CheckOwnership,
833 base::Unretained(this))); 833 base::Unretained(this)));
834 } 834 }
835 835
836 void UserManager::SetInitialUserImage(const std::string& username) { 836 void UserManager::SetInitialUserImage(const std::string& username) {
837 // Choose a random default image. 837 // Choose a random default image.
838 int image_id = base::RandInt(0, kDefaultImagesCount - 1); 838 int image_id = base::RandInt(0, kDefaultImagesCount - 1);
839 SaveUserDefaultImageIndex(username, image_id); 839 SaveUserDefaultImageIndex(username, image_id);
840 } 840 }
841 841
842 int UserManager::GetUserWallpaper(const std::string& username) {
843 User* user = const_cast<User*>(FindUser(username));
844 if (user) {
845 return user->wallpaper_index();
846 }
847 return User::kDefaultWallpaperIndex;
848 }
849
850 void UserManager::SetUserWallpaper(const std::string& username,
851 int wallpaper_index) {
852 User* user = const_cast<User*>(FindUser(username));
853 if (user) {
854 user->SetWallpaper(wallpaper_index);
855 }
856 }
857
842 void UserManager::SetUserImage(const std::string& username, 858 void UserManager::SetUserImage(const std::string& username,
843 int image_index, 859 int image_index,
844 const SkBitmap& image) { 860 const SkBitmap& image) {
845 User* user = const_cast<User*>(FindUser(username)); 861 User* user = const_cast<User*>(FindUser(username));
846 // User may have been removed by now. 862 // User may have been removed by now.
847 if (user) { 863 if (user) {
848 // For existing users, a valid image index should have been set upon loading 864 // For existing users, a valid image index should have been set upon loading
849 // them from Local State. 865 // them from Local State.
850 DCHECK(user->image_index() != User::kInvalidImageIndex || 866 DCHECK(user->image_index() != User::kInvalidImageIndex ||
851 current_user_is_new_); 867 current_user_is_new_);
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after
1067 1083
1068 User* UserManager::CreateUser(const std::string& email) const { 1084 User* UserManager::CreateUser(const std::string& email) const {
1069 User* user = new User(email, email == kGuestUser); 1085 User* user = new User(email, email == kGuestUser);
1070 user->set_oauth_token_status(LoadUserOAuthStatus(email)); 1086 user->set_oauth_token_status(LoadUserOAuthStatus(email));
1071 // Used to determine whether user's display name is unique. 1087 // Used to determine whether user's display name is unique.
1072 ++display_name_count_[user->GetDisplayName()]; 1088 ++display_name_count_[user->GetDisplayName()];
1073 return user; 1089 return user;
1074 } 1090 }
1075 1091
1076 } // namespace chromeos 1092 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698