Lines Matching full:profile
71 std::vector<Profile*> profiles(pm->GetLoadedProfiles());
77 Profile* ProfileManager::GetDefaultProfile() {
121 // If the user has logged in, pick up the new profile.
125 // We should never be logged in with no profile dir.
138 Profile* ProfileManager::GetDefaultProfile(const FilePath& user_data_dir) {
143 Profile* profile;
146 // For cros, return the OTR profile so we never accidentally keep
147 // user data in an unencrypted profile. But doing this makes
148 // many of the browser and ui tests fail. We do return the OTR profile
149 // if the login-profile switch is passed so that we can test this.
153 // Don't init extensions for this profile
154 profile = GetProfile(default_profile_dir);
155 profile = profile->GetOffTheRecordProfile();
157 profile = GetProfile(default_profile_dir);
159 return profile;
165 Profile* ProfileManager::GetProfileWithId(ProfileId profile_id) {
166 DCHECK_NE(Profile::kInvalidProfileId, profile_id);
170 Profile* candidate = iter->second->profile.get();
183 bool ProfileManager::IsValidProfile(Profile* profile) {
187 Profile* candidate = iter->second->profile.get();
188 if (candidate == profile ||
190 candidate->GetOffTheRecordProfile() == profile)) {
198 std::vector<Profile*> ProfileManager::GetLoadedProfiles() const {
199 std::vector<Profile*> profiles;
203 profiles.push_back(iter->second->profile.get());
208 Profile* ProfileManager::GetProfile(const FilePath& profile_dir) {
209 // If the profile is already loaded (e.g., chrome.exe launched twice), just
211 Profile* profile = GetProfileByPath(profile_dir);
212 if (NULL != profile)
213 return profile;
215 profile = Profile::CreateProfile(profile_dir);
216 DCHECK(profile);
217 if (profile) {
218 bool result = AddProfile(profile);
221 return profile;
231 // Profile has already been created. Call observer immediately.
232 observer->OnProfileCreated(info->profile.get());
234 // Profile is being created. Add observer to list.
240 RegisterProfile(Profile::CreateProfileAsync(user_data_dir, this),
260 bool ProfileManager::AddProfile(Profile* profile) {
261 DCHECK(profile);
263 // Make sure that we're not loading a profile with the same ID as a profile
265 if (GetProfileByPath(profile->GetPath())) {
266 NOTREACHED() << "Attempted to add profile with the same path (" <<
267 profile->GetPath().value() <<
268 ") as an already-loaded profile.";
272 RegisterProfile(profile, true);
273 DoFinalInit(profile);
277 ProfileManager::ProfileInfo* ProfileManager::RegisterProfile(Profile* profile,
279 ProfileInfo* info = new ProfileInfo(profile, created);
281 (profiles_info_.insert(std::make_pair(profile->GetPath(), info))).first;
285 Profile* ProfileManager::GetProfileByPath(const FilePath& path) const {
287 return (iter == profiles_info_.end()) ? NULL : iter->second->profile.get();
299 std::vector<Profile*> profiles(GetLoadedProfiles());
318 std::vector<Profile*> profiles(GetLoadedProfiles());
344 // If we don't have a mounted profile directory we're in trouble.
346 // our profile directory is the one that's mounted, and that it's mounted
355 void ProfileManager::DoFinalInit(Profile* profile) {
365 profile->InitExtensions(init_extensions);
368 profile->InitPromoResources();
371 void ProfileManager::OnProfileCreated(Profile* profile, bool success) {
374 ProfilesInfoMap::iterator iter = profiles_info_.find(profile->GetPath());
382 DoFinalInit(profile);
389 profile = profile->GetOffTheRecordProfile();
393 profile = NULL;
398 observers[i]->OnProfileCreated(profile);