| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 #ifndef COMPONENTS_SYNC_DRIVER_MODEL_ASSOCIATOR_H_ | 5 #ifndef COMPONENTS_SYNC_DRIVER_MODEL_ASSOCIATOR_H_ |
| 6 #define COMPONENTS_SYNC_DRIVER_MODEL_ASSOCIATOR_H_ | 6 #define COMPONENTS_SYNC_DRIVER_MODEL_ASSOCIATOR_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include "base/synchronization/lock.h" | 10 #include "base/synchronization/lock.h" |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 64 template <class Node, class IDType> | 64 template <class Node, class IDType> |
| 65 class PerDataTypeAssociatorInterface : public AssociatorInterface { | 65 class PerDataTypeAssociatorInterface : public AssociatorInterface { |
| 66 public: | 66 public: |
| 67 virtual ~PerDataTypeAssociatorInterface() {} | 67 virtual ~PerDataTypeAssociatorInterface() {} |
| 68 // Returns sync id for the given chrome model id. | 68 // Returns sync id for the given chrome model id. |
| 69 // Returns kInvalidId if the sync node is not found for the given | 69 // Returns kInvalidId if the sync node is not found for the given |
| 70 // chrome id. | 70 // chrome id. |
| 71 virtual int64_t GetSyncIdFromChromeId(const IDType& id) = 0; | 71 virtual int64_t GetSyncIdFromChromeId(const IDType& id) = 0; |
| 72 | 72 |
| 73 // Returns the chrome node for the given sync id. | 73 // Returns the chrome node for the given sync id. |
| 74 // Returns NULL if no node is found for the given sync id. | 74 // Returns null if no node is found for the given sync id. |
| 75 virtual const Node* GetChromeNodeFromSyncId(int64_t sync_id) = 0; | 75 virtual const Node* GetChromeNodeFromSyncId(int64_t sync_id) = 0; |
| 76 | 76 |
| 77 // Initializes the given sync node from the given chrome node id. | 77 // Initializes the given sync node from the given chrome node id. |
| 78 // Returns false if no sync node was found for the given chrome node id or | 78 // Returns false if no sync node was found for the given chrome node id or |
| 79 // if the initialization of sync node fails. | 79 // if the initialization of sync node fails. |
| 80 virtual bool InitSyncNodeFromChromeId(const IDType& node_id, | 80 virtual bool InitSyncNodeFromChromeId(const IDType& node_id, |
| 81 BaseNode* sync_node) = 0; | 81 BaseNode* sync_node) = 0; |
| 82 | 82 |
| 83 // Associates the given chrome node with the given sync node. | 83 // Associates the given chrome node with the given sync node. |
| 84 virtual void Associate(const Node* node, const BaseNode& sync_node) = 0; | 84 virtual void Associate(const Node* node, const BaseNode& sync_node) = 0; |
| 85 | 85 |
| 86 // Remove the association that corresponds to the given sync id. | 86 // Remove the association that corresponds to the given sync id. |
| 87 virtual void Disassociate(int64_t sync_id) = 0; | 87 virtual void Disassociate(int64_t sync_id) = 0; |
| 88 }; | 88 }; |
| 89 | 89 |
| 90 } // namespace syncer | 90 } // namespace syncer |
| 91 | 91 |
| 92 #endif // COMPONENTS_SYNC_DRIVER_MODEL_ASSOCIATOR_H_ | 92 #endif // COMPONENTS_SYNC_DRIVER_MODEL_ASSOCIATOR_H_ |
| OLD | NEW |