Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 13 matching lines...) Expand all Loading... | |
| 24 #include "chrome/browser/profiles/profile_avatar_icon_util.h" | 24 #include "chrome/browser/profiles/profile_avatar_icon_util.h" |
| 25 #include "chrome/browser/profiles/profile_manager.h" | 25 #include "chrome/browser/profiles/profile_manager.h" |
| 26 #include "chrome/browser/signin/account_reconcilor_factory.h" | 26 #include "chrome/browser/signin/account_reconcilor_factory.h" |
| 27 #include "chrome/browser/signin/account_tracker_service_factory.h" | 27 #include "chrome/browser/signin/account_tracker_service_factory.h" |
| 28 #include "chrome/browser/signin/signin_manager_factory.h" | 28 #include "chrome/browser/signin/signin_manager_factory.h" |
| 29 #include "chrome/browser/signin/signin_ui_util.h" | 29 #include "chrome/browser/signin/signin_ui_util.h" |
| 30 #include "chrome/browser/sync/profile_sync_service_factory.h" | 30 #include "chrome/browser/sync/profile_sync_service_factory.h" |
| 31 #include "chrome/browser/ui/browser.h" | 31 #include "chrome/browser/ui/browser.h" |
| 32 #include "chrome/browser/ui/browser_dialogs.h" | 32 #include "chrome/browser/ui/browser_dialogs.h" |
| 33 #include "chrome/browser/ui/profile_chooser_constants.h" | 33 #include "chrome/browser/ui/profile_chooser_constants.h" |
| 34 #include "chrome/browser/ui/profile_error_dialog.h" | |
| 34 #include "chrome/browser/ui/user_manager.h" | 35 #include "chrome/browser/ui/user_manager.h" |
| 35 #include "chrome/common/pref_names.h" | 36 #include "chrome/common/pref_names.h" |
| 36 #include "chrome/common/url_constants.h" | 37 #include "chrome/common/url_constants.h" |
| 38 #include "chrome/grit/generated_resources.h" | |
| 37 #include "components/browser_sync/browser/profile_sync_service.h" | 39 #include "components/browser_sync/browser/profile_sync_service.h" |
| 38 #include "components/flags_ui/pref_service_flags_storage.h" | 40 #include "components/flags_ui/pref_service_flags_storage.h" |
| 39 #include "components/prefs/pref_service.h" | 41 #include "components/prefs/pref_service.h" |
| 40 #include "components/signin/core/browser/account_reconcilor.h" | 42 #include "components/signin/core/browser/account_reconcilor.h" |
| 41 #include "components/signin/core/browser/account_tracker_service.h" | 43 #include "components/signin/core/browser/account_tracker_service.h" |
| 42 #include "components/signin/core/browser/signin_manager.h" | 44 #include "components/signin/core/browser/signin_manager.h" |
| 43 #include "components/signin/core/common/profile_management_switches.h" | 45 #include "components/signin/core/common/profile_management_switches.h" |
| 44 #include "components/signin/core/common/signin_pref_names.h" | 46 #include "components/signin/core/common/signin_pref_names.h" |
| 45 #include "components/signin/core/common/signin_switches.h" | 47 #include "components/signin/core/common/signin_switches.h" |
| 46 #include "content/public/browser/browser_thread.h" | 48 #include "content/public/browser/browser_thread.h" |
| (...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 206 } | 208 } |
| 207 | 209 |
| 208 void OpenBrowserWindowForProfile( | 210 void OpenBrowserWindowForProfile( |
| 209 ProfileManager::CreateCallback callback, | 211 ProfileManager::CreateCallback callback, |
| 210 bool always_create, | 212 bool always_create, |
| 211 bool is_new_profile, | 213 bool is_new_profile, |
| 212 Profile* profile, | 214 Profile* profile, |
| 213 Profile::CreateStatus status) { | 215 Profile::CreateStatus status) { |
| 214 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 216 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 215 | 217 |
| 218 if (status == Profile::CREATE_STATUS_LOCAL_FAIL) { | |
| 219 ShowProfileErrorDialog(PROFILE_ERROR_SWITCH_TO_FAILURE, | |
| 220 IDS_COULDNT_SWITCH_PROFILE_ERROR); | |
| 221 return; | |
|
Peter Kasting
2016/06/13 04:43:20
Nit: Not necessary (next conditional does this for
WC Leung
2016/06/13 08:06:45
Acknowledged.
| |
| 222 } | |
| 223 | |
| 216 if (status != Profile::CREATE_STATUS_INITIALIZED) | 224 if (status != Profile::CREATE_STATUS_INITIALIZED) |
| 217 return; | 225 return; |
| 218 | 226 |
| 219 chrome::startup::IsProcessStartup is_process_startup = | 227 chrome::startup::IsProcessStartup is_process_startup = |
| 220 chrome::startup::IS_NOT_PROCESS_STARTUP; | 228 chrome::startup::IS_NOT_PROCESS_STARTUP; |
| 221 chrome::startup::IsFirstRun is_first_run = chrome::startup::IS_NOT_FIRST_RUN; | 229 chrome::startup::IsFirstRun is_first_run = chrome::startup::IS_NOT_FIRST_RUN; |
| 222 | 230 |
| 223 // If this is a brand new profile, then start a first run window. | 231 // If this is a brand new profile, then start a first run window. |
| 224 if (is_new_profile) { | 232 if (is_new_profile) { |
| 225 is_process_startup = chrome::startup::IS_PROCESS_STARTUP; | 233 is_process_startup = chrome::startup::IS_PROCESS_STARTUP; |
| (...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 491 PrefService* local_state = g_browser_process->local_state(); | 499 PrefService* local_state = g_browser_process->local_state(); |
| 492 const bool dismissed = local_state->GetBoolean( | 500 const bool dismissed = local_state->GetBoolean( |
| 493 prefs::kProfileAvatarRightClickTutorialDismissed); | 501 prefs::kProfileAvatarRightClickTutorialDismissed); |
| 494 | 502 |
| 495 // Don't show the tutorial if it's already been dismissed or if right-clicking | 503 // Don't show the tutorial if it's already been dismissed or if right-clicking |
| 496 // wouldn't show any targets. | 504 // wouldn't show any targets. |
| 497 return !dismissed && HasProfileSwitchTargets(profile); | 505 return !dismissed && HasProfileSwitchTargets(profile); |
| 498 } | 506 } |
| 499 | 507 |
| 500 } // namespace profiles | 508 } // namespace profiles |
| OLD | NEW |