Commit d7d1e83e authored by jwd@chromium.org's avatar jwd@chromium.org

Refactor ProfileManager::DoFinalInit(...) to allow for a more flexible...

Refactor ProfileManager::DoFinalInit(...) to allow for a more flexible ProfileManagerWithoutInit. Factored out the parts of DoFinalInit that are not desired in ProfileManagerWithoutInit and for ProfileManager unit tests. This is to make it possible to write unit tests for code that belongs in DoFinalInit, such as setting up the ProfileInfoCache entry for a profile.

BUG=NONE
TEST=unit_tests --gtest_filter=ProfileManager*

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

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@109647 0039d316-1c4b-4281-b951-d872f2087c98
parent ad3820a9
......@@ -465,12 +465,20 @@ void ProfileManager::OnBrowserSetLastActive(const Browser* browser) {
}
void ProfileManager::DoFinalInit(Profile* profile, bool go_off_the_record) {
DoFinalInitForServices(profile, go_off_the_record);
AddProfileToCache(profile);
DoFinalInitLogging(profile);
}
void ProfileManager::DoFinalInitForServices(Profile* profile,
bool go_off_the_record) {
const CommandLine& command_line = *CommandLine::ForCurrentProcess();
profile->InitExtensions(!go_off_the_record);
if (!command_line.HasSwitch(switches::kDisableWebResources))
profile->InitPromoResources();
AddProfileToCache(profile);
}
void ProfileManager::DoFinalInitLogging(Profile* profile) {
// Log the profile size after a reasonable startup delay.
BrowserThread::PostDelayedTask(BrowserThread::FILE, FROM_HERE,
new ProfileSizeTask(profile), 112000);
......
......@@ -195,6 +195,8 @@ class ProfileManager : public base::NonThreadSafe,
protected:
// Does final initial actions.
virtual void DoFinalInit(Profile* profile, bool go_off_the_record);
virtual void DoFinalInitForServices(Profile* profile, bool go_off_the_record);
virtual void DoFinalInitLogging(Profile* profile);
// Creates a new profile. Virtual so that unittests can return TestingProfile.
virtual Profile* CreateProfile(const FilePath& path);
......@@ -285,7 +287,8 @@ class ProfileManagerWithoutInit : public ProfileManager {
explicit ProfileManagerWithoutInit(const FilePath& user_data_dir);
protected:
virtual void DoFinalInit(Profile*, bool) {}
virtual void DoFinalInitForServices(Profile*, bool) OVERRIDE {}
virtual void DoFinalInitLogging(Profile*) OVERRIDE {}
};
#endif // CHROME_BROWSER_PROFILES_PROFILE_MANAGER_H_
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