OLD | NEW |
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_impl.h" | 5 #include "chrome/browser/chromeos/login/user_manager_impl.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "ash/shell.h" | 9 #include "ash/shell.h" |
10 #include "ash/desktop_background/desktop_background_controller.h" | 10 #include "ash/desktop_background/desktop_background_controller.h" |
(...skipping 819 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
830 std::string email; | 830 std::string email; |
831 if ((*it)->GetAsString(&email)) { | 831 if ((*it)->GetAsString(&email)) { |
832 User* user = CreateUser(email, /* is_ephemeral= */ false); | 832 User* user = CreateUser(email, /* is_ephemeral= */ false); |
833 users_.push_back(user); | 833 users_.push_back(user); |
834 | 834 |
835 if (prefs_images) { | 835 if (prefs_images) { |
836 // Get account image path. | 836 // Get account image path. |
837 // TODO(avayvod): Reading image path as a string is here for | 837 // TODO(avayvod): Reading image path as a string is here for |
838 // backward compatibility. | 838 // backward compatibility. |
839 std::string image_path; | 839 std::string image_path; |
840 base::DictionaryValue* image_properties; | 840 const base::DictionaryValue* image_properties; |
841 if (prefs_images->GetStringWithoutPathExpansion(email, &image_path)) { | 841 if (prefs_images->GetStringWithoutPathExpansion(email, &image_path)) { |
842 int image_id = User::kInvalidImageIndex; | 842 int image_id = User::kInvalidImageIndex; |
843 if (IsDefaultImagePath(image_path, &image_id)) { | 843 if (IsDefaultImagePath(image_path, &image_id)) { |
844 user->SetImage(UserImage(GetDefaultImage(image_id)), image_id); | 844 user->SetImage(UserImage(GetDefaultImage(image_id)), image_id); |
845 } else { | 845 } else { |
846 int image_index = User::kExternalImageIndex; | 846 int image_index = User::kExternalImageIndex; |
847 // Until image has been loaded, use the stub image. | 847 // Until image has been loaded, use the stub image. |
848 user->SetStubImage(image_index); | 848 user->SetStubImage(image_index); |
849 DCHECK(!image_path.empty()); | 849 DCHECK(!image_path.empty()); |
850 // Load user image asynchronously. | 850 // Load user image asynchronously. |
(...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1146 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 1146 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
1147 | 1147 |
1148 // Default to the values cached in memory. | 1148 // Default to the values cached in memory. |
1149 *type = current_user_wallpaper_type_; | 1149 *type = current_user_wallpaper_type_; |
1150 *index = current_user_wallpaper_index_; | 1150 *index = current_user_wallpaper_index_; |
1151 | 1151 |
1152 // Override with values found in local store, if any. | 1152 // Override with values found in local store, if any. |
1153 if (!username.empty()) { | 1153 if (!username.empty()) { |
1154 const DictionaryValue* user_wallpapers = g_browser_process->local_state()-> | 1154 const DictionaryValue* user_wallpapers = g_browser_process->local_state()-> |
1155 GetDictionary(UserManager::kUserWallpapersProperties); | 1155 GetDictionary(UserManager::kUserWallpapersProperties); |
1156 base::DictionaryValue* wallpaper_properties; | 1156 const base::DictionaryValue* wallpaper_properties; |
1157 if (user_wallpapers->GetDictionaryWithoutPathExpansion( | 1157 if (user_wallpapers->GetDictionaryWithoutPathExpansion( |
1158 username, | 1158 username, |
1159 &wallpaper_properties)) { | 1159 &wallpaper_properties)) { |
1160 *type = User::UNKNOWN; | 1160 *type = User::UNKNOWN; |
1161 *index = ash::GetInvalidWallpaperIndex(); | 1161 *index = ash::GetInvalidWallpaperIndex(); |
1162 wallpaper_properties->GetInteger(kWallpaperTypeNodeName, | 1162 wallpaper_properties->GetInteger(kWallpaperTypeNodeName, |
1163 reinterpret_cast<int*>(type)); | 1163 reinterpret_cast<int*>(type)); |
1164 wallpaper_properties->GetInteger(kWallpaperIndexNodeName, index); | 1164 wallpaper_properties->GetInteger(kWallpaperIndexNodeName, index); |
1165 std::string date_string; | 1165 std::string date_string; |
1166 int64 val; | 1166 int64 val; |
(...skipping 522 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1689 BrowserThread::PostTask( | 1689 BrowserThread::PostTask( |
1690 BrowserThread::FILE, | 1690 BrowserThread::FILE, |
1691 FROM_HERE, | 1691 FROM_HERE, |
1692 base::Bind(&UserManagerImpl::DeleteUserImage, | 1692 base::Bind(&UserManagerImpl::DeleteUserImage, |
1693 base::Unretained(this), | 1693 base::Unretained(this), |
1694 image_path)); | 1694 image_path)); |
1695 } | 1695 } |
1696 } | 1696 } |
1697 | 1697 |
1698 } // namespace chromeos | 1698 } // namespace chromeos |
OLD | NEW |