Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(313)

Side by Side Diff: chrome/browser/profiles/profile_manager.cc

Issue 12090062: Enable profile switching for standalone App Launcher via the Settings App. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: disable tests on aura Created 7 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 <set> 5 #include <set>
6 6
7 #include "chrome/browser/profiles/profile_manager.h" 7 #include "chrome/browser/profiles/profile_manager.h"
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 297 matching lines...) Expand 10 before | Expand all | Expand 10 after
308 return relative_profile_dir; 308 return relative_profile_dir;
309 } 309 }
310 310
311 Profile* ProfileManager::GetLastUsedProfile(const FilePath& user_data_dir) { 311 Profile* ProfileManager::GetLastUsedProfile(const FilePath& user_data_dir) {
312 #if defined(OS_CHROMEOS) 312 #if defined(OS_CHROMEOS)
313 // Use default login profile if user has not logged in yet. 313 // Use default login profile if user has not logged in yet.
314 if (!logged_in_) 314 if (!logged_in_)
315 return GetDefaultProfile(user_data_dir); 315 return GetDefaultProfile(user_data_dir);
316 #endif 316 #endif
317 317
318 return GetProfile(GetLastUsedProfileDir(user_data_dir));
319 }
320
321 FilePath ProfileManager::GetLastUsedProfileDir(const FilePath& user_data_dir) {
318 FilePath last_used_profile_dir(user_data_dir); 322 FilePath last_used_profile_dir(user_data_dir);
319 std::string last_profile_used; 323 std::string last_used_profile;
320 PrefService* local_state = g_browser_process->local_state(); 324 PrefService* local_state = g_browser_process->local_state();
321 DCHECK(local_state); 325 DCHECK(local_state);
322 326
323 if (local_state->HasPrefPath(prefs::kProfileLastUsed)) 327 if (local_state->HasPrefPath(prefs::kProfileLastUsed)) {
324 last_profile_used = local_state->GetString(prefs::kProfileLastUsed); 328 return last_used_profile_dir.AppendASCII(
325 last_used_profile_dir = last_profile_used.empty() ? 329 local_state->GetString(prefs::kProfileLastUsed));
326 last_used_profile_dir.AppendASCII(chrome::kInitialProfile) : 330 }
327 last_used_profile_dir.AppendASCII(last_profile_used); 331
328 return GetProfile(last_used_profile_dir); 332 return last_used_profile_dir.AppendASCII(chrome::kInitialProfile);
329 } 333 }
330 334
331 std::vector<Profile*> ProfileManager::GetLastOpenedProfiles( 335 std::vector<Profile*> ProfileManager::GetLastOpenedProfiles(
332 const FilePath& user_data_dir) { 336 const FilePath& user_data_dir) {
333 PrefService* local_state = g_browser_process->local_state(); 337 PrefService* local_state = g_browser_process->local_state();
334 DCHECK(local_state); 338 DCHECK(local_state);
335 339
336 std::vector<Profile*> to_return; 340 std::vector<Profile*> to_return;
337 if (local_state->HasPrefPath(prefs::kProfilesLastActive)) { 341 if (local_state->HasPrefPath(prefs::kProfilesLastActive)) {
338 const ListValue* profile_list = 342 const ListValue* profile_list =
(...skipping 748 matching lines...) Expand 10 before | Expand all | Expand 10 after
1087 ProfileManager::ProfileInfo::ProfileInfo( 1091 ProfileManager::ProfileInfo::ProfileInfo(
1088 Profile* profile, 1092 Profile* profile,
1089 bool created) 1093 bool created)
1090 : profile(profile), 1094 : profile(profile),
1091 created(created) { 1095 created(created) {
1092 } 1096 }
1093 1097
1094 ProfileManager::ProfileInfo::~ProfileInfo() { 1098 ProfileManager::ProfileInfo::~ProfileInfo() {
1095 ProfileDestroyer::DestroyProfileWhenAppropriate(profile.release()); 1099 ProfileDestroyer::DestroyProfileWhenAppropriate(profile.release());
1096 } 1100 }
OLDNEW
« no previous file with comments | « chrome/browser/profiles/profile_manager.h ('k') | chrome/browser/resources/options/browser_options.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698