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 "base/basictypes.h" | 8 #include <stdint.h> |
| 9 |
9 #include "base/synchronization/lock.h" | 10 #include "base/synchronization/lock.h" |
10 #include "sync/api/sync_error.h" | 11 #include "sync/api/sync_error.h" |
11 #include "sync/internal_api/public/base/model_type.h" | 12 #include "sync/internal_api/public/base/model_type.h" |
12 | 13 |
13 namespace syncer { | 14 namespace syncer { |
14 class BaseNode; | 15 class BaseNode; |
15 class SyncMergeResult; | 16 class SyncMergeResult; |
16 } | 17 } |
17 | 18 |
18 namespace sync_driver { | 19 namespace sync_driver { |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 // This template is appropriate for data types where a Node* makes sense for | 64 // This template is appropriate for data types where a Node* makes sense for |
64 // referring to a particular item. If we encounter a type that does not fit | 65 // referring to a particular item. If we encounter a type that does not fit |
65 // in this world, we may want to have several PerDataType templates. | 66 // in this world, we may want to have several PerDataType templates. |
66 template <class Node, class IDType> | 67 template <class Node, class IDType> |
67 class PerDataTypeAssociatorInterface : public AssociatorInterface { | 68 class PerDataTypeAssociatorInterface : public AssociatorInterface { |
68 public: | 69 public: |
69 virtual ~PerDataTypeAssociatorInterface() {} | 70 virtual ~PerDataTypeAssociatorInterface() {} |
70 // Returns sync id for the given chrome model id. | 71 // Returns sync id for the given chrome model id. |
71 // Returns syncer::kInvalidId if the sync node is not found for the given | 72 // Returns syncer::kInvalidId if the sync node is not found for the given |
72 // chrome id. | 73 // chrome id. |
73 virtual int64 GetSyncIdFromChromeId(const IDType& id) = 0; | 74 virtual int64_t GetSyncIdFromChromeId(const IDType& id) = 0; |
74 | 75 |
75 // Returns the chrome node for the given sync id. | 76 // Returns the chrome node for the given sync id. |
76 // Returns NULL if no node is found for the given sync id. | 77 // Returns NULL if no node is found for the given sync id. |
77 virtual const Node* GetChromeNodeFromSyncId(int64 sync_id) = 0; | 78 virtual const Node* GetChromeNodeFromSyncId(int64_t sync_id) = 0; |
78 | 79 |
79 // Initializes the given sync node from the given chrome node id. | 80 // Initializes the given sync node from the given chrome node id. |
80 // Returns false if no sync node was found for the given chrome node id or | 81 // Returns false if no sync node was found for the given chrome node id or |
81 // if the initialization of sync node fails. | 82 // if the initialization of sync node fails. |
82 virtual bool InitSyncNodeFromChromeId( | 83 virtual bool InitSyncNodeFromChromeId( |
83 const IDType& node_id, | 84 const IDType& node_id, |
84 syncer::BaseNode* sync_node) = 0; | 85 syncer::BaseNode* sync_node) = 0; |
85 | 86 |
86 // Associates the given chrome node with the given sync node. | 87 // Associates the given chrome node with the given sync node. |
87 virtual void Associate(const Node* node, | 88 virtual void Associate(const Node* node, |
88 const syncer::BaseNode& sync_node) = 0; | 89 const syncer::BaseNode& sync_node) = 0; |
89 | 90 |
90 // Remove the association that corresponds to the given sync id. | 91 // Remove the association that corresponds to the given sync id. |
91 virtual void Disassociate(int64 sync_id) = 0; | 92 virtual void Disassociate(int64_t sync_id) = 0; |
92 }; | 93 }; |
93 | 94 |
94 } // namespace sync_driver | 95 } // namespace sync_driver |
95 | 96 |
96 #endif // COMPONENTS_SYNC_DRIVER_MODEL_ASSOCIATOR_H_ | 97 #endif // COMPONENTS_SYNC_DRIVER_MODEL_ASSOCIATOR_H_ |
OLD | NEW |