OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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 SYNC_INTERNAL_API_PUBLIC_WRITE_NODE_H_ | 5 #ifndef SYNC_INTERNAL_API_PUBLIC_WRITE_NODE_H_ |
6 #define SYNC_INTERNAL_API_PUBLIC_WRITE_NODE_H_ | 6 #define SYNC_INTERNAL_API_PUBLIC_WRITE_NODE_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 }; | 55 }; |
56 | 56 |
57 // Create a WriteNode using the given transaction. | 57 // Create a WriteNode using the given transaction. |
58 explicit WriteNode(WriteTransaction* transaction); | 58 explicit WriteNode(WriteTransaction* transaction); |
59 virtual ~WriteNode(); | 59 virtual ~WriteNode(); |
60 | 60 |
61 // A client must use one (and only one) of the following Init variants to | 61 // A client must use one (and only one) of the following Init variants to |
62 // populate the node. | 62 // populate the node. |
63 | 63 |
64 // BaseNode implementation. | 64 // BaseNode implementation. |
65 virtual InitByLookupResult InitByIdLookup(int64 id) OVERRIDE; | 65 virtual InitByLookupResult InitByIdLookup(int64 id) override; |
66 virtual InitByLookupResult InitByClientTagLookup( | 66 virtual InitByLookupResult InitByClientTagLookup( |
67 ModelType model_type, | 67 ModelType model_type, |
68 const std::string& tag) OVERRIDE; | 68 const std::string& tag) override; |
69 | 69 |
70 // Create a new bookmark node with the specified parent and predecessor. Use | 70 // Create a new bookmark node with the specified parent and predecessor. Use |
71 // a NULL |predecessor| to indicate that this is to be the first child. | 71 // a NULL |predecessor| to indicate that this is to be the first child. |
72 // |predecessor| must be a child of |new_parent| or NULL. Returns false on | 72 // |predecessor| must be a child of |new_parent| or NULL. Returns false on |
73 // failure. | 73 // failure. |
74 bool InitBookmarkByCreation(const BaseNode& parent, | 74 bool InitBookmarkByCreation(const BaseNode& parent, |
75 const BaseNode* predecessor); | 75 const BaseNode* predecessor); |
76 | 76 |
77 // Create nodes using this function if they're unique items that | 77 // Create nodes using this function if they're unique items that |
78 // you want to fetch using client_tag. Note that the behavior of these | 78 // you want to fetch using client_tag. Note that the behavior of these |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
171 // Set the priority preference specifics. | 171 // Set the priority preference specifics. |
172 // Should only be called if GetModelType() == PRIORITY_PREFERENCE. | 172 // Should only be called if GetModelType() == PRIORITY_PREFERENCE. |
173 void SetPriorityPreferenceSpecifics( | 173 void SetPriorityPreferenceSpecifics( |
174 const sync_pb::PriorityPreferenceSpecifics& specifics); | 174 const sync_pb::PriorityPreferenceSpecifics& specifics); |
175 | 175 |
176 // Set the attachment metadata. | 176 // Set the attachment metadata. |
177 void SetAttachmentMetadata( | 177 void SetAttachmentMetadata( |
178 const sync_pb::AttachmentMetadata& attachment_metadata); | 178 const sync_pb::AttachmentMetadata& attachment_metadata); |
179 | 179 |
180 // Implementation of BaseNode's abstract virtual accessors. | 180 // Implementation of BaseNode's abstract virtual accessors. |
181 virtual const syncable::Entry* GetEntry() const OVERRIDE; | 181 virtual const syncable::Entry* GetEntry() const override; |
182 | 182 |
183 virtual const BaseTransaction* GetTransaction() const OVERRIDE; | 183 virtual const BaseTransaction* GetTransaction() const override; |
184 | 184 |
185 syncable::MutableEntry* GetMutableEntryForTest(); | 185 syncable::MutableEntry* GetMutableEntryForTest(); |
186 | 186 |
187 private: | 187 private: |
188 FRIEND_TEST_ALL_PREFIXES(SyncManagerTest, EncryptBookmarksWithLegacyData); | 188 FRIEND_TEST_ALL_PREFIXES(SyncManagerTest, EncryptBookmarksWithLegacyData); |
189 | 189 |
190 void* operator new(size_t size); // Node is meant for stack use only. | 190 void* operator new(size_t size); // Node is meant for stack use only. |
191 | 191 |
192 // Helper to set the previous node. | 192 // Helper to set the previous node. |
193 bool PutPredecessor(const BaseNode* predecessor) WARN_UNUSED_RESULT; | 193 bool PutPredecessor(const BaseNode* predecessor) WARN_UNUSED_RESULT; |
194 | 194 |
195 // Sets IS_UNSYNCED and SYNCING to ensure this entry is considered in an | 195 // Sets IS_UNSYNCED and SYNCING to ensure this entry is considered in an |
196 // upcoming commit pass. | 196 // upcoming commit pass. |
197 void MarkForSyncing(); | 197 void MarkForSyncing(); |
198 | 198 |
199 // The underlying syncable object which this class wraps. | 199 // The underlying syncable object which this class wraps. |
200 syncable::MutableEntry* entry_; | 200 syncable::MutableEntry* entry_; |
201 | 201 |
202 // The sync API transaction that is the parent of this node. | 202 // The sync API transaction that is the parent of this node. |
203 WriteTransaction* transaction_; | 203 WriteTransaction* transaction_; |
204 | 204 |
205 DISALLOW_COPY_AND_ASSIGN(WriteNode); | 205 DISALLOW_COPY_AND_ASSIGN(WriteNode); |
206 }; | 206 }; |
207 | 207 |
208 } // namespace syncer | 208 } // namespace syncer |
209 | 209 |
210 #endif // SYNC_INTERNAL_API_PUBLIC_WRITE_NODE_H_ | 210 #endif // SYNC_INTERNAL_API_PUBLIC_WRITE_NODE_H_ |
OLD | NEW |