Chromium Code Reviews| Index: chrome/browser/sync/profile_sync_service.cc |
| diff --git a/chrome/browser/sync/profile_sync_service.cc b/chrome/browser/sync/profile_sync_service.cc |
| index da473e4540cc2246f0b555ceeb573a97581237ae..08c4edd9e5774b5235f9e09acae42499fab4f074 100644 |
| --- a/chrome/browser/sync/profile_sync_service.cc |
| +++ b/chrome/browser/sync/profile_sync_service.cc |
| @@ -125,7 +125,8 @@ static bool IsTokenServiceRelevant(const std::string& service) { |
| bool ShouldShowActionOnUI( |
| const syncer::SyncProtocolError& error) { |
| return (error.action != syncer::UNKNOWN_ACTION && |
| - error.action != syncer::DISABLE_SYNC_ON_CLIENT); |
| + error.action != syncer::DISABLE_SYNC_ON_CLIENT && |
| + error.action != syncer::STOP_SYNC_FOR_DISABLED_ACCOUNT); |
| } |
| ProfileSyncService::ProfileSyncService(ProfileSyncComponentsFactory* factory, |
| @@ -674,6 +675,7 @@ void ProfileSyncService::ShutdownImpl(bool sync_disabled) { |
| weak_factory_.InvalidateWeakPtrs(); |
| // Clear various flags. |
| + start_up_time_ = base::Time(); |
| expect_sync_configuration_aborted_ = false; |
| is_auth_in_progress_ = false; |
| backend_initialized_ = false; |
| @@ -1167,6 +1169,12 @@ void ProfileSyncService::OnActionableError(const SyncProtocolError& error) { |
| case syncer::DISABLE_SYNC_ON_CLIENT: |
| OnStopSyncingPermanently(); |
| break; |
| + case syncer::STOP_SYNC_FOR_DISABLED_ACCOUNT: |
| + // Sync disabled by domain admin. we should stop syncing until |
| + // user signs out and signs in again. |
| + sync_prefs_.SetSyncDisabledByAdmin(true); |
| + DisableForUser(); |
| + break; |
| default: |
| NOTREACHED(); |
| } |
| @@ -1923,7 +1931,9 @@ void ProfileSyncService::Observe(int type, |
| break; |
| } |
| case chrome::NOTIFICATION_GOOGLE_SIGNED_OUT: |
| - // Disable sync if the user is signed out. |
| + // Disable sync if the user is signed out. Clear DisabledByAdmin flag so |
| + // when next time user signs in sync can try to connect to server again. |
| + sync_prefs_.SetSyncDisabledByAdmin(false); |
|
Andrew T Wilson (Slow)
2013/05/14 12:34:01
As I mentioned previously, on ChromeOS the user ne
|
| DisableForUser(); |
| break; |
| default: { |
| @@ -1960,7 +1970,7 @@ bool ProfileSyncService::IsSyncEnabled() { |
| } |
| bool ProfileSyncService::IsManaged() const { |
| - return sync_prefs_.IsManaged(); |
| + return sync_prefs_.IsManaged() || sync_prefs_.IsSyncDisabledByAdmin(); |
| } |
| bool ProfileSyncService::ShouldPushChanges() { |