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

Unified Diff: chrome/browser/sync/profile_sync_service.cc

Issue 6375007: [Sync] Refactored ProfileSyncService and remove its backend() function (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add comment Created 9 years, 11 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 side-by-side diff with in-line comments
Download patch
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 d031292bf282071751a9c027955f7b6ead203f3f..ac3682a706bdff726bbeac0ca42b9211c95094a2 100644
--- a/chrome/browser/sync/profile_sync_service.cc
+++ b/chrome/browser/sync/profile_sync_service.cc
@@ -414,7 +414,8 @@ void ProfileSyncService::InitializeBackend(bool delete_sync_data_folder) {
SyncCredentials credentials = GetCredentials();
- backend_->Initialize(sync_service_url_,
+ backend_->Initialize(this,
+ sync_service_url_,
types,
profile_->GetRequestContext(),
credentials,
@@ -423,7 +424,7 @@ void ProfileSyncService::InitializeBackend(bool delete_sync_data_folder) {
}
void ProfileSyncService::CreateBackend() {
- backend_.reset(new SyncBackendHost(this, profile_));
+ backend_.reset(new SyncBackendHost(profile_));
}
void ProfileSyncService::StartUp() {
@@ -1013,6 +1014,12 @@ bool ProfileSyncService::IsCryptographerReady() const {
return backend_.get() && backend_->IsCryptographerReady();
}
+SyncBackendHost* ProfileSyncService::GetBackendForTest() {
+ // We don't check |backend_initialized_|; we assume the test class
+ // knows what it's doing.
+ return backend_.get();
+}
+
void ProfileSyncService::ConfigureDataTypeManager() {
if (!data_type_manager_.get()) {
data_type_manager_.reset(
@@ -1031,6 +1038,78 @@ void ProfileSyncService::ConfigureDataTypeManager() {
data_type_manager_->Configure(types);
}
+sync_api::UserShare* ProfileSyncService::GetUserShare() const {
+ if (backend_.get() && backend_initialized_) {
+ return backend_->GetUserShare();
+ }
+ NOTREACHED();
+ return NULL;
+}
+
+const browser_sync::sessions::SyncSessionSnapshot*
+ ProfileSyncService::GetLastSessionSnapshot() const {
+ if (backend_.get() && backend_initialized_) {
+ return backend_->GetLastSessionSnapshot();
+ }
+ NOTREACHED();
+ return NULL;
+}
+
+bool ProfileSyncService::HasUnsyncedItems() const {
+ if (backend_.get() && backend_initialized_) {
+ return backend_->HasUnsyncedItems();
+ }
+ NOTREACHED();
+ return false;
+}
+
+void ProfileSyncService::GetModelSafeRoutingInfo(
+ browser_sync::ModelSafeRoutingInfo* out) {
+ if (backend_.get() && backend_initialized_) {
+ backend_->GetModelSafeRoutingInfo(out);
+ } else {
+ NOTREACHED();
+ }
+}
+
+syncable::AutofillMigrationState
+ ProfileSyncService::GetAutofillMigrationState() {
+ if (backend_.get() && backend_initialized_) {
+ return backend_->GetAutofillMigrationState();
+ }
+ NOTREACHED();
+ return syncable::NOT_DETERMINED;
+}
+
+void ProfileSyncService::SetAutofillMigrationState(
+ syncable::AutofillMigrationState state) {
+ if (backend_.get() && backend_initialized_) {
+ backend_->SetAutofillMigrationState(state);
+ } else {
+ NOTREACHED();
+ }
+}
+
+syncable::AutofillMigrationDebugInfo
+ ProfileSyncService::GetAutofillMigrationDebugInfo() {
+ if (backend_.get() && backend_initialized_) {
+ return backend_->GetAutofillMigrationDebugInfo();
+ }
+ NOTREACHED();
+ syncable::AutofillMigrationDebugInfo debug_info = { 0 };
+ return debug_info;
+}
+
+void ProfileSyncService::SetAutofillMigrationDebugInfo(
+ syncable::AutofillMigrationDebugInfo::PropertyToSet property_to_set,
+ const syncable::AutofillMigrationDebugInfo& info) {
+ if (backend_.get() && backend_initialized_) {
+ backend_->SetAutofillMigrationDebugInfo(property_to_set, info);
+ } else {
+ NOTREACHED();
+ }
+}
+
void ProfileSyncService::ActivateDataType(
DataTypeController* data_type_controller,
ChangeProcessor* change_processor) {
@@ -1039,7 +1118,7 @@ void ProfileSyncService::ActivateDataType(
return;
}
DCHECK(backend_initialized_);
- change_processor->Start(profile(), backend_->GetUserShareHandle());
+ change_processor->Start(profile(), backend_->GetUserShare());
backend_->ActivateDataType(data_type_controller, change_processor);
}
« no previous file with comments | « chrome/browser/sync/profile_sync_service.h ('k') | chrome/browser/sync/profile_sync_service_autofill_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698