Commit d4a3e566 authored by antrim@chromium.org's avatar antrim@chromium.org

Do not return profile unless it is loaded

BUG=148878


Review URL: https://chromiumcodereview.appspot.com/11667024

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@176083 0039d316-1c4b-4281-b951-d872f2087c98
parent 91cae259
......@@ -505,6 +505,12 @@ void ChromeBrowserMainPartsChromeos::PreProfileInit() {
app_order_loader_.reset(
new default_app_order::ExternalLoader(false /* async */));
// TODO(antrim): SessionStarted notification should be moved to
// PostProfileInit at some point, as NOTIFICATION_SESSION_STARTED should
// go after NOTIFICATION_LOGIN_USER_PROFILE_PREPARED, which requires
// loaded profile (and, thus, should be fired in PostProfileInit, as
// synchronous profile loading does not emit it).
user_manager->SessionStarted();
}
......
......@@ -362,6 +362,12 @@ Profile* ProfileManager::GetDefaultProfile(const FilePath& user_data_dir) {
return profile->GetOffTheRecordProfile();
return profile;
}
ProfileInfo* profile_info = GetProfileInfoByPath(default_profile_dir);
// Fallback to default off-the-record profile, if user profile has not fully
// loaded yet.
if (profile_info && !profile_info->created)
default_profile_dir = GetDefaultProfileDir(user_data_dir);
#endif
return GetProfile(default_profile_dir);
}
......@@ -489,9 +495,15 @@ ProfileManager::ProfileInfo* ProfileManager::RegisterProfile(
return info;
}
Profile* ProfileManager::GetProfileByPath(const FilePath& path) const {
ProfileManager::ProfileInfo* ProfileManager::GetProfileInfoByPath(
const FilePath& path) const {
ProfilesInfoMap::const_iterator iter = profiles_info_.find(path);
return (iter == profiles_info_.end()) ? NULL : iter->second->profile.get();
return (iter == profiles_info_.end()) ? NULL : iter->second.get();
}
Profile* ProfileManager::GetProfileByPath(const FilePath& path) const {
ProfileInfo* profile_info = GetProfileInfoByPath(path);
return profile_info ? profile_info->profile.get() : NULL;
}
// static
......
......@@ -263,6 +263,10 @@ class ProfileManager : public base::NonThreadSafe,
// entry.
ProfileInfo* RegisterProfile(Profile* profile, bool created);
// Returns ProfileInfo associated with given |path|, registred earlier with
// RegisterProfile.
ProfileInfo* GetProfileInfoByPath(const FilePath& path) const;
typedef std::pair<FilePath, string16> ProfilePathAndName;
typedef std::vector<ProfilePathAndName> ProfilePathAndNames;
ProfilePathAndNames GetSortedProfilesFromDirectoryMap();
......
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