| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/sync/profile_sync_service.h" | 5 #include "chrome/browser/sync/profile_sync_service.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <map> | 8 #include <map> |
| 9 #include <ostream> | 9 #include <ostream> |
| 10 #include <set> | 10 #include <set> |
| (...skipping 802 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 813 wizard_.Step(SyncSetupWizard::GAIA_LOGIN); | 813 wizard_.Step(SyncSetupWizard::GAIA_LOGIN); |
| 814 return; | 814 return; |
| 815 } | 815 } |
| 816 | 816 |
| 817 if (!auth_error_time_.is_null()) { | 817 if (!auth_error_time_.is_null()) { |
| 818 UMA_HISTOGRAM_LONG_TIMES("Sync.ReauthorizationTime", | 818 UMA_HISTOGRAM_LONG_TIMES("Sync.ReauthorizationTime", |
| 819 base::TimeTicks::Now() - auth_error_time_); | 819 base::TimeTicks::Now() - auth_error_time_); |
| 820 auth_error_time_ = base::TimeTicks(); // Reset auth_error_time_ to null. | 820 auth_error_time_ = base::TimeTicks(); // Reset auth_error_time_ to null. |
| 821 } | 821 } |
| 822 | 822 |
| 823 ShowSyncSetup(SyncSetupWizard::GAIA_LOGIN); | 823 wizard_.ShowSyncSetup(SyncSetupWizard::GAIA_LOGIN); |
| 824 | 824 |
| 825 NotifyObservers(); | 825 NotifyObservers(); |
| 826 } | 826 } |
| 827 | 827 |
| 828 void ProfileSyncService::ShowErrorUI() { | 828 void ProfileSyncService::ShowErrorUI() { |
| 829 if (WizardIsVisible()) { | 829 wizard_.ShowSyncSetup(SyncSetupWizard::NONFATAL_ERROR); |
| 830 wizard_.Focus(); | |
| 831 return; | |
| 832 } | |
| 833 | |
| 834 ShowSyncSetup(SyncSetupWizard::NONFATAL_ERROR); | |
| 835 } | 830 } |
| 836 | 831 |
| 837 void ProfileSyncService::ShowConfigure(bool sync_everything) { | 832 void ProfileSyncService::ShowConfigure(bool sync_everything) { |
| 838 if (WizardIsVisible()) { | |
| 839 wizard_.Focus(); | |
| 840 return; | |
| 841 } | |
| 842 | |
| 843 if (sync_everything) | 833 if (sync_everything) |
| 844 ShowSyncSetup(SyncSetupWizard::SYNC_EVERYTHING); | 834 wizard_.ShowSyncSetup(SyncSetupWizard::SYNC_EVERYTHING); |
| 845 else | 835 else |
| 846 ShowSyncSetup(SyncSetupWizard::CONFIGURE); | 836 wizard_.ShowSyncSetup(SyncSetupWizard::CONFIGURE); |
| 847 } | 837 } |
| 848 | 838 |
| 849 void ProfileSyncService::PromptForExistingPassphrase() { | 839 void ProfileSyncService::PromptForExistingPassphrase() { |
| 850 if (WizardIsVisible()) { | 840 wizard_.ShowSyncSetup(SyncSetupWizard::ENTER_PASSPHRASE); |
| 851 wizard_.Focus(); | |
| 852 return; | |
| 853 } | |
| 854 | |
| 855 ShowSyncSetup(SyncSetupWizard::ENTER_PASSPHRASE); | |
| 856 } | |
| 857 | |
| 858 void ProfileSyncService::ShowSyncSetup(SyncSetupWizard::State state) { | |
| 859 wizard_.Step(state); | |
| 860 BrowserList::GetLastActiveWithProfile(profile())->ShowOptionsTab( | |
| 861 chrome::kSyncSetupSubPage); | |
| 862 } | 841 } |
| 863 | 842 |
| 864 SyncBackendHost::StatusSummary ProfileSyncService::QuerySyncStatusSummary() { | 843 SyncBackendHost::StatusSummary ProfileSyncService::QuerySyncStatusSummary() { |
| 865 if (backend_.get() && backend_initialized_) | 844 if (backend_.get() && backend_initialized_) |
| 866 return backend_->GetStatusSummary(); | 845 return backend_->GetStatusSummary(); |
| 867 else | 846 else |
| 868 return SyncBackendHost::Status::OFFLINE_UNUSABLE; | 847 return SyncBackendHost::Status::OFFLINE_UNUSABLE; |
| 869 } | 848 } |
| 870 | 849 |
| 871 SyncBackendHost::Status ProfileSyncService::QueryDetailedSyncStatus() { | 850 SyncBackendHost::Status ProfileSyncService::QueryDetailedSyncStatus() { |
| (...skipping 541 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1413 // is initialized, all enabled data types are consistent with one | 1392 // is initialized, all enabled data types are consistent with one |
| 1414 // another, and no unrecoverable error has transpired. | 1393 // another, and no unrecoverable error has transpired. |
| 1415 if (unrecoverable_error_detected_) | 1394 if (unrecoverable_error_detected_) |
| 1416 return false; | 1395 return false; |
| 1417 | 1396 |
| 1418 if (!data_type_manager_.get()) | 1397 if (!data_type_manager_.get()) |
| 1419 return false; | 1398 return false; |
| 1420 | 1399 |
| 1421 return data_type_manager_->state() == DataTypeManager::CONFIGURED; | 1400 return data_type_manager_->state() == DataTypeManager::CONFIGURED; |
| 1422 } | 1401 } |
| OLD | NEW |