| 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 375 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 386 bool passphrase_failed) { | 386 bool passphrase_failed) { |
| 387 ProfileSyncService* service = GetSyncService(); | 387 ProfileSyncService* service = GetSyncService(); |
| 388 if (!service->sync_initialized()) { | 388 if (!service->sync_initialized()) { |
| 389 // When user tries to setup sync while the sync backend is not initialized, | 389 // When user tries to setup sync while the sync backend is not initialized, |
| 390 // kick the sync backend and wait for it to be ready and show spinner until | 390 // kick the sync backend and wait for it to be ready and show spinner until |
| 391 // the backend gets ready. | 391 // the backend gets ready. |
| 392 retry_on_signin_failure_ = false; | 392 retry_on_signin_failure_ = false; |
| 393 | 393 |
| 394 service->UnsuppressAndStart(); | 394 service->UnsuppressAndStart(); |
| 395 DisplaySpinner(); | 395 DisplaySpinner(); |
| 396 |
| 396 // To listen to the token available notifications, start SigninTracker. | 397 // To listen to the token available notifications, start SigninTracker. |
| 397 signin_tracker_.reset(new SigninTracker(GetProfile(), this)); | 398 signin_tracker_.reset( |
| 399 new SigninTracker(GetProfile(), |
| 400 this, |
| 401 SigninTracker::SERVICES_INITIALIZING)); |
| 398 return; | 402 return; |
| 399 } | 403 } |
| 400 | 404 |
| 401 // Should only be called if user is signed in, so no longer need our | 405 // Should only be called if user is signed in, so no longer need our |
| 402 // SigninTracker. | 406 // SigninTracker. |
| 403 signin_tracker_.reset(); | 407 signin_tracker_.reset(); |
| 404 configuring_sync_ = true; | 408 configuring_sync_ = true; |
| 405 DCHECK(service->sync_initialized()) << | 409 DCHECK(service->sync_initialized()) << |
| 406 "Cannot configure sync until the sync backend is initialized"; | 410 "Cannot configure sync until the sync backend is initialized"; |
| 407 | 411 |
| (...skipping 810 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1218 if (i != current_profile_index && AreUserNamesEqual( | 1222 if (i != current_profile_index && AreUserNamesEqual( |
| 1219 cache.GetUserNameOfProfileAtIndex(i), username_utf16)) { | 1223 cache.GetUserNameOfProfileAtIndex(i), username_utf16)) { |
| 1220 *error_message = l10n_util::GetStringUTF16( | 1224 *error_message = l10n_util::GetStringUTF16( |
| 1221 IDS_SYNC_USER_NAME_IN_USE_ERROR); | 1225 IDS_SYNC_USER_NAME_IN_USE_ERROR); |
| 1222 return false; | 1226 return false; |
| 1223 } | 1227 } |
| 1224 } | 1228 } |
| 1225 | 1229 |
| 1226 return true; | 1230 return true; |
| 1227 } | 1231 } |
| OLD | NEW |