| OLD | NEW |
| 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/ui/webui/sync_setup_handler.h" | 5 #include "chrome/browser/ui/webui/sync_setup_handler.h" |
| 6 | 6 |
| 7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
| 8 #include "base/bind.h" | 8 #include "base/bind.h" |
| 9 #include "base/bind_helpers.h" | 9 #include "base/bind_helpers.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 851 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 862 // Let the various services know that we're no longer active. | 862 // Let the various services know that we're no longer active. |
| 863 GetLoginUIService()->LoginUIClosed(this); | 863 GetLoginUIService()->LoginUIClosed(this); |
| 864 if (sync_service) | 864 if (sync_service) |
| 865 sync_service->set_setup_in_progress(false); | 865 sync_service->set_setup_in_progress(false); |
| 866 | 866 |
| 867 // Make sure user isn't left half-logged-in (signed in, but without sync | 867 // Make sure user isn't left half-logged-in (signed in, but without sync |
| 868 // started up). If the user hasn't finished setting up sync, then sign out | 868 // started up). If the user hasn't finished setting up sync, then sign out |
| 869 // and shut down sync. | 869 // and shut down sync. |
| 870 if (sync_service && !sync_service->HasSyncSetupCompleted()) { | 870 if (sync_service && !sync_service->HasSyncSetupCompleted()) { |
| 871 DVLOG(1) << "Signin aborted by user action"; | 871 DVLOG(1) << "Signin aborted by user action"; |
| 872 // Calling DisableForUser() will also sign the user out on desktop |
| 873 // platforms (platforms without sync auto-start enabled). |
| 872 sync_service->DisableForUser(); | 874 sync_service->DisableForUser(); |
| 873 #if !defined(OS_CHROMEOS) | 875 |
| 874 GetSignin()->SignOut(); | 876 #if defined(OS_CHROMEOS) |
| 875 #else | 877 // Suppress sync startup on ChromeOS, so it doesn't get restarted when |
| 876 // TODO(atwilson): Move this suppression to PSS::DisableForUser() | 878 // the user logs in again. |
| 877 browser_sync::SyncPrefs sync_prefs(GetProfile()->GetPrefs()); | 879 browser_sync::SyncPrefs sync_prefs(GetProfile()->GetPrefs()); |
| 878 sync_prefs.SetStartSuppressed(true); | 880 sync_prefs.SetStartSuppressed(true); |
| 879 #endif | 881 #endif |
| 880 } | 882 } |
| 881 } | 883 } |
| 882 | 884 |
| 883 // Reset the attempted email address and error, otherwise the sync setup | 885 // Reset the attempted email address and error, otherwise the sync setup |
| 884 // overlay in the settings page will stay in whatever error state it was last | 886 // overlay in the settings page will stay in whatever error state it was last |
| 885 // when it is reopened. | 887 // when it is reopened. |
| 886 last_attempted_user_email_.clear(); | 888 last_attempted_user_email_.clear(); |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1019 if (i != current_profile_index && AreUserNamesEqual( | 1021 if (i != current_profile_index && AreUserNamesEqual( |
| 1020 cache.GetUserNameOfProfileAtIndex(i), username_utf16)) { | 1022 cache.GetUserNameOfProfileAtIndex(i), username_utf16)) { |
| 1021 *error_message = l10n_util::GetStringUTF16( | 1023 *error_message = l10n_util::GetStringUTF16( |
| 1022 IDS_SYNC_USER_NAME_IN_USE_ERROR); | 1024 IDS_SYNC_USER_NAME_IN_USE_ERROR); |
| 1023 return false; | 1025 return false; |
| 1024 } | 1026 } |
| 1025 } | 1027 } |
| 1026 | 1028 |
| 1027 return true; | 1029 return true; |
| 1028 } | 1030 } |
| OLD | NEW |