| 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/sync/profile_sync_service.h" | 5 #include "chrome/browser/sync/profile_sync_service.h" |
| 6 | 6 |
| 7 #include <cstddef> | 7 #include <cstddef> |
| 8 #include <map> | 8 #include <map> |
| 9 #include <set> | 9 #include <set> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 955 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 966 break; | 966 break; |
| 967 case browser_sync::DISABLE_SYNC_ON_CLIENT: | 967 case browser_sync::DISABLE_SYNC_ON_CLIENT: |
| 968 OnStopSyncingPermanently(); | 968 OnStopSyncingPermanently(); |
| 969 break; | 969 break; |
| 970 default: | 970 default: |
| 971 NOTREACHED(); | 971 NOTREACHED(); |
| 972 } | 972 } |
| 973 NotifyObservers(); | 973 NotifyObservers(); |
| 974 } | 974 } |
| 975 | 975 |
| 976 void ProfileSyncService::ShowLoginDialog() { | |
| 977 // TODO(atwilson): Remove this API and have the callers directly call | |
| 978 // LoginUIService. | |
| 979 LoginUIServiceFactory::GetForProfile(profile_)->ShowLoginUI(); | |
| 980 } | |
| 981 | |
| 982 void ProfileSyncService::ShowErrorUI() { | 976 void ProfileSyncService::ShowErrorUI() { |
| 983 if (WizardIsVisible()) { | 977 if (WizardIsVisible()) { |
| 984 wizard_.Focus(); | 978 wizard_.Focus(); |
| 985 return; | 979 return; |
| 986 } | 980 } |
| 987 | 981 |
| 988 // Figure out what kind of error we've encountered. There are only 3 kinds: | 982 // Figure out what kind of error we've encountered. There are only 3 kinds: |
| 989 // 1) auth error. | 983 // 1) auth error. |
| 990 // 2) server-initiated error | 984 // 2) server-initiated error |
| 991 // 3) passphrase error | 985 // 3) passphrase error |
| 992 // Any other errors (such as unrecoverable error) should be handled by the UI | 986 // Any other errors (such as unrecoverable error) should be handled by the UI |
| 993 // itself and should not result in a call to ShowErrorUI. | 987 // itself and should not result in a call to ShowErrorUI. |
| 994 if (last_auth_error_.state() != AuthError::NONE) { | 988 if (last_auth_error_.state() != AuthError::NONE) { |
| 995 ShowLoginDialog(); | 989 LoginUIServiceFactory::GetForProfile(profile_)->ShowLoginUI(); |
| 996 } else if (ShouldShowActionOnUI(last_actionable_error_)) { | 990 } else if (ShouldShowActionOnUI(last_actionable_error_)) { |
| 997 ShowSyncSetup(chrome::kPersonalOptionsSubPage); | 991 ShowSyncSetup(chrome::kPersonalOptionsSubPage); |
| 998 } else { | 992 } else { |
| 999 // We should only get here for passphrase error. | 993 // We should only get here for passphrase error. |
| 1000 DCHECK(IsPassphraseRequired()); | 994 DCHECK(IsPassphraseRequired()); |
| 1001 ShowSyncSetupWithWizard(SyncSetupWizard::ENTER_PASSPHRASE); | 995 ShowSyncSetupWithWizard(SyncSetupWizard::ENTER_PASSPHRASE); |
| 1002 } | 996 } |
| 1003 } | 997 } |
| 1004 | 998 |
| 1005 void ProfileSyncService::ShowConfigure(bool sync_everything) { | 999 void ProfileSyncService::ShowConfigure(bool sync_everything) { |
| (...skipping 660 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1666 void* place = service; | 1660 void* place = service; |
| 1667 service->~ProfileSyncService(); | 1661 service->~ProfileSyncService(); |
| 1668 service = new(place) ProfileSyncService( | 1662 service = new(place) ProfileSyncService( |
| 1669 new ProfileSyncComponentsFactoryImpl(profile, | 1663 new ProfileSyncComponentsFactoryImpl(profile, |
| 1670 CommandLine::ForCurrentProcess()), | 1664 CommandLine::ForCurrentProcess()), |
| 1671 profile, | 1665 profile, |
| 1672 signin, | 1666 signin, |
| 1673 behavior); | 1667 behavior); |
| 1674 DCHECK(service) << "Could not create new ProfileSyncService."; | 1668 DCHECK(service) << "Could not create new ProfileSyncService."; |
| 1675 } | 1669 } |
| OLD | NEW |