| OLD | NEW |
| (Empty) |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef CHROME_BROWSER_SYNC_GLUE_SYNCABLE_SERVICE_ADAPTER_H_ | |
| 6 #define CHROME_BROWSER_SYNC_GLUE_SYNCABLE_SERVICE_ADAPTER_H_ | |
| 7 #pragma once | |
| 8 | |
| 9 #include <vector> | |
| 10 | |
| 11 #include "base/compiler_specific.h" | |
| 12 #include "chrome/browser/sync/api/syncable_service.h" | |
| 13 #include "chrome/browser/sync/glue/model_associator.h" | |
| 14 | |
| 15 class SyncableService; | |
| 16 | |
| 17 namespace browser_sync { | |
| 18 | |
| 19 class GenericChangeProcessor; | |
| 20 | |
| 21 // An adapter to handle transitioning from model associator's to syncable | |
| 22 // services. Implements the model associator interface, invoking the | |
| 23 // provided SyncableService as necessary. | |
| 24 class SyncableServiceAdapter : public AssociatorInterface { | |
| 25 public: | |
| 26 SyncableServiceAdapter(syncable::ModelType type, | |
| 27 SyncableService* service, | |
| 28 GenericChangeProcessor* sync_processor); | |
| 29 virtual ~SyncableServiceAdapter(); | |
| 30 | |
| 31 // AssociatorInterface implementation. | |
| 32 virtual bool AssociateModels(SyncError* error) OVERRIDE; | |
| 33 virtual bool DisassociateModels(SyncError* error) OVERRIDE; | |
| 34 virtual bool SyncModelHasUserCreatedNodes(bool* has_nodes) OVERRIDE; | |
| 35 virtual void AbortAssociation() OVERRIDE; | |
| 36 virtual bool CryptoReadyIfNecessary() OVERRIDE; | |
| 37 | |
| 38 private: | |
| 39 // Whether the SyncableService we wrap is currently syncing or not. | |
| 40 bool syncing_; | |
| 41 | |
| 42 // The data type being provided by this service. | |
| 43 syncable::ModelType type_; | |
| 44 | |
| 45 // A pointer to the actual local syncable service, which performs all the | |
| 46 // real work. | |
| 47 SyncableService* service_; | |
| 48 | |
| 49 // The datatype's SyncChange handler that interacts with the sync db. | |
| 50 GenericChangeProcessor* sync_processor_; | |
| 51 | |
| 52 DISALLOW_COPY_AND_ASSIGN(SyncableServiceAdapter); | |
| 53 }; | |
| 54 | |
| 55 } // namespace browser_sync | |
| 56 | |
| 57 #endif // CHROME_BROWSER_SYNC_GLUE_SYNCABLE_SERVICE_ADAPTER_H_ | |
| OLD | NEW |