| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/settings/people_handler.h" | 5 #include "chrome/browser/ui/webui/settings/people_handler.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
| (...skipping 544 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 555 backend_start_timer_.reset(); | 555 backend_start_timer_.reset(); |
| 556 | 556 |
| 557 // Clear the sync startup tracker, since the setup wizard is being closed. | 557 // Clear the sync startup tracker, since the setup wizard is being closed. |
| 558 sync_startup_tracker_.reset(); | 558 sync_startup_tracker_.reset(); |
| 559 | 559 |
| 560 ProfileSyncService* sync_service = GetSyncService(); | 560 ProfileSyncService* sync_service = GetSyncService(); |
| 561 | 561 |
| 562 // LoginUIService can be nullptr if page is brought up in incognito mode | 562 // LoginUIService can be nullptr if page is brought up in incognito mode |
| 563 // (i.e. if the user is running in guest mode in cros and brings up settings). | 563 // (i.e. if the user is running in guest mode in cros and brings up settings). |
| 564 LoginUIService* service = GetLoginUIService(); | 564 LoginUIService* service = GetLoginUIService(); |
| 565 if (service && (service->current_login_ui() == this)) { | 565 if (service) { |
| 566 // Don't log a cancel event if the sync setup dialog is being | 566 // Don't log a cancel event if the sync setup dialog is being |
| 567 // automatically closed due to an auth error. | 567 // automatically closed due to an auth error. |
| 568 if (!sync_service || (!sync_service->IsFirstSetupComplete() && | 568 if ((service->current_login_ui() == this) && |
| 569 sync_service->GetAuthError().state() == | 569 (!sync_service || (!sync_service->IsFirstSetupComplete() && |
| 570 GoogleServiceAuthError::NONE)) { | 570 sync_service->GetAuthError().state() == |
| 571 GoogleServiceAuthError::NONE))) { |
| 571 if (configuring_sync_) { | 572 if (configuring_sync_) { |
| 572 ProfileSyncService::SyncEvent( | 573 ProfileSyncService::SyncEvent( |
| 573 ProfileSyncService::CANCEL_DURING_CONFIGURE); | 574 ProfileSyncService::CANCEL_DURING_CONFIGURE); |
| 574 | 575 |
| 575 // If the user clicked "Cancel" while setting up sync, disable sync | 576 // If the user clicked "Cancel" while setting up sync, disable sync |
| 576 // because we don't want the sync backend to remain in the | 577 // because we don't want the sync backend to remain in the |
| 577 // first-setup-incomplete state. | 578 // first-setup-incomplete state. |
| 578 // Note: In order to disable sync across restarts on Chrome OS, | 579 // Note: In order to disable sync across restarts on Chrome OS, |
| 579 // we must call RequestStop(CLEAR_DATA), which suppresses sync startup | 580 // we must call RequestStop(CLEAR_DATA), which suppresses sync startup |
| 580 // in addition to disabling it. | 581 // in addition to disabling it. |
| 581 if (sync_service) { | 582 if (sync_service) { |
| 582 DVLOG(1) << "Sync setup aborted by user action"; | 583 DVLOG(1) << "Sync setup aborted by user action"; |
| 583 sync_service->RequestStop(ProfileSyncService::CLEAR_DATA); | 584 sync_service->RequestStop(ProfileSyncService::CLEAR_DATA); |
| 584 #if !defined(OS_CHROMEOS) | 585 #if !defined(OS_CHROMEOS) |
| 585 // Sign out the user on desktop Chrome if they click cancel during | 586 // Sign out the user on desktop Chrome if they click cancel during |
| 586 // initial setup. | 587 // initial setup. |
| 587 // TODO(rsimha): Revisit this for M30. See http://crbug.com/252049. | 588 // TODO(rsimha): Revisit this for M30. See http://crbug.com/252049. |
| 588 if (sync_service->IsFirstSetupInProgress()) { | 589 if (sync_service->IsFirstSetupInProgress()) { |
| 589 SigninManagerFactory::GetForProfile(profile_) | 590 SigninManagerFactory::GetForProfile(profile_) |
| 590 ->SignOut(signin_metrics::ABORT_SIGNIN, | 591 ->SignOut(signin_metrics::ABORT_SIGNIN, |
| 591 signin_metrics::SignoutDelete::IGNORE_METRIC); | 592 signin_metrics::SignoutDelete::IGNORE_METRIC); |
| 592 } | 593 } |
| 593 #endif | 594 #endif |
| 594 } | 595 } |
| 595 } | 596 } |
| 596 } | 597 } |
| 597 | 598 |
| 598 GetLoginUIService()->LoginUIClosed(this); | 599 service->LoginUIClosed(this); |
| 599 } | 600 } |
| 600 | 601 |
| 601 // Alert the sync service anytime the sync setup dialog is closed. This can | 602 // Alert the sync service anytime the sync setup dialog is closed. This can |
| 602 // happen due to the user clicking the OK or Cancel button, or due to the | 603 // happen due to the user clicking the OK or Cancel button, or due to the |
| 603 // dialog being closed by virtue of sync being disabled in the background. | 604 // dialog being closed by virtue of sync being disabled in the background. |
| 604 sync_blocker_.reset(); | 605 sync_blocker_.reset(); |
| 605 | 606 |
| 606 configuring_sync_ = false; | 607 configuring_sync_ = false; |
| 607 } | 608 } |
| 608 | 609 |
| (...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 893 base::FilePath profile_file_path = profile_->GetPath(); | 894 base::FilePath profile_file_path = profile_->GetPath(); |
| 894 ProfileMetrics::LogProfileSyncSignIn(profile_file_path); | 895 ProfileMetrics::LogProfileSyncSignIn(profile_file_path); |
| 895 | 896 |
| 896 // We're done configuring, so notify ProfileSyncService that it is OK to | 897 // We're done configuring, so notify ProfileSyncService that it is OK to |
| 897 // start syncing. | 898 // start syncing. |
| 898 sync_blocker_.reset(); | 899 sync_blocker_.reset(); |
| 899 service->SetFirstSetupComplete(); | 900 service->SetFirstSetupComplete(); |
| 900 } | 901 } |
| 901 | 902 |
| 902 } // namespace settings | 903 } // namespace settings |
| OLD | NEW |