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

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

Issue 14691004: [sync] Separate sign in from sync on Desktop Chrome (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 7 years, 7 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
« no previous file with comments | « chrome/browser/sync/profile_sync_service.h ('k') | chrome/browser/sync/sync_ui_util.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 718 matching lines...) Expand 10 before | Expand all | Expand 10 after
729 is_auth_in_progress_ = false; 729 is_auth_in_progress_ = false;
730 backend_initialized_ = false; 730 backend_initialized_ = false;
731 // NULL if we're called from Shutdown(). 731 // NULL if we're called from Shutdown().
732 if (invalidator_registrar_) 732 if (invalidator_registrar_)
733 UpdateInvalidatorRegistrarState(); 733 UpdateInvalidatorRegistrarState();
734 cached_passphrase_.clear(); 734 cached_passphrase_.clear();
735 encryption_pending_ = false; 735 encryption_pending_ = false;
736 encrypt_everything_ = false; 736 encrypt_everything_ = false;
737 encrypted_types_ = syncer::SyncEncryptionHandler::SensitiveTypes(); 737 encrypted_types_ = syncer::SyncEncryptionHandler::SensitiveTypes();
738 passphrase_required_reason_ = syncer::REASON_PASSPHRASE_NOT_REQUIRED; 738 passphrase_required_reason_ = syncer::REASON_PASSPHRASE_NOT_REQUIRED;
739 start_up_time_ = base::Time();
739 // Revert to "no auth error". 740 // Revert to "no auth error".
740 if (last_auth_error_.state() != GoogleServiceAuthError::NONE) 741 if (last_auth_error_.state() != GoogleServiceAuthError::NONE)
741 UpdateAuthErrorState(GoogleServiceAuthError::AuthErrorNone()); 742 UpdateAuthErrorState(GoogleServiceAuthError::AuthErrorNone());
742 743
743 if (sync_global_error_) { 744 if (sync_global_error_) {
744 GlobalErrorServiceFactory::GetForProfile(profile_)->RemoveGlobalError( 745 GlobalErrorServiceFactory::GetForProfile(profile_)->RemoveGlobalError(
745 sync_global_error_.get()); 746 sync_global_error_.get());
746 RemoveObserver(sync_global_error_.get()); 747 RemoveObserver(sync_global_error_.get());
747 sync_global_error_.reset(NULL); 748 sync_global_error_.reset(NULL);
748 } 749 }
(...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after
1082 1083
1083 void ProfileSyncService::OnConnectionStatusChange( 1084 void ProfileSyncService::OnConnectionStatusChange(
1084 syncer::ConnectionStatus status) { 1085 syncer::ConnectionStatus status) {
1085 const GoogleServiceAuthError auth_error = 1086 const GoogleServiceAuthError auth_error =
1086 ConnectionStatusToAuthError(status); 1087 ConnectionStatusToAuthError(status);
1087 DVLOG(1) << "Connection status change: " << auth_error.ToString(); 1088 DVLOG(1) << "Connection status change: " << auth_error.ToString();
1088 UpdateAuthErrorState(auth_error); 1089 UpdateAuthErrorState(auth_error);
1089 } 1090 }
1090 1091
1091 void ProfileSyncService::OnStopSyncingPermanently() { 1092 void ProfileSyncService::OnStopSyncingPermanently() {
1092 UpdateAuthErrorState(AuthError(AuthError::SERVICE_UNAVAILABLE));
1093 sync_prefs_.SetStartSuppressed(true); 1093 sync_prefs_.SetStartSuppressed(true);
1094 DisableForUser(); 1094 DisableForUser();
1095
1096 // Signout doesn't exist as a concept on Chrome OS. It currently does
1097 // on other auto-start platforms (like Android, though we should probably
1098 // use SigninManagerBase there as well), but we don't want to sign the
1099 // user out on auto-start platforms if sync was disabled.
1100 // TODO(tim): Platform specific refactoring here is bug 237866.
1101 #if !defined(OS_CHROMEOS)
1102 SigninManager* signin = SigninManagerFactory::GetForProfile(profile_);
1103
1104 if (!auto_start_enabled_) // Skip signout on ChromeOS/Android.
1105 signin->SignOut();
1106 #endif
1107 } 1095 }
1108 1096
1109 void ProfileSyncService::OnPassphraseRequired( 1097 void ProfileSyncService::OnPassphraseRequired(
1110 syncer::PassphraseRequiredReason reason, 1098 syncer::PassphraseRequiredReason reason,
1111 const sync_pb::EncryptedData& pending_keys) { 1099 const sync_pb::EncryptedData& pending_keys) {
1112 DCHECK(backend_.get()); 1100 DCHECK(backend_.get());
1113 DCHECK(backend_->IsNigoriEnabled()); 1101 DCHECK(backend_->IsNigoriEnabled());
1114 1102
1115 // TODO(lipalani) : add this check to other locations as well. 1103 // TODO(lipalani) : add this check to other locations as well.
1116 if (HasUnrecoverableError()) { 1104 if (HasUnrecoverableError()) {
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
1221 expect_sync_configuration_aborted_ = true; 1209 expect_sync_configuration_aborted_ = true;
1222 } 1210 }
1223 // Trigger an unrecoverable error to stop syncing. 1211 // Trigger an unrecoverable error to stop syncing.
1224 OnInternalUnrecoverableError(FROM_HERE, 1212 OnInternalUnrecoverableError(FROM_HERE,
1225 last_actionable_error_.error_description, 1213 last_actionable_error_.error_description,
1226 true, 1214 true,
1227 ERROR_REASON_ACTIONABLE_ERROR); 1215 ERROR_REASON_ACTIONABLE_ERROR);
1228 break; 1216 break;
1229 case syncer::DISABLE_SYNC_ON_CLIENT: 1217 case syncer::DISABLE_SYNC_ON_CLIENT:
1230 OnStopSyncingPermanently(); 1218 OnStopSyncingPermanently();
1219 // TODO(rsimha): Re-evaluate whether to also sign out the user here after
1220 // a dashboard clear. See http://crbug.com/240436.
1231 break; 1221 break;
1232 default: 1222 default:
1233 NOTREACHED(); 1223 NOTREACHED();
1234 } 1224 }
1235 NotifyObservers(); 1225 NotifyObservers();
1236 } 1226 }
1237 1227
1238 void ProfileSyncService::OnConfigureBlocked() { 1228 void ProfileSyncService::OnConfigureBlocked() {
1239 NotifyObservers(); 1229 NotifyObservers();
1240 } 1230 }
(...skipping 879 matching lines...) Expand 10 before | Expand all | Expand 10 after
2120 // See http://stackoverflow.com/questions/6224121/is-new-this-myclass-undefine d-behaviour-after-directly-calling-the-destru. 2110 // See http://stackoverflow.com/questions/6224121/is-new-this-myclass-undefine d-behaviour-after-directly-calling-the-destru.
2121 ProfileSyncService* old_this = this; 2111 ProfileSyncService* old_this = this;
2122 this->~ProfileSyncService(); 2112 this->~ProfileSyncService();
2123 new(old_this) ProfileSyncService( 2113 new(old_this) ProfileSyncService(
2124 new ProfileSyncComponentsFactoryImpl(profile, 2114 new ProfileSyncComponentsFactoryImpl(profile,
2125 CommandLine::ForCurrentProcess()), 2115 CommandLine::ForCurrentProcess()),
2126 profile, 2116 profile,
2127 signin, 2117 signin,
2128 behavior); 2118 behavior);
2129 } 2119 }
OLDNEW
« no previous file with comments | « chrome/browser/sync/profile_sync_service.h ('k') | chrome/browser/sync/sync_ui_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698