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

Side by Side Diff: chrome/browser/chrome_browser_main.cc

Issue 1021613002: Fail gracefully if the active profile can't be found in the ProfileInfoCache (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 9 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 | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/chrome_browser_main.h" 5 #include "chrome/browser/chrome_browser_main.h"
6 6
7 #include <set> 7 #include <set>
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 356 matching lines...) Expand 10 before | Expand all | Expand 10 after
367 // signed out, then we should show the user manager instead. By switching 367 // signed out, then we should show the user manager instead. By switching
368 // the active profile to the guest profile we ensure that no 368 // the active profile to the guest profile we ensure that no
369 // browser windows will be opened for the guest profile. 369 // browser windows will be opened for the guest profile.
370 if (switches::IsNewProfileManagement() && 370 if (switches::IsNewProfileManagement() &&
371 profile && 371 profile &&
372 !profile->IsGuestSession()) { 372 !profile->IsGuestSession()) {
373 ProfileInfoCache& cache = 373 ProfileInfoCache& cache =
374 g_browser_process->profile_manager()->GetProfileInfoCache(); 374 g_browser_process->profile_manager()->GetProfileInfoCache();
375 size_t profile_index = cache.GetIndexOfProfileWithPath(profile_path); 375 size_t profile_index = cache.GetIndexOfProfileWithPath(profile_path);
376 376
377 if (cache.ProfileIsSigninRequiredAtIndex(profile_index)) 377 if (profile_index != std::string::npos &&
378 cache.ProfileIsSigninRequiredAtIndex(profile_index)) {
378 profile = g_browser_process->profile_manager()->GetProfile( 379 profile = g_browser_process->profile_manager()->GetProfile(
379 ProfileManager::GetGuestProfilePath()); 380 ProfileManager::GetGuestProfilePath());
381 }
380 } 382 }
381 #endif // defined(OS_CHROMEOS) || defined(OS_ANDROID) 383 #endif // defined(OS_CHROMEOS) || defined(OS_ANDROID)
382 if (profile) { 384 if (profile) {
383 UMA_HISTOGRAM_LONG_TIMES( 385 UMA_HISTOGRAM_LONG_TIMES(
384 "Startup.CreateFirstProfile", base::Time::Now() - start); 386 "Startup.CreateFirstProfile", base::Time::Now() - start);
385 return profile; 387 return profile;
386 } 388 }
387 389
388 #if !defined(OS_WIN) 390 #if !defined(OS_WIN)
389 // TODO(port): fix this. See comments near the definition of 391 // TODO(port): fix this. See comments near the definition of
(...skipping 1338 matching lines...) Expand 10 before | Expand all | Expand 10 after
1728 chromeos::CrosSettings::Shutdown(); 1730 chromeos::CrosSettings::Shutdown();
1729 #endif // defined(OS_CHROMEOS) 1731 #endif // defined(OS_CHROMEOS)
1730 #endif // defined(OS_ANDROID) 1732 #endif // defined(OS_ANDROID)
1731 } 1733 }
1732 1734
1733 // Public members: 1735 // Public members:
1734 1736
1735 void ChromeBrowserMainParts::AddParts(ChromeBrowserMainExtraParts* parts) { 1737 void ChromeBrowserMainParts::AddParts(ChromeBrowserMainExtraParts* parts) {
1736 chrome_extra_parts_.push_back(parts); 1738 chrome_extra_parts_.push_back(parts);
1737 } 1739 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698