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

Side by Side Diff: chrome/browser/sync/glue/syncable_service_adapter.cc

Issue 8274020: Revert 105404 - [Sync] Refactor non-frontend DTC to handle new API properly. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years, 2 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) 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
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_.
44 // Further, refactor the DTC's to not need this class at all
45 // (crbug.com/100114).
46 temp_error = service_->MergeDataAndStartSyncing(type_, 42 temp_error = service_->MergeDataAndStartSyncing(type_,
47 initial_sync_data, 43 initial_sync_data,
48 sync_processor_); 44 sync_processor_);
49 if (temp_error.IsSet()) { 45 if (temp_error.IsSet()) {
50 *error = temp_error; 46 *error = temp_error;
51 return false; 47 return false;
52 } 48 }
53 return true; 49 return true;
54 } 50 }
55 51
56 bool SyncableServiceAdapter::DisassociateModels(SyncError* error) { 52 bool SyncableServiceAdapter::DisassociateModels(SyncError* error) {
57 service_->StopSyncing(type_); 53 service_->StopSyncing(type_);
58 syncing_ = false; 54 syncing_ = false;
59 return true; 55 return true;
60 } 56 }
61 57
62 bool SyncableServiceAdapter::SyncModelHasUserCreatedNodes(bool* has_nodes) { 58 bool SyncableServiceAdapter::SyncModelHasUserCreatedNodes(bool* has_nodes) {
63 return sync_processor_->SyncModelHasUserCreatedNodes(type_, has_nodes); 59 return sync_processor_->SyncModelHasUserCreatedNodes(type_, has_nodes);
64 } 60 }
65 61
66 void SyncableServiceAdapter::AbortAssociation() { 62 void SyncableServiceAdapter::AbortAssociation() {
67 NOTIMPLEMENTED(); 63 service_->StopSyncing(type_);
64 syncing_ = false;
68 } 65 }
69 66
70 bool SyncableServiceAdapter::CryptoReadyIfNecessary() { 67 bool SyncableServiceAdapter::CryptoReadyIfNecessary() {
71 return sync_processor_->CryptoReadyIfNecessary(type_); 68 return sync_processor_->CryptoReadyIfNecessary(type_);
72 } 69 }
73 70
74 } // namespace browser_sync 71 } // namespace browser_sync
OLDNEW
« no previous file with comments | « chrome/browser/sync/glue/shared_change_processor_ref.cc ('k') | chrome/browser/sync/profile_sync_factory.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698