Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(9)

Side by Side Diff: chrome/browser/sync/profile_sync_service.cc

Issue 12077030: Allow signin to continue even if sync is disabled by policy. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix windows sync integration test failure Created 7 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 613 matching lines...) Expand 10 before | Expand all | Expand 10 after
624 } 624 }
625 } 625 }
626 626
627 void ProfileSyncService::DisableForUser() { 627 void ProfileSyncService::DisableForUser() {
628 // Clear prefs (including SyncSetupHasCompleted) before shutting down so 628 // Clear prefs (including SyncSetupHasCompleted) before shutting down so
629 // PSS clients don't think we're set up while we're shutting down. 629 // PSS clients don't think we're set up while we're shutting down.
630 sync_prefs_.ClearPreferences(); 630 sync_prefs_.ClearPreferences();
631 invalidator_storage_.Clear(); 631 invalidator_storage_.Clear();
632 ClearUnrecoverableError(); 632 ClearUnrecoverableError();
633 ShutdownImpl(true); 633 ShutdownImpl(true);
634
635 // TODO(atwilson): Don't call SignOut() on *any* platform - move this into
636 // the UI layer if needed (sync activity should never result in the user
637 // being logged out of all chrome services).
638 if (!auto_start_enabled_ && !signin_->GetAuthenticatedUsername().empty())
639 signin_->SignOut();
640
641 NotifyObservers(); 634 NotifyObservers();
642 } 635 }
643 636
644 bool ProfileSyncService::HasSyncSetupCompleted() const { 637 bool ProfileSyncService::HasSyncSetupCompleted() const {
645 return sync_prefs_.HasSyncSetupCompleted(); 638 return sync_prefs_.HasSyncSetupCompleted();
646 } 639 }
647 640
648 void ProfileSyncService::SetSyncSetupCompleted() { 641 void ProfileSyncService::SetSyncSetupCompleted() {
649 sync_prefs_.SetSyncSetupCompleted(); 642 sync_prefs_.SetSyncSetupCompleted();
650 } 643 }
(...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after
937 true); 930 true);
938 } 931 }
939 932
940 current_experiments_ = experiments; 933 current_experiments_ = experiments;
941 } 934 }
942 935
943 void ProfileSyncService::UpdateAuthErrorState(const AuthError& error) { 936 void ProfileSyncService::UpdateAuthErrorState(const AuthError& error) {
944 is_auth_in_progress_ = false; 937 is_auth_in_progress_ = false;
945 last_auth_error_ = error; 938 last_auth_error_ = error;
946 939
947 // Fan the notification out to interested UI-thread components. 940 // Fan the notification out to interested UI-thread components. Notify the
948 NotifyObservers(); 941 // SigninGlobalError first so it reflects the latest auth state before we
942 // notify observers.
949 if (signin()) 943 if (signin())
950 signin()->signin_global_error()->AuthStatusChanged(); 944 signin()->signin_global_error()->AuthStatusChanged();
945 NotifyObservers();
951 } 946 }
952 947
953 namespace { 948 namespace {
954 949
955 AuthError ConnectionStatusToAuthError( 950 AuthError ConnectionStatusToAuthError(
956 syncer::ConnectionStatus status) { 951 syncer::ConnectionStatus status) {
957 switch (status) { 952 switch (status) {
958 case syncer::CONNECTION_OK: 953 case syncer::CONNECTION_OK:
959 return AuthError::None(); 954 return AuthError::None();
960 break; 955 break;
(...skipping 1005 matching lines...) Expand 10 before | Expand all | Expand 10 after
1966 // See http://stackoverflow.com/questions/6224121/is-new-this-myclass-undefine d-behaviour-after-directly-calling-the-destru. 1961 // See http://stackoverflow.com/questions/6224121/is-new-this-myclass-undefine d-behaviour-after-directly-calling-the-destru.
1967 ProfileSyncService* old_this = this; 1962 ProfileSyncService* old_this = this;
1968 this->~ProfileSyncService(); 1963 this->~ProfileSyncService();
1969 new(old_this) ProfileSyncService( 1964 new(old_this) ProfileSyncService(
1970 new ProfileSyncComponentsFactoryImpl(profile, 1965 new ProfileSyncComponentsFactoryImpl(profile,
1971 CommandLine::ForCurrentProcess()), 1966 CommandLine::ForCurrentProcess()),
1972 profile, 1967 profile,
1973 signin, 1968 signin,
1974 behavior); 1969 behavior);
1975 } 1970 }
OLDNEW
« no previous file with comments | « chrome/browser/sync/profile_sync_service.h ('k') | chrome/browser/sync/profile_sync_service_factory.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698