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

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

Issue 2061593002: Fix crash when switching to a profile that cannot be opened (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@bug-614753-fix
Patch Set: Respond to nits, fix tests Created 4 years, 6 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/profile_window.h" 5 #include "chrome/browser/profiles/profile_window.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
(...skipping 16 matching lines...) Expand all
27 #include "chrome/browser/profiles/profile_avatar_icon_util.h" 27 #include "chrome/browser/profiles/profile_avatar_icon_util.h"
28 #include "chrome/browser/profiles/profile_manager.h" 28 #include "chrome/browser/profiles/profile_manager.h"
29 #include "chrome/browser/signin/account_reconcilor_factory.h" 29 #include "chrome/browser/signin/account_reconcilor_factory.h"
30 #include "chrome/browser/signin/account_tracker_service_factory.h" 30 #include "chrome/browser/signin/account_tracker_service_factory.h"
31 #include "chrome/browser/signin/signin_manager_factory.h" 31 #include "chrome/browser/signin/signin_manager_factory.h"
32 #include "chrome/browser/signin/signin_ui_util.h" 32 #include "chrome/browser/signin/signin_ui_util.h"
33 #include "chrome/browser/sync/profile_sync_service_factory.h" 33 #include "chrome/browser/sync/profile_sync_service_factory.h"
34 #include "chrome/browser/ui/browser.h" 34 #include "chrome/browser/ui/browser.h"
35 #include "chrome/browser/ui/browser_dialogs.h" 35 #include "chrome/browser/ui/browser_dialogs.h"
36 #include "chrome/browser/ui/profile_chooser_constants.h" 36 #include "chrome/browser/ui/profile_chooser_constants.h"
37 #include "chrome/browser/ui/profile_error_dialog.h"
37 #include "chrome/browser/ui/user_manager.h" 38 #include "chrome/browser/ui/user_manager.h"
38 #include "chrome/common/pref_names.h" 39 #include "chrome/common/pref_names.h"
39 #include "chrome/common/url_constants.h" 40 #include "chrome/common/url_constants.h"
41 #include "chrome/grit/generated_resources.h"
40 #include "components/browser_sync/browser/profile_sync_service.h" 42 #include "components/browser_sync/browser/profile_sync_service.h"
41 #include "components/flags_ui/pref_service_flags_storage.h" 43 #include "components/flags_ui/pref_service_flags_storage.h"
42 #include "components/prefs/pref_service.h" 44 #include "components/prefs/pref_service.h"
43 #include "components/signin/core/browser/account_reconcilor.h" 45 #include "components/signin/core/browser/account_reconcilor.h"
44 #include "components/signin/core/browser/account_tracker_service.h" 46 #include "components/signin/core/browser/account_tracker_service.h"
45 #include "components/signin/core/browser/signin_manager.h" 47 #include "components/signin/core/browser/signin_manager.h"
46 #include "components/signin/core/common/profile_management_switches.h" 48 #include "components/signin/core/common/profile_management_switches.h"
47 #include "components/signin/core/common/signin_pref_names.h" 49 #include "components/signin/core/common/signin_pref_names.h"
48 #include "components/signin/core/common/signin_switches.h" 50 #include "components/signin/core/common/signin_switches.h"
49 #include "content/public/browser/browser_thread.h" 51 #include "content/public/browser/browser_thread.h"
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after
223 } 225 }
224 226
225 void OpenBrowserWindowForProfile( 227 void OpenBrowserWindowForProfile(
226 ProfileManager::CreateCallback callback, 228 ProfileManager::CreateCallback callback,
227 bool always_create, 229 bool always_create,
228 bool is_new_profile, 230 bool is_new_profile,
229 Profile* profile, 231 Profile* profile,
230 Profile::CreateStatus status) { 232 Profile::CreateStatus status) {
231 DCHECK_CURRENTLY_ON(BrowserThread::UI); 233 DCHECK_CURRENTLY_ON(BrowserThread::UI);
232 234
235 if (status == Profile::CREATE_STATUS_LOCAL_FAIL) {
236 ShowProfileErrorDialog(PROFILE_ERROR_SWITCH_TO_FAILURE,
237 IDS_COULDNT_OPEN_PROFILE_ERROR);
238 return;
239 }
240
233 if (status != Profile::CREATE_STATUS_INITIALIZED) 241 if (status != Profile::CREATE_STATUS_INITIALIZED)
234 return; 242 return;
235 243
236 chrome::startup::IsProcessStartup is_process_startup = 244 chrome::startup::IsProcessStartup is_process_startup =
237 chrome::startup::IS_NOT_PROCESS_STARTUP; 245 chrome::startup::IS_NOT_PROCESS_STARTUP;
238 chrome::startup::IsFirstRun is_first_run = chrome::startup::IS_NOT_FIRST_RUN; 246 chrome::startup::IsFirstRun is_first_run = chrome::startup::IS_NOT_FIRST_RUN;
239 247
240 // If this is a brand new profile, then start a first run window. 248 // If this is a brand new profile, then start a first run window.
241 if (is_new_profile) { 249 if (is_new_profile) {
242 is_process_startup = chrome::startup::IS_PROCESS_STARTUP; 250 is_process_startup = chrome::startup::IS_PROCESS_STARTUP;
(...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after
516 PrefService* local_state = g_browser_process->local_state(); 524 PrefService* local_state = g_browser_process->local_state();
517 const bool dismissed = local_state->GetBoolean( 525 const bool dismissed = local_state->GetBoolean(
518 prefs::kProfileAvatarRightClickTutorialDismissed); 526 prefs::kProfileAvatarRightClickTutorialDismissed);
519 527
520 // Don't show the tutorial if it's already been dismissed or if right-clicking 528 // Don't show the tutorial if it's already been dismissed or if right-clicking
521 // wouldn't show any targets. 529 // wouldn't show any targets.
522 return !dismissed && HasProfileSwitchTargets(profile); 530 return !dismissed && HasProfileSwitchTargets(profile);
523 } 531 }
524 532
525 } // namespace profiles 533 } // namespace profiles
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698