| 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 298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 309 } | 309 } |
| 310 | 310 |
| 311 base::FilePath ProfileManager::GetInitialProfileDir() { | 311 base::FilePath ProfileManager::GetInitialProfileDir() { |
| 312 base::FilePath relative_profile_dir; | 312 base::FilePath relative_profile_dir; |
| 313 #if defined(OS_CHROMEOS) | 313 #if defined(OS_CHROMEOS) |
| 314 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); | 314 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); |
| 315 if (logged_in_) { | 315 if (logged_in_) { |
| 316 base::FilePath profile_dir; | 316 base::FilePath profile_dir; |
| 317 // If the user has logged in, pick up the new profile. | 317 // If the user has logged in, pick up the new profile. |
| 318 if (command_line.HasSwitch(chromeos::switches::kLoginProfile)) { | 318 if (command_line.HasSwitch(chromeos::switches::kLoginProfile)) { |
| 319 profile_dir = command_line.GetSwitchValuePath( | 319 // TODO(nkostylev): Remove this code completely once we eliminate |
| 320 chromeos::switches::kLoginProfile); | 320 // legacy --login-profile=user switch and enable multi-profiles on CrOS |
| 321 // by default. http://crbug.com/294628 |
| 322 std::string login_profile_value = |
| 323 command_line.GetSwitchValueASCII(chromeos::switches::kLoginProfile); |
| 324 if (login_profile_value == chrome::kLegacyProfileDir || |
| 325 login_profile_value == chrome::kTestUserProfileDir) { |
| 326 profile_dir = base::FilePath(login_profile_value); |
| 327 } else { |
| 328 profile_dir = g_browser_process->platform_part()->profile_helper()-> |
| 329 GetUserProfileDir(login_profile_value); |
| 330 } |
| 321 } else if (!command_line.HasSwitch(switches::kMultiProfiles)) { | 331 } else if (!command_line.HasSwitch(switches::kMultiProfiles)) { |
| 322 // We should never be logged in with no profile dir unless | 332 // We should never be logged in with no profile dir unless |
| 323 // multi-profiles are enabled. | 333 // multi-profiles are enabled. |
| 324 // In that case profile dir will be defined by user_id hash. | 334 // In that case profile dir will be defined by user_id hash. |
| 325 NOTREACHED(); | 335 NOTREACHED(); |
| 326 return base::FilePath(""); | 336 return base::FilePath(""); |
| 327 } | 337 } |
| 328 // In case of multi-profiles ignore --login-profile switch. | 338 // In case of multi-profiles ignore --login-profile switch. |
| 329 // TODO(nkostylev): Some cases like Guest mode will have empty username_hash | 339 // TODO(nkostylev): Some cases like Guest mode will have empty username_hash |
| 330 // so default kLoginProfile dir will be used. | 340 // so default kLoginProfile dir will be used. |
| (...skipping 836 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1167 ProfileManager::ProfileInfo::ProfileInfo( | 1177 ProfileManager::ProfileInfo::ProfileInfo( |
| 1168 Profile* profile, | 1178 Profile* profile, |
| 1169 bool created) | 1179 bool created) |
| 1170 : profile(profile), | 1180 : profile(profile), |
| 1171 created(created) { | 1181 created(created) { |
| 1172 } | 1182 } |
| 1173 | 1183 |
| 1174 ProfileManager::ProfileInfo::~ProfileInfo() { | 1184 ProfileManager::ProfileInfo::~ProfileInfo() { |
| 1175 ProfileDestroyer::DestroyProfileWhenAppropriate(profile.release()); | 1185 ProfileDestroyer::DestroyProfileWhenAppropriate(profile.release()); |
| 1176 } | 1186 } |
| OLD | NEW |