Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(98)

Side by Side Diff: chrome/browser/profiles/profiles_state.cc

Issue 2047483003: Add fallback behavior if the last used profile cannot initialize (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@bug-614753-fix
Patch Set: Handle the case where the selected profile is not in ProfileAttributesStorage Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/profiles/profiles_state.h" 5 #include "chrome/browser/profiles/profiles_state.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include "base/files/file_path.h" 9 #include "base/files/file_path.h"
10 #include "base/strings/utf_string_conversions.h" 10 #include "base/strings/utf_string_conversions.h"
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after
208 const base::FilePath& active_profile_path = 208 const base::FilePath& active_profile_path =
209 profile_manager->GetLastUsedProfileDir(profile_manager->user_data_dir()); 209 profile_manager->GetLastUsedProfileDir(profile_manager->user_data_dir());
210 const base::FilePath& guest_path = ProfileManager::GetGuestProfilePath(); 210 const base::FilePath& guest_path = ProfileManager::GetGuestProfilePath();
211 if (active_profile_path == guest_path) 211 if (active_profile_path == guest_path)
212 return true; 212 return true;
213 213
214 ProfileAttributesEntry* entry; 214 ProfileAttributesEntry* entry;
215 bool has_entry = 215 bool has_entry =
216 g_browser_process->profile_manager()->GetProfileAttributesStorage(). 216 g_browser_process->profile_manager()->GetProfileAttributesStorage().
217 GetProfileAttributesWithPath(active_profile_path, &entry); 217 GetProfileAttributesWithPath(active_profile_path, &entry);
218 DCHECK(has_entry);
219 218
220 if (!entry->IsSigninRequired()) 219 // |has_entry| is possible to be false if a profile is specified in the
220 // --profile-directory switch.
Peter Kasting 2016/07/01 00:53:23 Nit: "|has_entry| may be false when the user speci
WC Leung 2016/07/07 17:01:53 Done.
221 if (has_entry && !entry->IsSigninRequired())
221 return false; 222 return false;
222 223
223 SetLastUsedProfile(guest_path.BaseName().MaybeAsASCII()); 224 SetLastUsedProfile(guest_path.BaseName().MaybeAsASCII());
224 225
225 return true; 226 return true;
226 } 227 }
227 228
228 void RemoveBrowsingDataForProfile(const base::FilePath& profile_path) { 229 void RemoveBrowsingDataForProfile(const base::FilePath& profile_path) {
229 // The BrowsingDataRemover relies on the ResourceDispatcherHost, which is 230 // The BrowsingDataRemover relies on the ResourceDispatcherHost, which is
230 // null in unit tests. 231 // null in unit tests.
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
270 if (!entry->IsSigninRequired() && 271 if (!entry->IsSigninRequired() &&
271 !entry->IsChild() && 272 !entry->IsChild() &&
272 !entry->IsLegacySupervised()) { 273 !entry->IsLegacySupervised()) {
273 return false; 274 return false;
274 } 275 }
275 } 276 }
276 return all_profiles_locked; 277 return all_profiles_locked;
277 } 278 }
278 279
279 } // namespace profiles 280 } // namespace profiles
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698