Fix regression where component extensions were being loaded for login profile

BUG=chromium-os:18953
TEST=Login on production build and check for extra extension processes

Review URL: http://codereview.chromium.org/7630002

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@96597 0039d316-1c4b-4281-b951-d872f2087c98
parent 04024e2c
......@@ -2,5 +2,6 @@ set noparent
mirandac@chromium.org
erg@chromium.org
sail@chromium.org
davemoore@chromium.org
# Primarily for ProfileIOData and friends.
willchan@chromium.org
......@@ -195,22 +195,14 @@ Profile* ProfileManager::GetDefaultProfile(const FilePath& user_data_dir) {
default_profile_dir = default_profile_dir.Append(GetInitialProfileDir());
#if defined(OS_CHROMEOS)
if (!logged_in_) {
Profile* profile;
const CommandLine& command_line = *CommandLine::ForCurrentProcess();
Profile* profile = GetProfile(default_profile_dir);
// For cros, return the OTR profile so we never accidentally keep
// user data in an unencrypted profile. But doing this makes
// many of the browser and ui tests fail. We do return the OTR profile
// 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)) {
// Don't init extensions for this profile
profile = GetProfile(default_profile_dir);
profile = profile->GetOffTheRecordProfile();
} else {
profile = GetProfile(default_profile_dir);
}
if (ShouldGoOffTheRecord())
return profile->GetOffTheRecordProfile();
return profile;
}
#endif
......@@ -312,7 +304,7 @@ bool ProfileManager::AddProfile(Profile* profile) {
}
RegisterProfile(profile, true);
DoFinalInit(profile, false);
DoFinalInit(profile, ShouldGoOffTheRecord());
return true;
}
......@@ -381,16 +373,8 @@ void ProfileManager::OnProfileCreated(Profile* profile, bool success) {
std::vector<ProfileManagerObserver*> observers;
info->observers.swap(observers);
bool go_off_the_record = false;
bool go_off_the_record = ShouldGoOffTheRecord();
if (success) {
#if defined(OS_CHROMEOS)
const CommandLine& command_line = *CommandLine::ForCurrentProcess();
if (!logged_in_ &&
(!command_line.HasSwitch(switches::kTestType) ||
command_line.HasSwitch(switches::kLoginProfile))) {
go_off_the_record = true;
}
#endif
if (!go_off_the_record) {
for (size_t i = 0; i < observers.size(); ++i) {
observers[i]->OnProfileCreated(
......@@ -549,6 +533,19 @@ void ProfileManager::AddProfileToCache(Profile* profile) {
}
}
bool ProfileManager::ShouldGoOffTheRecord() {
bool go_off_the_record = false;
#if defined(OS_CHROMEOS)
const CommandLine& command_line = *CommandLine::ForCurrentProcess();
if (!logged_in_ &&
(!command_line.HasSwitch(switches::kTestType) ||
command_line.HasSwitch(switches::kLoginProfile))) {
go_off_the_record = true;
}
#endif
return go_off_the_record;
}
void ProfileManager::ScheduleProfileForDeletion(const FilePath& profile_dir) {
// TODO(sail): Due to bug 88586 we don't delete the profile instance. Once we
// start deleting the profile instance we need to close background apps too.
......
......@@ -215,6 +215,9 @@ class ProfileManager : public base::NonThreadSafe,
// Adds |profile| to the profile info cache if it's not already there.
void AddProfileToCache(Profile* profile);
// For ChromeOS, determines if profile should be otr.
bool ShouldGoOffTheRecord();
NotificationRegistrar registrar_;
// Indicates that a user has logged in and that the profile specified
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment