| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/glue/syncable_service_adapter.h" | 5 #include "chrome/browser/sync/glue/syncable_service_adapter.h" |
| 6 | 6 |
| 7 #include "chrome/browser/sync/api/syncable_service.h" | 7 #include "chrome/browser/sync/api/syncable_service.h" |
| 8 #include "chrome/browser/sync/api/sync_data.h" | 8 #include "chrome/browser/sync/api/sync_data.h" |
| 9 #include "chrome/browser/sync/glue/generic_change_processor.h" | 9 #include "chrome/browser/sync/glue/generic_change_processor.h" |
| 10 | 10 |
| (...skipping 21 matching lines...) Expand all Loading... |
| 32 | 32 |
| 33 bool SyncableServiceAdapter::AssociateModels(SyncError* error) { | 33 bool SyncableServiceAdapter::AssociateModels(SyncError* error) { |
| 34 syncing_ = true; | 34 syncing_ = true; |
| 35 SyncDataList initial_sync_data; | 35 SyncDataList initial_sync_data; |
| 36 SyncError temp_error = | 36 SyncError temp_error = |
| 37 sync_processor_->GetSyncDataForType(type_, &initial_sync_data); | 37 sync_processor_->GetSyncDataForType(type_, &initial_sync_data); |
| 38 if (temp_error.IsSet()) { | 38 if (temp_error.IsSet()) { |
| 39 *error = temp_error; | 39 *error = temp_error; |
| 40 return false; | 40 return false; |
| 41 } | 41 } |
| 42 |
| 43 // TODO(zea): Have all datatypes take ownership of the sync_processor_. |
| 42 temp_error = service_->MergeDataAndStartSyncing(type_, | 44 temp_error = service_->MergeDataAndStartSyncing(type_, |
| 43 initial_sync_data, | 45 initial_sync_data, |
| 44 sync_processor_); | 46 sync_processor_); |
| 45 if (temp_error.IsSet()) { | 47 if (temp_error.IsSet()) { |
| 46 *error = temp_error; | 48 *error = temp_error; |
| 47 return false; | 49 return false; |
| 48 } | 50 } |
| 49 return true; | 51 return true; |
| 50 } | 52 } |
| 51 | 53 |
| 52 bool SyncableServiceAdapter::DisassociateModels(SyncError* error) { | 54 bool SyncableServiceAdapter::DisassociateModels(SyncError* error) { |
| 53 service_->StopSyncing(type_); | 55 service_->StopSyncing(type_); |
| 54 syncing_ = false; | 56 syncing_ = false; |
| 55 return true; | 57 return true; |
| 56 } | 58 } |
| 57 | 59 |
| 58 bool SyncableServiceAdapter::SyncModelHasUserCreatedNodes(bool* has_nodes) { | 60 bool SyncableServiceAdapter::SyncModelHasUserCreatedNodes(bool* has_nodes) { |
| 59 return sync_processor_->SyncModelHasUserCreatedNodes(type_, has_nodes); | 61 return sync_processor_->SyncModelHasUserCreatedNodes(type_, has_nodes); |
| 60 } | 62 } |
| 61 | 63 |
| 62 void SyncableServiceAdapter::AbortAssociation() { | 64 void SyncableServiceAdapter::AbortAssociation() { |
| 63 service_->StopSyncing(type_); | 65 NOTIMPLEMENTED(); |
| 64 syncing_ = false; | |
| 65 } | 66 } |
| 66 | 67 |
| 67 bool SyncableServiceAdapter::CryptoReadyIfNecessary() { | 68 bool SyncableServiceAdapter::CryptoReadyIfNecessary() { |
| 68 return sync_processor_->CryptoReadyIfNecessary(type_); | 69 return sync_processor_->CryptoReadyIfNecessary(type_); |
| 69 } | 70 } |
| 70 | 71 |
| 71 } // namespace browser_sync | 72 } // namespace browser_sync |
| OLD | NEW |