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 1150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1161 } | 1161 } |
1162 | 1162 |
1163 // If the user clicked "Cancel" while setting up sync, disable sync | 1163 // If the user clicked "Cancel" while setting up sync, disable sync |
1164 // because we don't want the sync backend to remain in the initialized | 1164 // because we don't want the sync backend to remain in the initialized |
1165 // state. Note: In order to disable sync across restarts on Chrome OS, we | 1165 // state. Note: In order to disable sync across restarts on Chrome OS, we |
1166 // must call OnStopSyncingPermanently(), which suppresses sync startup in | 1166 // must call OnStopSyncingPermanently(), which suppresses sync startup in |
1167 // addition to disabling it. | 1167 // addition to disabling it. |
1168 if (sync_service) { | 1168 if (sync_service) { |
1169 DVLOG(1) << "Sync setup aborted by user action"; | 1169 DVLOG(1) << "Sync setup aborted by user action"; |
1170 sync_service->OnStopSyncingPermanently(); | 1170 sync_service->OnStopSyncingPermanently(); |
1171 sync_service->SetSetupInProgress(false); | |
1172 } | 1171 } |
1173 } | 1172 } |
1174 | 1173 |
1175 #if !defined(OS_CHROMEOS) | 1174 #if !defined(OS_CHROMEOS) |
1176 // Let the various services know that we're no longer active. | 1175 // Let the various services know that we're no longer active. |
1177 if (SyncPromoUI::UseWebBasedSigninFlow()) | 1176 if (SyncPromoUI::UseWebBasedSigninFlow()) |
1178 CloseGaiaSigninPage(); | 1177 CloseGaiaSigninPage(); |
1179 #endif | 1178 #endif |
1180 | 1179 |
1181 GetLoginUIService()->LoginUIClosed(this); | 1180 GetLoginUIService()->LoginUIClosed(this); |
1182 } | 1181 } |
1183 | 1182 |
| 1183 // Alert the sync service anytime the sync setup dialog is closed. This can |
| 1184 // happen due to the user clicking the OK or Cancel button, or due to the |
| 1185 // dialog being closed by virtue of sync being disabled in the background. |
| 1186 if (sync_service) |
| 1187 sync_service->SetSetupInProgress(false); |
| 1188 |
1184 #if !defined(OS_CHROMEOS) | 1189 #if !defined(OS_CHROMEOS) |
1185 // Reset the attempted email address and error, otherwise the sync setup | 1190 // Reset the attempted email address and error, otherwise the sync setup |
1186 // overlay in the settings page will stay in whatever error state it was last | 1191 // overlay in the settings page will stay in whatever error state it was last |
1187 // when it is reopened. | 1192 // when it is reopened. |
1188 last_attempted_user_email_.clear(); | 1193 last_attempted_user_email_.clear(); |
1189 last_signin_error_ = GoogleServiceAuthError::AuthErrorNone(); | 1194 last_signin_error_ = GoogleServiceAuthError::AuthErrorNone(); |
1190 #endif | 1195 #endif |
1191 | 1196 |
1192 configuring_sync_ = false; | 1197 configuring_sync_ = false; |
1193 signin_tracker_.reset(); | 1198 signin_tracker_.reset(); |
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1373 return LoginUIServiceFactory::GetForProfile(GetProfile()); | 1378 return LoginUIServiceFactory::GetForProfile(GetProfile()); |
1374 } | 1379 } |
1375 | 1380 |
1376 void SyncSetupHandler::CloseOverlay() { | 1381 void SyncSetupHandler::CloseOverlay() { |
1377 // Stop a timer to handle timeout in waiting for sync setup. | 1382 // Stop a timer to handle timeout in waiting for sync setup. |
1378 backend_start_timer_.reset(); | 1383 backend_start_timer_.reset(); |
1379 | 1384 |
1380 CloseSyncSetup(); | 1385 CloseSyncSetup(); |
1381 web_ui()->CallJavascriptFunction("OptionsPage.closeOverlay"); | 1386 web_ui()->CallJavascriptFunction("OptionsPage.closeOverlay"); |
1382 } | 1387 } |
OLD | NEW |