OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 CHROME_BROWSER_SYNC_GLUE_MODEL_ASSOCIATOR_H_ | 5 #ifndef CHROME_BROWSER_SYNC_GLUE_MODEL_ASSOCIATOR_H_ |
6 #define CHROME_BROWSER_SYNC_GLUE_MODEL_ASSOCIATOR_H_ | 6 #define CHROME_BROWSER_SYNC_GLUE_MODEL_ASSOCIATOR_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "chrome/browser/sync/syncable/model_type.h" | 10 #include "chrome/browser/sync/syncable/model_type.h" |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 // This template is appropriate for data types where a Node* makes sense for | 53 // This template is appropriate for data types where a Node* makes sense for |
54 // referring to a particular item. If we encounter a type that does not fit | 54 // referring to a particular item. If we encounter a type that does not fit |
55 // in this world, we may want to have several PerDataType templates. | 55 // in this world, we may want to have several PerDataType templates. |
56 template <class Node, class IDType> | 56 template <class Node, class IDType> |
57 class PerDataTypeAssociatorInterface : public AssociatorInterface { | 57 class PerDataTypeAssociatorInterface : public AssociatorInterface { |
58 public: | 58 public: |
59 virtual ~PerDataTypeAssociatorInterface() {} | 59 virtual ~PerDataTypeAssociatorInterface() {} |
60 // Returns sync id for the given chrome model id. | 60 // Returns sync id for the given chrome model id. |
61 // Returns sync_api::kInvalidId if the sync node is not found for the given | 61 // Returns sync_api::kInvalidId if the sync node is not found for the given |
62 // chrome id. | 62 // chrome id. |
63 virtual int64 GetSyncIdFromChromeId(IDType id) = 0; | 63 virtual int64 GetSyncIdFromChromeId(const IDType& id) = 0; |
64 | 64 |
65 // Returns the chrome node for the given sync id. | 65 // Returns the chrome node for the given sync id. |
66 // Returns NULL if no node is found for the given sync id. | 66 // Returns NULL if no node is found for the given sync id. |
67 virtual const Node* GetChromeNodeFromSyncId(int64 sync_id) = 0; | 67 virtual const Node* GetChromeNodeFromSyncId(int64 sync_id) = 0; |
68 | 68 |
69 // Initializes the given sync node from the given chrome node id. | 69 // Initializes the given sync node from the given chrome node id. |
70 // Returns false if no sync node was found for the given chrome node id or | 70 // Returns false if no sync node was found for the given chrome node id or |
71 // if the initialization of sync node fails. | 71 // if the initialization of sync node fails. |
72 virtual bool InitSyncNodeFromChromeId(IDType node_id, | 72 virtual bool InitSyncNodeFromChromeId(const IDType& node_id, |
73 sync_api::BaseNode* sync_node) = 0; | 73 sync_api::BaseNode* sync_node) = 0; |
74 | 74 |
75 // Associates the given chrome node with the given sync id. | 75 // Associates the given chrome node with the given sync id. |
76 virtual void Associate(const Node* node, int64 sync_id) = 0; | 76 virtual void Associate(const Node* node, int64 sync_id) = 0; |
77 | 77 |
78 // Remove the association that corresponds to the given sync id. | 78 // Remove the association that corresponds to the given sync id. |
79 virtual void Disassociate(int64 sync_id) = 0; | 79 virtual void Disassociate(int64 sync_id) = 0; |
80 }; | 80 }; |
81 | 81 |
82 } // namespace browser_sync | 82 } // namespace browser_sync |
83 | 83 |
84 #endif // CHROME_BROWSER_SYNC_GLUE_MODEL_ASSOCIATOR_H_ | 84 #endif // CHROME_BROWSER_SYNC_GLUE_MODEL_ASSOCIATOR_H_ |
OLD | NEW |