| 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 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 61 #include "chrome/browser/ui/startup/startup_browser_creator.h" | 61 #include "chrome/browser/ui/startup/startup_browser_creator.h" |
| 62 #endif // !defined (OS_IOS) | 62 #endif // !defined (OS_IOS) |
| 63 | 63 |
| 64 #if defined(OS_WIN) | 64 #if defined(OS_WIN) |
| 65 #include "base/win/metro.h" | 65 #include "base/win/metro.h" |
| 66 #include "chrome/installer/util/browser_distribution.h" | 66 #include "chrome/installer/util/browser_distribution.h" |
| 67 #endif | 67 #endif |
| 68 | 68 |
| 69 #if defined(OS_CHROMEOS) | 69 #if defined(OS_CHROMEOS) |
| 70 #include "chrome/browser/chromeos/login/user_manager.h" | 70 #include "chrome/browser/chromeos/login/user_manager.h" |
| 71 #include "chromeos/chromeos_switches.h" | |
| 72 #include "chromeos/dbus/cryptohome_client.h" | 71 #include "chromeos/dbus/cryptohome_client.h" |
| 73 #include "chromeos/dbus/dbus_thread_manager.h" | 72 #include "chromeos/dbus/dbus_thread_manager.h" |
| 74 #endif | 73 #endif |
| 75 | 74 |
| 76 using content::BrowserThread; | 75 using content::BrowserThread; |
| 77 using content::UserMetricsAction; | 76 using content::UserMetricsAction; |
| 78 | 77 |
| 79 namespace { | 78 namespace { |
| 80 | 79 |
| 81 // Profiles that should be deleted on shutdown. | 80 // Profiles that should be deleted on shutdown. |
| (...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 308 return default_prefs_path; | 307 return default_prefs_path; |
| 309 } | 308 } |
| 310 | 309 |
| 311 base::FilePath ProfileManager::GetInitialProfileDir() { | 310 base::FilePath ProfileManager::GetInitialProfileDir() { |
| 312 base::FilePath relative_profile_dir; | 311 base::FilePath relative_profile_dir; |
| 313 #if defined(OS_CHROMEOS) | 312 #if defined(OS_CHROMEOS) |
| 314 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); | 313 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); |
| 315 if (logged_in_) { | 314 if (logged_in_) { |
| 316 base::FilePath profile_dir; | 315 base::FilePath profile_dir; |
| 317 // If the user has logged in, pick up the new profile. | 316 // If the user has logged in, pick up the new profile. |
| 318 if (command_line.HasSwitch(chromeos::switches::kLoginProfile)) { | 317 if (command_line.HasSwitch(switches::kLoginProfile)) { |
| 319 profile_dir = command_line.GetSwitchValuePath( | 318 profile_dir = command_line.GetSwitchValuePath(switches::kLoginProfile); |
| 320 chromeos::switches::kLoginProfile); | |
| 321 } else { | 319 } else { |
| 322 // We should never be logged in with no profile dir. | 320 // We should never be logged in with no profile dir. |
| 323 NOTREACHED(); | 321 NOTREACHED(); |
| 324 return base::FilePath(""); | 322 return base::FilePath(""); |
| 325 } | 323 } |
| 326 relative_profile_dir = relative_profile_dir.Append(profile_dir); | 324 relative_profile_dir = relative_profile_dir.Append(profile_dir); |
| 327 return relative_profile_dir; | 325 return relative_profile_dir; |
| 328 } | 326 } |
| 329 #endif | 327 #endif |
| 330 // TODO(mirandac): should not automatically be default profile. | 328 // TODO(mirandac): should not automatically be default profile. |
| (...skipping 657 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 988 if (!profile->GetPrefs()->HasPrefPath(prefs::kProfileIsManaged)) | 986 if (!profile->GetPrefs()->HasPrefPath(prefs::kProfileIsManaged)) |
| 989 profile->GetPrefs()->SetBoolean(prefs::kProfileIsManaged, is_managed); | 987 profile->GetPrefs()->SetBoolean(prefs::kProfileIsManaged, is_managed); |
| 990 } | 988 } |
| 991 | 989 |
| 992 bool ProfileManager::ShouldGoOffTheRecord() { | 990 bool ProfileManager::ShouldGoOffTheRecord() { |
| 993 bool go_off_the_record = false; | 991 bool go_off_the_record = false; |
| 994 #if defined(OS_CHROMEOS) | 992 #if defined(OS_CHROMEOS) |
| 995 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); | 993 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); |
| 996 if (!logged_in_ && | 994 if (!logged_in_ && |
| 997 (!command_line.HasSwitch(switches::kTestType) || | 995 (!command_line.HasSwitch(switches::kTestType) || |
| 998 command_line.HasSwitch(chromeos::switches::kLoginProfile))) { | 996 command_line.HasSwitch(switches::kLoginProfile))) { |
| 999 go_off_the_record = true; | 997 go_off_the_record = true; |
| 1000 } | 998 } |
| 1001 #endif | 999 #endif |
| 1002 return go_off_the_record; | 1000 return go_off_the_record; |
| 1003 } | 1001 } |
| 1004 | 1002 |
| 1005 // TODO(robertshield): ProfileManager should not be opening windows and should | 1003 // TODO(robertshield): ProfileManager should not be opening windows and should |
| 1006 // not have to care about HostDesktopType. See http://crbug.com/153864 | 1004 // not have to care about HostDesktopType. See http://crbug.com/153864 |
| 1007 void ProfileManager::ScheduleProfileForDeletion( | 1005 void ProfileManager::ScheduleProfileForDeletion( |
| 1008 const base::FilePath& profile_dir, | 1006 const base::FilePath& profile_dir, |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1126 ProfileManager::ProfileInfo::ProfileInfo( | 1124 ProfileManager::ProfileInfo::ProfileInfo( |
| 1127 Profile* profile, | 1125 Profile* profile, |
| 1128 bool created) | 1126 bool created) |
| 1129 : profile(profile), | 1127 : profile(profile), |
| 1130 created(created) { | 1128 created(created) { |
| 1131 } | 1129 } |
| 1132 | 1130 |
| 1133 ProfileManager::ProfileInfo::~ProfileInfo() { | 1131 ProfileManager::ProfileInfo::~ProfileInfo() { |
| 1134 ProfileDestroyer::DestroyProfileWhenAppropriate(profile.release()); | 1132 ProfileDestroyer::DestroyProfileWhenAppropriate(profile.release()); |
| 1135 } | 1133 } |
| OLD | NEW |