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