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 622 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
633 | 633 |
634 // If the sync engine has shutdown for some reason, just close the sync | 634 // If the sync engine has shutdown for some reason, just close the sync |
635 // dialog. | 635 // dialog. |
636 if (!service || !service->sync_initialized()) { | 636 if (!service || !service->sync_initialized()) { |
637 CloseUI(); | 637 CloseUI(); |
638 return; | 638 return; |
639 } | 639 } |
640 | 640 |
641 // Disable sync, but remain signed in if the user selected "Sync nothing" in | 641 // Disable sync, but remain signed in if the user selected "Sync nothing" in |
642 // the advanced settings dialog. Note: In order to disable sync across | 642 // the advanced settings dialog. Note: In order to disable sync across |
643 // restarts on Chrome OS, we must call OnStopSyncingPermanently(), which | 643 // restarts on Chrome OS, we must call StopSyncingPermanently(), which |
644 // suppresses sync startup in addition to disabling it. | 644 // suppresses sync startup in addition to disabling it. |
645 if (configuration.sync_nothing) { | 645 if (configuration.sync_nothing) { |
646 ProfileSyncService::SyncEvent( | 646 ProfileSyncService::SyncEvent( |
647 ProfileSyncService::STOP_FROM_ADVANCED_DIALOG); | 647 ProfileSyncService::STOP_FROM_ADVANCED_DIALOG); |
648 CloseUI(); | 648 CloseUI(); |
649 service->OnStopSyncingPermanently(); | 649 service->StopSyncingPermanently(); |
650 service->SetSetupInProgress(false); | 650 service->SetSetupInProgress(false); |
651 return; | 651 return; |
652 } | 652 } |
653 | 653 |
654 // Note: Data encryption will not occur until configuration is complete | 654 // Note: Data encryption will not occur until configuration is complete |
655 // (when the PSS receives its CONFIGURE_DONE notification from the sync | 655 // (when the PSS receives its CONFIGURE_DONE notification from the sync |
656 // backend), so the user still has a chance to cancel out of the operation | 656 // backend), so the user still has a chance to cancel out of the operation |
657 // if (for example) some kind of passphrase error is encountered. | 657 // if (for example) some kind of passphrase error is encountered. |
658 if (configuration.encrypt_all) | 658 if (configuration.encrypt_all) |
659 service->EnableEncryptEverything(); | 659 service->EnableEncryptEverything(); |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
799 if (!sync_service || (!sync_service->HasSyncSetupCompleted() && | 799 if (!sync_service || (!sync_service->HasSyncSetupCompleted() && |
800 sync_service->GetAuthError().state() == GoogleServiceAuthError::NONE)) { | 800 sync_service->GetAuthError().state() == GoogleServiceAuthError::NONE)) { |
801 if (configuring_sync_) { | 801 if (configuring_sync_) { |
802 ProfileSyncService::SyncEvent( | 802 ProfileSyncService::SyncEvent( |
803 ProfileSyncService::CANCEL_DURING_CONFIGURE); | 803 ProfileSyncService::CANCEL_DURING_CONFIGURE); |
804 } | 804 } |
805 | 805 |
806 // If the user clicked "Cancel" while setting up sync, disable sync | 806 // If the user clicked "Cancel" while setting up sync, disable sync |
807 // because we don't want the sync backend to remain in the initialized | 807 // because we don't want the sync backend to remain in the initialized |
808 // state. Note: In order to disable sync across restarts on Chrome OS, we | 808 // state. Note: In order to disable sync across restarts on Chrome OS, we |
809 // must call OnStopSyncingPermanently(), which suppresses sync startup in | 809 // must call StopSyncingPermanently(), which suppresses sync startup in |
810 // addition to disabling it. | 810 // addition to disabling it. |
811 if (sync_service) { | 811 if (sync_service) { |
812 DVLOG(1) << "Sync setup aborted by user action"; | 812 DVLOG(1) << "Sync setup aborted by user action"; |
813 sync_service->OnStopSyncingPermanently(); | 813 sync_service->StopSyncingPermanently(); |
814 #if !defined(OS_CHROMEOS) | 814 #if !defined(OS_CHROMEOS) |
815 // Sign out the user on desktop Chrome if they click cancel during | 815 // Sign out the user on desktop Chrome if they click cancel during |
816 // initial setup. | 816 // initial setup. |
817 // TODO(rsimha): Revisit this for M30. See http://crbug.com/252049. | 817 // TODO(rsimha): Revisit this for M30. See http://crbug.com/252049. |
818 if (sync_service->FirstSetupInProgress()) | 818 if (sync_service->FirstSetupInProgress()) |
819 SigninManagerFactory::GetForProfile(GetProfile())->SignOut(); | 819 SigninManagerFactory::GetForProfile(GetProfile())->SignOut(); |
820 #endif | 820 #endif |
821 } | 821 } |
822 } | 822 } |
823 | 823 |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
909 | 909 |
910 LoginUIService* service = GetLoginUIService(); | 910 LoginUIService* service = GetLoginUIService(); |
911 DCHECK(service); | 911 DCHECK(service); |
912 service->current_login_ui()->FocusUI(); | 912 service->current_login_ui()->FocusUI(); |
913 return true; | 913 return true; |
914 } | 914 } |
915 | 915 |
916 LoginUIService* SyncSetupHandler::GetLoginUIService() const { | 916 LoginUIService* SyncSetupHandler::GetLoginUIService() const { |
917 return LoginUIServiceFactory::GetForProfile(GetProfile()); | 917 return LoginUIServiceFactory::GetForProfile(GetProfile()); |
918 } | 918 } |
OLD | NEW |