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_manager.h" | 5 #include "chrome/browser/profiles/profile_manager.h" |
6 | 6 |
7 #include <set> | 7 #include <set> |
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 1178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1189 if (last_active->GetPrefs()->GetBoolean(prefs::kForceEphemeralProfiles)) | 1189 if (last_active->GetPrefs()->GetBoolean(prefs::kForceEphemeralProfiles)) |
1190 return; | 1190 return; |
1191 | 1191 |
1192 PrefService* local_state = g_browser_process->local_state(); | 1192 PrefService* local_state = g_browser_process->local_state(); |
1193 DCHECK(local_state); | 1193 DCHECK(local_state); |
1194 // Only keep track of profiles that we are managing; tests may create others. | 1194 // Only keep track of profiles that we are managing; tests may create others. |
1195 if (profile_manager_->profiles_info_.find( | 1195 if (profile_manager_->profiles_info_.find( |
1196 last_active->GetPath()) != profile_manager_->profiles_info_.end()) { | 1196 last_active->GetPath()) != profile_manager_->profiles_info_.end()) { |
1197 local_state->SetString(prefs::kProfileLastUsed, | 1197 local_state->SetString(prefs::kProfileLastUsed, |
1198 last_active->GetPath().BaseName().MaybeAsASCII()); | 1198 last_active->GetPath().BaseName().MaybeAsASCII()); |
| 1199 |
| 1200 ProfileInfoCache& cache = profile_manager_->GetProfileInfoCache(); |
| 1201 size_t profile_index = |
| 1202 cache.GetIndexOfProfileWithPath(last_active->GetPath()); |
| 1203 if (profile_index != std::string::npos) |
| 1204 cache.SetProfileActiveTimeAtIndex(profile_index); |
1199 } | 1205 } |
1200 } | 1206 } |
1201 #endif // !defined(OS_ANDROID) && !defined(OS_IOS) | 1207 #endif // !defined(OS_ANDROID) && !defined(OS_IOS) |
1202 | 1208 |
1203 #if defined(OS_MACOSX) | 1209 #if defined(OS_MACOSX) |
1204 void ProfileManager::OnNewActiveProfileLoaded( | 1210 void ProfileManager::OnNewActiveProfileLoaded( |
1205 const base::FilePath& profile_to_delete_path, | 1211 const base::FilePath& profile_to_delete_path, |
1206 const base::FilePath& last_non_managed_profile_path, | 1212 const base::FilePath& last_non_managed_profile_path, |
1207 const CreateCallback& original_callback, | 1213 const CreateCallback& original_callback, |
1208 Profile* loaded_profile, | 1214 Profile* loaded_profile, |
(...skipping 15 matching lines...) Expand all Loading... |
1224 last_non_managed_profile_path.BaseName().MaybeAsASCII()); | 1230 last_non_managed_profile_path.BaseName().MaybeAsASCII()); |
1225 FinishDeletingProfile(profile_to_delete_path); | 1231 FinishDeletingProfile(profile_to_delete_path); |
1226 } | 1232 } |
1227 } | 1233 } |
1228 } | 1234 } |
1229 #endif | 1235 #endif |
1230 | 1236 |
1231 ProfileManagerWithoutInit::ProfileManagerWithoutInit( | 1237 ProfileManagerWithoutInit::ProfileManagerWithoutInit( |
1232 const base::FilePath& user_data_dir) : ProfileManager(user_data_dir) { | 1238 const base::FilePath& user_data_dir) : ProfileManager(user_data_dir) { |
1233 } | 1239 } |
OLD | NEW |