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_impl.h" | 5 #include "chrome/browser/profiles/profile_impl.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/callback.h" | 8 #include "base/callback.h" |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
(...skipping 1147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1158 GetPrefs()->GetString(prefs::kHomePage), | 1158 GetPrefs()->GetString(prefs::kHomePage), |
1159 std::string())); | 1159 std::string())); |
1160 if (!home_page.is_valid()) | 1160 if (!home_page.is_valid()) |
1161 return GURL(chrome::kChromeUINewTabURL); | 1161 return GURL(chrome::kChromeUINewTabURL); |
1162 return home_page; | 1162 return home_page; |
1163 } | 1163 } |
1164 | 1164 |
1165 void ProfileImpl::UpdateProfileUserNameCache() { | 1165 void ProfileImpl::UpdateProfileUserNameCache() { |
1166 ProfileManager* profile_manager = g_browser_process->profile_manager(); | 1166 ProfileManager* profile_manager = g_browser_process->profile_manager(); |
1167 ProfileInfoCache& cache = profile_manager->GetProfileInfoCache(); | 1167 ProfileInfoCache& cache = profile_manager->GetProfileInfoCache(); |
1168 size_t index = cache.GetIndexOfProfileWithPath(GetPath()); | 1168 ProfileInfoEntry entry; |
1169 if (index != std::string::npos) { | 1169 if (cache.GetInfoForProfile(GetPath(), &entry)) { |
1170 std::string user_name = | 1170 std::string user_name = |
1171 GetPrefs()->GetString(prefs::kGoogleServicesUsername); | 1171 GetPrefs()->GetString(prefs::kGoogleServicesUsername); |
1172 cache.SetUserNameOfProfileAtIndex(index, UTF8ToUTF16(user_name)); | 1172 entry.set_user_name(UTF8ToUTF16(user_name)); |
| 1173 cache.SetInfoForProfile(entry); |
1173 } | 1174 } |
1174 } | 1175 } |
1175 | 1176 |
1176 void ProfileImpl::UpdateProfileNameCache() { | 1177 void ProfileImpl::UpdateProfileNameCache() { |
1177 ProfileManager* profile_manager = g_browser_process->profile_manager(); | 1178 ProfileManager* profile_manager = g_browser_process->profile_manager(); |
1178 ProfileInfoCache& cache = profile_manager->GetProfileInfoCache(); | 1179 ProfileInfoCache& cache = profile_manager->GetProfileInfoCache(); |
1179 size_t index = cache.GetIndexOfProfileWithPath(GetPath()); | 1180 ProfileInfoEntry entry; |
1180 if (index != std::string::npos) { | 1181 if (cache.GetInfoForProfile(GetPath(), &entry)) { |
1181 std::string profile_name = | 1182 std::string profile_name = |
1182 GetPrefs()->GetString(prefs::kProfileName); | 1183 GetPrefs()->GetString(prefs::kProfileName); |
1183 cache.SetNameOfProfileAtIndex(index, UTF8ToUTF16(profile_name)); | 1184 entry.set_name(UTF8ToUTF16(profile_name)); |
| 1185 cache.SetInfoForProfile(entry); |
1184 } | 1186 } |
1185 } | 1187 } |
1186 | 1188 |
1187 void ProfileImpl::UpdateProfileAvatarCache() { | 1189 void ProfileImpl::UpdateProfileAvatarCache() { |
1188 ProfileManager* profile_manager = g_browser_process->profile_manager(); | 1190 ProfileManager* profile_manager = g_browser_process->profile_manager(); |
1189 ProfileInfoCache& cache = profile_manager->GetProfileInfoCache(); | 1191 ProfileInfoCache& cache = profile_manager->GetProfileInfoCache(); |
1190 size_t index = cache.GetIndexOfProfileWithPath(GetPath()); | 1192 ProfileInfoEntry entry; |
1191 if (index != std::string::npos) { | 1193 if (cache.GetInfoForProfile(GetPath(), &entry)) { |
1192 size_t avatar_index = | 1194 size_t avatar_index = |
1193 GetPrefs()->GetInteger(prefs::kProfileAvatarIndex); | 1195 GetPrefs()->GetInteger(prefs::kProfileAvatarIndex); |
1194 cache.SetAvatarIconOfProfileAtIndex(index, avatar_index); | 1196 entry.set_icon_index(avatar_index); |
| 1197 cache.SetInfoForProfile(entry); |
1195 } | 1198 } |
1196 } | 1199 } |
1197 | 1200 |
1198 void ProfileImpl::UpdateProfileIsEphemeralCache() { | 1201 void ProfileImpl::UpdateProfileIsEphemeralCache() { |
1199 ProfileManager* profile_manager = g_browser_process->profile_manager(); | 1202 ProfileManager* profile_manager = g_browser_process->profile_manager(); |
1200 ProfileInfoCache& cache = profile_manager->GetProfileInfoCache(); | 1203 ProfileInfoCache& cache = profile_manager->GetProfileInfoCache(); |
1201 size_t index = cache.GetIndexOfProfileWithPath(GetPath()); | 1204 size_t index = cache.GetIndexOfProfileWithPath(GetPath()); |
1202 if (index != std::string::npos) { | 1205 if (index != std::string::npos) { |
1203 bool is_ephemeral = GetPrefs()->GetBoolean(prefs::kForceEphemeralProfiles); | 1206 bool is_ephemeral = GetPrefs()->GetBoolean(prefs::kForceEphemeralProfiles); |
1204 cache.SetProfileIsEphemeralAtIndex(index, is_ephemeral); | 1207 cache.SetProfileIsEphemeralAtIndex(index, is_ephemeral); |
(...skipping 20 matching lines...) Expand all Loading... |
1225 PrefProxyConfigTracker* ProfileImpl::CreateProxyConfigTracker() { | 1228 PrefProxyConfigTracker* ProfileImpl::CreateProxyConfigTracker() { |
1226 #if defined(OS_CHROMEOS) | 1229 #if defined(OS_CHROMEOS) |
1227 if (chromeos::ProfileHelper::IsSigninProfile(this)) { | 1230 if (chromeos::ProfileHelper::IsSigninProfile(this)) { |
1228 return ProxyServiceFactory::CreatePrefProxyConfigTrackerOfLocalState( | 1231 return ProxyServiceFactory::CreatePrefProxyConfigTrackerOfLocalState( |
1229 g_browser_process->local_state()); | 1232 g_browser_process->local_state()); |
1230 } | 1233 } |
1231 #endif // defined(OS_CHROMEOS) | 1234 #endif // defined(OS_CHROMEOS) |
1232 return ProxyServiceFactory::CreatePrefProxyConfigTrackerOfProfile( | 1235 return ProxyServiceFactory::CreatePrefProxyConfigTrackerOfProfile( |
1233 GetPrefs(), g_browser_process->local_state()); | 1236 GetPrefs(), g_browser_process->local_state()); |
1234 } | 1237 } |
OLD | NEW |