summaryrefslogtreecommitdiffstats
path: root/chrome/browser/profile_manager.cc
diff options
context:
space:
mode:
authordavemoore@chromium.org <davemoore@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-05-21 22:21:11 +0000
committerdavemoore@chromium.org <davemoore@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-05-21 22:21:11 +0000
commit1172ba7af32d7756a138b2f5d4761cb8d566f29c (patch)
treec3623ce6a47f09e08f664ed961eb28a654dd4d12 /chrome/browser/profile_manager.cc
parentf1c74ecbdfbe62d62668bdbeb7639284f0b455f4 (diff)
downloadchromium_src-1172ba7af32d7756a138b2f5d4761cb8d566f29c.zip
chromium_src-1172ba7af32d7756a138b2f5d4761cb8d566f29c.tar.gz
chromium_src-1172ba7af32d7756a138b2f5d4761cb8d566f29c.tar.bz2
Ensure that the default profile for cros has no extension service
BUG=chromeium-os:3232 TEST=LoginProfileTest.UserNotPassed Review URL: http://codereview.chromium.org/2094018 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@47959 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/profile_manager.cc')
-rw-r--r--chrome/browser/profile_manager.cc41
1 files changed, 18 insertions, 23 deletions
diff --git a/chrome/browser/profile_manager.cc b/chrome/browser/profile_manager.cc
index 296ac4b..c755cfe 100644
--- a/chrome/browser/profile_manager.cc
+++ b/chrome/browser/profile_manager.cc
@@ -117,7 +117,7 @@ Profile* ProfileManager::GetDefaultProfile(const FilePath& user_data_dir) {
// If not logged in on cros, always return the incognito profile
default_profile_dir = default_profile_dir.Append(
FilePath::FromWStringHack(chrome::kNotSignedInProfile));
- Profile* profile = GetProfile(default_profile_dir);
+ Profile* profile;
// For cros, return the OTR profile so we never accidentally keep
// user data in an unencrypted profile. But doing this makes
@@ -125,9 +125,13 @@ Profile* ProfileManager::GetDefaultProfile(const FilePath& user_data_dir) {
// if the login-profile switch is passed so that we can test this.
// TODO(davemoore) Fix the tests so they allow OTR profiles.
if (!command_line.HasSwitch(switches::kTestType) ||
- command_line.HasSwitch(switches::kLoginProfile))
+ command_line.HasSwitch(switches::kLoginProfile)) {
+ // Don't init extensions for this profile
+ profile = GetProfile(default_profile_dir, false);
profile = profile->GetOffTheRecordProfile();
-
+ } else {
+ profile = GetProfile(default_profile_dir, true);
+ }
return profile;
}
#else
@@ -137,20 +141,6 @@ Profile* ProfileManager::GetDefaultProfile(const FilePath& user_data_dir) {
#endif
}
-#if defined(OS_CHROMEOS)
-Profile* ProfileManager::GetWizardProfile() {
- FilePath user_data_dir;
- PathService::Get(chrome::DIR_USER_DATA, &user_data_dir);
- FilePath default_profile_dir(user_data_dir);
- default_profile_dir = default_profile_dir.Append(
- FilePath::FromWStringHack(chrome::kNotSignedInProfile));
- ProfileManager* profile_manager = g_browser_process->profile_manager();
-
- // Don't init extensions for this profile
- return profile_manager->GetProfile(default_profile_dir, false);
-}
-#endif
-
Profile* ProfileManager::GetProfile(const FilePath& profile_dir) {
return GetProfile(profile_dir, true);
}
@@ -233,12 +223,17 @@ void ProfileManager::Observe(
const NotificationDetails& details) {
#if defined(OS_CHROMEOS)
if (type == NotificationType::LOGIN_USER_CHANGED) {
- CHECK(chromeos::CrosLibrary::Get()->EnsureLoaded());
- // If we don't have a mounted profile directory we're in trouble.
- // TODO(davemoore) Once we have better api this check should ensure that
- // our profile directory is the one that's mounted, and that it's mounted
- // as the current user.
- CHECK(chromeos::CrosLibrary::Get()->GetCryptohomeLibrary()->IsMounted());
+ const CommandLine& command_line = *CommandLine::ForCurrentProcess();
+ if (!command_line.HasSwitch(switches::kTestType)) {
+ // This will fail when running on non cros os.
+ // TODO(davemoore) Need to mock this enough to enable testing.
+ CHECK(chromeos::CrosLibrary::Get()->EnsureLoaded());
+ // If we don't have a mounted profile directory we're in trouble.
+ // TODO(davemoore) Once we have better api this check should ensure that
+ // our profile directory is the one that's mounted, and that it's mounted
+ // as the current user.
+ CHECK(chromeos::CrosLibrary::Get()->GetCryptohomeLibrary()->IsMounted());
+ }
logged_in_ = true;
}
#endif