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

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: Fix a mistake in a comment. (Didn't check Atom reflow output, sorry :-( ) Created 4 years, 4 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
« no previous file with comments | « chrome/browser/profiles/profiles_state.h ('k') | chrome/browser/ui/profile_error_dialog.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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| may be false if a profile is specified on the command line.
220 if (has_entry && !entry->IsSigninRequired())
221 return false; 221 return false;
222 222
223 SetLastUsedProfile(guest_path.BaseName().MaybeAsASCII()); 223 SetLastUsedProfile(guest_path.BaseName().MaybeAsASCII());
224 224
225 return true; 225 return true;
226 } 226 }
227 227
228 void RemoveBrowsingDataForProfile(const base::FilePath& profile_path) { 228 void RemoveBrowsingDataForProfile(const base::FilePath& profile_path) {
229 // The BrowsingDataRemover relies on the ResourceDispatcherHost, which is 229 // The BrowsingDataRemover relies on the ResourceDispatcherHost, which is
230 // null in unit tests. 230 // null in unit tests.
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
270 if (!entry->IsSigninRequired() && 270 if (!entry->IsSigninRequired() &&
271 !entry->IsChild() && 271 !entry->IsChild() &&
272 !entry->IsLegacySupervised()) { 272 !entry->IsLegacySupervised()) {
273 return false; 273 return false;
274 } 274 }
275 } 275 }
276 return all_profiles_locked; 276 return all_profiles_locked;
277 } 277 }
278 278
279 } // namespace profiles 279 } // namespace profiles
OLDNEW
« no previous file with comments | « chrome/browser/profiles/profiles_state.h ('k') | chrome/browser/ui/profile_error_dialog.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698