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