| 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/profiles/profile_info_cache.h" | 5 #include "chrome/browser/profiles/profile_info_cache.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/files/file_util.h" | 8 #include "base/files/file_util.h" |
| 9 #include "base/i18n/case_conversion.h" | 9 #include "base/i18n/case_conversion.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 839 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 850 | 850 |
| 851 NOTREACHED(); | 851 NOTREACHED(); |
| 852 return 0; | 852 return 0; |
| 853 } | 853 } |
| 854 | 854 |
| 855 const base::FilePath& ProfileInfoCache::GetUserDataDir() const { | 855 const base::FilePath& ProfileInfoCache::GetUserDataDir() const { |
| 856 return user_data_dir_; | 856 return user_data_dir_; |
| 857 } | 857 } |
| 858 | 858 |
| 859 // static | 859 // static |
| 860 std::vector<base::string16> ProfileInfoCache::GetProfileNames() { | |
| 861 std::vector<base::string16> names; | |
| 862 PrefService* local_state = g_browser_process->local_state(); | |
| 863 const base::DictionaryValue* cache = local_state->GetDictionary( | |
| 864 prefs::kProfileInfoCache); | |
| 865 base::string16 name; | |
| 866 for (base::DictionaryValue::Iterator it(*cache); !it.IsAtEnd(); | |
| 867 it.Advance()) { | |
| 868 const base::DictionaryValue* info = NULL; | |
| 869 it.value().GetAsDictionary(&info); | |
| 870 info->GetString(kNameKey, &name); | |
| 871 names.push_back(name); | |
| 872 } | |
| 873 return names; | |
| 874 } | |
| 875 | |
| 876 // static | |
| 877 void ProfileInfoCache::RegisterPrefs(PrefRegistrySimple* registry) { | 860 void ProfileInfoCache::RegisterPrefs(PrefRegistrySimple* registry) { |
| 878 registry->RegisterDictionaryPref(prefs::kProfileInfoCache); | 861 registry->RegisterDictionaryPref(prefs::kProfileInfoCache); |
| 879 } | 862 } |
| 880 | 863 |
| 881 void ProfileInfoCache::DownloadHighResAvatarIfNeeded( | 864 void ProfileInfoCache::DownloadHighResAvatarIfNeeded( |
| 882 size_t icon_index, | 865 size_t icon_index, |
| 883 const base::FilePath& profile_path) { | 866 const base::FilePath& profile_path) { |
| 884 // Downloading is only supported on desktop. | 867 // Downloading is only supported on desktop. |
| 885 #if defined(OS_ANDROID) || defined(OS_IOS) || defined(OS_CHROMEOS) | 868 #if defined(OS_ANDROID) || defined(OS_IOS) || defined(OS_CHROMEOS) |
| 886 return; | 869 return; |
| (...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1173 std::vector<base::FilePath>::const_iterator it; | 1156 std::vector<base::FilePath>::const_iterator it; |
| 1174 for (it = profiles_to_rename.begin(); it != profiles_to_rename.end(); ++it) { | 1157 for (it = profiles_to_rename.begin(); it != profiles_to_rename.end(); ++it) { |
| 1175 size_t profile_index = GetIndexOfProfileWithPath(*it); | 1158 size_t profile_index = GetIndexOfProfileWithPath(*it); |
| 1176 SetProfileIsUsingDefaultNameAtIndex(profile_index, true); | 1159 SetProfileIsUsingDefaultNameAtIndex(profile_index, true); |
| 1177 // This will assign a new "Person %d" type name and re-sort the cache. | 1160 // This will assign a new "Person %d" type name and re-sort the cache. |
| 1178 SetNameOfProfileAtIndex(profile_index, ChooseNameForNewProfile( | 1161 SetNameOfProfileAtIndex(profile_index, ChooseNameForNewProfile( |
| 1179 GetAvatarIconIndexOfProfileAtIndex(profile_index))); | 1162 GetAvatarIconIndexOfProfileAtIndex(profile_index))); |
| 1180 } | 1163 } |
| 1181 #endif | 1164 #endif |
| 1182 } | 1165 } |
| OLD | NEW |