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 575 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
586 // static | 586 // static |
587 base::FilePath ProfileManager::GetGuestProfilePath() { | 587 base::FilePath ProfileManager::GetGuestProfilePath() { |
588 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 588 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
589 | 589 |
590 ProfileManager* profile_manager = g_browser_process->profile_manager(); | 590 ProfileManager* profile_manager = g_browser_process->profile_manager(); |
591 | 591 |
592 base::FilePath guest_path = profile_manager->user_data_dir(); | 592 base::FilePath guest_path = profile_manager->user_data_dir(); |
593 return guest_path.Append(chrome::kGuestProfileDir); | 593 return guest_path.Append(chrome::kGuestProfileDir); |
594 } | 594 } |
595 | 595 |
| 596 // static |
| 597 base::FilePath ProfileManager::GetSystemProfilePath() { |
| 598 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 599 |
| 600 ProfileManager* profile_manager = g_browser_process->profile_manager(); |
| 601 |
| 602 base::FilePath system_path = profile_manager->user_data_dir(); |
| 603 return system_path.Append(chrome::kSystemProfileDir); |
| 604 } |
| 605 |
596 base::FilePath ProfileManager::GenerateNextProfileDirectoryPath() { | 606 base::FilePath ProfileManager::GenerateNextProfileDirectoryPath() { |
597 PrefService* local_state = g_browser_process->local_state(); | 607 PrefService* local_state = g_browser_process->local_state(); |
598 DCHECK(local_state); | 608 DCHECK(local_state); |
599 | 609 |
600 DCHECK(profiles::IsMultipleProfilesEnabled()); | 610 DCHECK(profiles::IsMultipleProfilesEnabled()); |
601 | 611 |
602 // Create the next profile in the next available directory slot. | 612 // Create the next profile in the next available directory slot. |
603 int next_directory = local_state->GetInteger(prefs::kProfilesNumCreated); | 613 int next_directory = local_state->GetInteger(prefs::kProfilesNumCreated); |
604 std::string profile_name = chrome::kMultiProfileDirPrefix; | 614 std::string profile_name = chrome::kMultiProfileDirPrefix; |
605 profile_name.append(base::IntToString(next_directory)); | 615 profile_name.append(base::IntToString(next_directory)); |
(...skipping 570 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1176 return info; | 1186 return info; |
1177 } | 1187 } |
1178 | 1188 |
1179 ProfileManager::ProfileInfo* ProfileManager::GetProfileInfoByPath( | 1189 ProfileManager::ProfileInfo* ProfileManager::GetProfileInfoByPath( |
1180 const base::FilePath& path) const { | 1190 const base::FilePath& path) const { |
1181 ProfilesInfoMap::const_iterator iter = profiles_info_.find(path); | 1191 ProfilesInfoMap::const_iterator iter = profiles_info_.find(path); |
1182 return (iter == profiles_info_.end()) ? NULL : iter->second.get(); | 1192 return (iter == profiles_info_.end()) ? NULL : iter->second.get(); |
1183 } | 1193 } |
1184 | 1194 |
1185 void ProfileManager::AddProfileToCache(Profile* profile) { | 1195 void ProfileManager::AddProfileToCache(Profile* profile) { |
1186 if (profile->IsGuestSession()) | 1196 if (profile->IsGuestSession() || profile->IsSystemProfile()) |
1187 return; | 1197 return; |
1188 ProfileInfoCache& cache = GetProfileInfoCache(); | 1198 ProfileInfoCache& cache = GetProfileInfoCache(); |
1189 if (profile->GetPath().DirName() != cache.GetUserDataDir()) | 1199 if (profile->GetPath().DirName() != cache.GetUserDataDir()) |
1190 return; | 1200 return; |
1191 | 1201 |
1192 SigninManagerBase* signin_manager = | 1202 SigninManagerBase* signin_manager = |
1193 SigninManagerFactory::GetForProfile(profile); | 1203 SigninManagerFactory::GetForProfile(profile); |
1194 base::string16 username = base::UTF8ToUTF16( | 1204 base::string16 username = base::UTF8ToUTF16( |
1195 signin_manager->GetAuthenticatedUsername()); | 1205 signin_manager->GetAuthenticatedUsername()); |
1196 | 1206 |
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1356 last_non_supervised_profile_path.BaseName().MaybeAsASCII()); | 1366 last_non_supervised_profile_path.BaseName().MaybeAsASCII()); |
1357 FinishDeletingProfile(profile_to_delete_path); | 1367 FinishDeletingProfile(profile_to_delete_path); |
1358 } | 1368 } |
1359 } | 1369 } |
1360 } | 1370 } |
1361 #endif | 1371 #endif |
1362 | 1372 |
1363 ProfileManagerWithoutInit::ProfileManagerWithoutInit( | 1373 ProfileManagerWithoutInit::ProfileManagerWithoutInit( |
1364 const base::FilePath& user_data_dir) : ProfileManager(user_data_dir) { | 1374 const base::FilePath& user_data_dir) : ProfileManager(user_data_dir) { |
1365 } | 1375 } |
OLD | NEW |