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 820 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
831 const std::string& access_code) { | 831 const std::string& access_code) { |
832 DCHECK(IsActiveLogin()); | 832 DCHECK(IsActiveLogin()); |
833 // Make sure we are listening for signin traffic. | 833 // Make sure we are listening for signin traffic. |
834 if (!signin_tracker_.get()) | 834 if (!signin_tracker_.get()) |
835 signin_tracker_.reset(new SigninTracker(GetProfile(), this)); | 835 signin_tracker_.reset(new SigninTracker(GetProfile(), this)); |
836 | 836 |
837 last_attempted_user_email_ = username; | 837 last_attempted_user_email_ = username; |
838 | 838 |
839 // User is trying to log in again so reset the cached error. | 839 // User is trying to log in again so reset the cached error. |
840 GoogleServiceAuthError current_error = last_signin_error_; | 840 GoogleServiceAuthError current_error = last_signin_error_; |
841 last_signin_error_ = GoogleServiceAuthError::None(); | 841 last_signin_error_ = GoogleServiceAuthError::AuthErrorNone(); |
842 | 842 |
843 SigninManager* signin = GetSignin(); | 843 SigninManager* signin = GetSignin(); |
844 | 844 |
845 // If we're just being called to provide an ASP, then pass it to the | 845 // If we're just being called to provide an ASP, then pass it to the |
846 // SigninManager and wait for the next step. | 846 // SigninManager and wait for the next step. |
847 if (!access_code.empty()) { | 847 if (!access_code.empty()) { |
848 signin->ProvideSecondFactorAccessCode(access_code); | 848 signin->ProvideSecondFactorAccessCode(access_code); |
849 return; | 849 return; |
850 } | 850 } |
851 | 851 |
(...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1124 browser_sync::SyncPrefs sync_prefs(GetProfile()->GetPrefs()); | 1124 browser_sync::SyncPrefs sync_prefs(GetProfile()->GetPrefs()); |
1125 sync_prefs.SetStartSuppressed(true); | 1125 sync_prefs.SetStartSuppressed(true); |
1126 } | 1126 } |
1127 sync_service->SetSetupInProgress(false); | 1127 sync_service->SetSetupInProgress(false); |
1128 } | 1128 } |
1129 | 1129 |
1130 // Reset the attempted email address and error, otherwise the sync setup | 1130 // Reset the attempted email address and error, otherwise the sync setup |
1131 // overlay in the settings page will stay in whatever error state it was last | 1131 // overlay in the settings page will stay in whatever error state it was last |
1132 // when it is reopened. | 1132 // when it is reopened. |
1133 last_attempted_user_email_.clear(); | 1133 last_attempted_user_email_.clear(); |
1134 last_signin_error_ = GoogleServiceAuthError::None(); | 1134 last_signin_error_ = GoogleServiceAuthError::AuthErrorNone(); |
1135 | 1135 |
1136 configuring_sync_ = false; | 1136 configuring_sync_ = false; |
1137 signin_tracker_.reset(); | 1137 signin_tracker_.reset(); |
1138 | 1138 |
1139 // Stop a timer to handle timeout in waiting for checking network connection. | 1139 // Stop a timer to handle timeout in waiting for checking network connection. |
1140 backend_start_timer_.reset(); | 1140 backend_start_timer_.reset(); |
1141 } | 1141 } |
1142 | 1142 |
1143 void SyncSetupHandler::OpenSyncSetup(bool force_login) { | 1143 void SyncSetupHandler::OpenSyncSetup(bool force_login) { |
1144 if (!PrepareSyncSetup()) | 1144 if (!PrepareSyncSetup()) |
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1320 if (i != current_profile_index && AreUserNamesEqual( | 1320 if (i != current_profile_index && AreUserNamesEqual( |
1321 cache.GetUserNameOfProfileAtIndex(i), username_utf16)) { | 1321 cache.GetUserNameOfProfileAtIndex(i), username_utf16)) { |
1322 *error_message = l10n_util::GetStringUTF16( | 1322 *error_message = l10n_util::GetStringUTF16( |
1323 IDS_SYNC_USER_NAME_IN_USE_ERROR); | 1323 IDS_SYNC_USER_NAME_IN_USE_ERROR); |
1324 return false; | 1324 return false; |
1325 } | 1325 } |
1326 } | 1326 } |
1327 | 1327 |
1328 return true; | 1328 return true; |
1329 } | 1329 } |
OLD | NEW |