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

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

Issue 10451058: sync: move invalidation version prefs out of SyncPrefs into InvalidatorStorage. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: review Created 8 years, 6 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_prefs.h » ('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 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 ProfileSyncService::ProfileSyncService(ProfileSyncComponentsFactory* factory, 110 ProfileSyncService::ProfileSyncService(ProfileSyncComponentsFactory* factory,
111 Profile* profile, 111 Profile* profile,
112 SigninManager* signin_manager, 112 SigninManager* signin_manager,
113 StartBehavior start_behavior) 113 StartBehavior start_behavior)
114 : last_auth_error_(AuthError::None()), 114 : last_auth_error_(AuthError::None()),
115 passphrase_required_reason_(sync_api::REASON_PASSPHRASE_NOT_REQUIRED), 115 passphrase_required_reason_(sync_api::REASON_PASSPHRASE_NOT_REQUIRED),
116 factory_(factory), 116 factory_(factory),
117 profile_(profile), 117 profile_(profile),
118 // |profile| may be NULL in unit tests. 118 // |profile| may be NULL in unit tests.
119 sync_prefs_(profile_ ? profile_->GetPrefs() : NULL), 119 sync_prefs_(profile_ ? profile_->GetPrefs() : NULL),
120 invalidator_storage_(profile_ ? profile_->GetPrefs(): NULL),
120 sync_service_url_(kDevServerUrl), 121 sync_service_url_(kDevServerUrl),
121 backend_initialized_(false), 122 backend_initialized_(false),
122 is_auth_in_progress_(false), 123 is_auth_in_progress_(false),
123 signin_(signin_manager), 124 signin_(signin_manager),
124 unrecoverable_error_detected_(false), 125 unrecoverable_error_detected_(false),
125 weak_factory_(ALLOW_THIS_IN_INITIALIZER_LIST(this)), 126 weak_factory_(ALLOW_THIS_IN_INITIALIZER_LIST(this)),
126 expect_sync_configuration_aborted_(false), 127 expect_sync_configuration_aborted_(false),
127 clear_server_data_state_(CLEAR_NOT_STARTED), 128 clear_server_data_state_(CLEAR_NOT_STARTED),
128 encrypted_types_(browser_sync::Cryptographer::SensitiveTypes()), 129 encrypted_types_(browser_sync::Cryptographer::SensitiveTypes()),
129 encrypt_everything_(false), 130 encrypt_everything_(false),
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after
353 initial_types, 354 initial_types,
354 credentials, 355 credentials,
355 delete_stale_data, 356 delete_stale_data,
356 backend_unrecoverable_error_handler_.get(), 357 backend_unrecoverable_error_handler_.get(),
357 &browser_sync::ChromeReportUnrecoverableError); 358 &browser_sync::ChromeReportUnrecoverableError);
358 } 359 }
359 360
360 void ProfileSyncService::CreateBackend() { 361 void ProfileSyncService::CreateBackend() {
361 backend_.reset( 362 backend_.reset(
362 new SyncBackendHost(profile_->GetDebugName(), 363 new SyncBackendHost(profile_->GetDebugName(),
363 profile_, sync_prefs_.AsWeakPtr())); 364 profile_, sync_prefs_.AsWeakPtr(),
365 invalidator_storage_.AsWeakPtr()));
364 } 366 }
365 367
366 bool ProfileSyncService::IsEncryptedDatatypeEnabled() const { 368 bool ProfileSyncService::IsEncryptedDatatypeEnabled() const {
367 if (encryption_pending()) 369 if (encryption_pending())
368 return true; 370 return true;
369 const syncable::ModelTypeSet preferred_types = GetPreferredDataTypes(); 371 const syncable::ModelTypeSet preferred_types = GetPreferredDataTypes();
370 const syncable::ModelTypeSet encrypted_types = GetEncryptedDataTypes(); 372 const syncable::ModelTypeSet encrypted_types = GetEncryptedDataTypes();
371 DCHECK(encrypted_types.Has(syncable::PASSWORDS)); 373 DCHECK(encrypted_types.Has(syncable::PASSWORDS));
372 return !Intersection(preferred_types, encrypted_types).Empty(); 374 return !Intersection(preferred_types, encrypted_types).Empty();
373 } 375 }
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
516 clear_server_data_timer_.Start(FROM_HERE, 518 clear_server_data_timer_.Start(FROM_HERE,
517 base::TimeDelta::FromSeconds(kSyncClearDataTimeoutInSeconds), this, 519 base::TimeDelta::FromSeconds(kSyncClearDataTimeoutInSeconds), this,
518 &ProfileSyncService::OnClearServerDataTimeout); 520 &ProfileSyncService::OnClearServerDataTimeout);
519 backend_->RequestClearServerData(); 521 backend_->RequestClearServerData();
520 } 522 }
521 523
522 void ProfileSyncService::DisableForUser() { 524 void ProfileSyncService::DisableForUser() {
523 // Clear prefs (including SyncSetupHasCompleted) before shutting down so 525 // Clear prefs (including SyncSetupHasCompleted) before shutting down so
524 // PSS clients don't think we're set up while we're shutting down. 526 // PSS clients don't think we're set up while we're shutting down.
525 sync_prefs_.ClearPreferences(); 527 sync_prefs_.ClearPreferences();
528 invalidator_storage_.Clear();
526 ClearUnrecoverableError(); 529 ClearUnrecoverableError();
527 ShutdownImpl(true); 530 ShutdownImpl(true);
528 531
529 // TODO(atwilson): Don't call SignOut() on *any* platform - move this into 532 // TODO(atwilson): Don't call SignOut() on *any* platform - move this into
530 // the UI layer if needed (sync activity should never result in the user 533 // the UI layer if needed (sync activity should never result in the user
531 // being logged out of all chrome services). 534 // being logged out of all chrome services).
532 if (!auto_start_enabled_) 535 if (!auto_start_enabled_)
533 signin_->SignOut(); 536 signin_->SignOut();
534 537
535 NotifyObservers(); 538 NotifyObservers();
(...skipping 1139 matching lines...) Expand 10 before | Expand all | Expand 10 after
1675 // See http://stackoverflow.com/questions/6224121/is-new-this-myclass-undefine d-behaviour-after-directly-calling-the-destru. 1678 // See http://stackoverflow.com/questions/6224121/is-new-this-myclass-undefine d-behaviour-after-directly-calling-the-destru.
1676 ProfileSyncService* old_this = this; 1679 ProfileSyncService* old_this = this;
1677 this->~ProfileSyncService(); 1680 this->~ProfileSyncService();
1678 new(old_this) ProfileSyncService( 1681 new(old_this) ProfileSyncService(
1679 new ProfileSyncComponentsFactoryImpl(profile, 1682 new ProfileSyncComponentsFactoryImpl(profile,
1680 CommandLine::ForCurrentProcess()), 1683 CommandLine::ForCurrentProcess()),
1681 profile, 1684 profile,
1682 signin, 1685 signin,
1683 behavior); 1686 behavior);
1684 } 1687 }
OLDNEW
« no previous file with comments | « chrome/browser/sync/profile_sync_service.h ('k') | chrome/browser/sync/sync_prefs.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698