| 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 COMPONENTS_SYNC_SYNCABLE_WRITE_NODE_H_ | 5 #ifndef COMPONENTS_SYNC_SYNCABLE_WRITE_NODE_H_ |
| 6 #define COMPONENTS_SYNC_SYNCABLE_WRITE_NODE_H_ | 6 #define COMPONENTS_SYNC_SYNCABLE_WRITE_NODE_H_ |
| 7 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 #include <stdint.h> | 9 #include <stdint.h> |
| 10 | 10 |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 | 58 |
| 59 // A client must use one (and only one) of the following Init variants to | 59 // A client must use one (and only one) of the following Init variants to |
| 60 // populate the node. | 60 // populate the node. |
| 61 | 61 |
| 62 // BaseNode implementation. | 62 // BaseNode implementation. |
| 63 InitByLookupResult InitByIdLookup(int64_t id) override; | 63 InitByLookupResult InitByIdLookup(int64_t id) override; |
| 64 InitByLookupResult InitByClientTagLookup(ModelType model_type, | 64 InitByLookupResult InitByClientTagLookup(ModelType model_type, |
| 65 const std::string& tag) override; | 65 const std::string& tag) override; |
| 66 | 66 |
| 67 // Create a new bookmark node with the specified parent and predecessor. Use | 67 // Create a new bookmark node with the specified parent and predecessor. Use |
| 68 // a NULL |predecessor| to indicate that this is to be the first child. | 68 // a null |predecessor| to indicate that this is to be the first child. |
| 69 // |predecessor| must be a child of |new_parent| or NULL. Returns false on | 69 // |predecessor| must be a child of |new_parent| or null. Returns false on |
| 70 // failure. | 70 // failure. |
| 71 bool InitBookmarkByCreation(const BaseNode& parent, | 71 bool InitBookmarkByCreation(const BaseNode& parent, |
| 72 const BaseNode* predecessor); | 72 const BaseNode* predecessor); |
| 73 | 73 |
| 74 // Create nodes using this function if they're unique items that | 74 // Create nodes using this function if they're unique items that |
| 75 // you want to fetch using client_tag. Note that the behavior of these | 75 // you want to fetch using client_tag. Note that the behavior of these |
| 76 // items is slightly different than that of normal items. | 76 // items is slightly different than that of normal items. |
| 77 // Most importantly, if it exists locally but is deleted, this function will | 77 // Most importantly, if it exists locally but is deleted, this function will |
| 78 // actually undelete it. Otherwise it will reuse the existing node. | 78 // actually undelete it. Otherwise it will reuse the existing node. |
| 79 // Client unique tagged nodes must NOT be folders. | 79 // Client unique tagged nodes must NOT be folders. |
| (...skipping 23 matching lines...) Expand all Loading... |
| 103 | 103 |
| 104 // Remove this node and its children and sync deletion to server. | 104 // Remove this node and its children and sync deletion to server. |
| 105 void Tombstone(); | 105 void Tombstone(); |
| 106 | 106 |
| 107 // If the node is known by server, remove it and its children but don't sync | 107 // If the node is known by server, remove it and its children but don't sync |
| 108 // deletion to server. Do nothing if the node is not known by server so that | 108 // deletion to server. Do nothing if the node is not known by server so that |
| 109 // server can have a record of the node. | 109 // server can have a record of the node. |
| 110 void Drop(); | 110 void Drop(); |
| 111 | 111 |
| 112 // Set a new parent and position. Position is specified by |predecessor|; if | 112 // Set a new parent and position. Position is specified by |predecessor|; if |
| 113 // it is NULL, the node is moved to the first position. |predecessor| must | 113 // it is null, the node is moved to the first position. |predecessor| must |
| 114 // be a child of |new_parent| or NULL. Returns false on failure.. | 114 // be a child of |new_parent| or null. Returns false on failure.. |
| 115 bool SetPosition(const BaseNode& new_parent, const BaseNode* predecessor); | 115 bool SetPosition(const BaseNode& new_parent, const BaseNode* predecessor); |
| 116 | 116 |
| 117 // Set the bookmark specifics (url and favicon). | 117 // Set the bookmark specifics (url and favicon). |
| 118 // Should only be called if GetModelType() == BOOKMARK. | 118 // Should only be called if GetModelType() == BOOKMARK. |
| 119 void SetBookmarkSpecifics(const sync_pb::BookmarkSpecifics& specifics); | 119 void SetBookmarkSpecifics(const sync_pb::BookmarkSpecifics& specifics); |
| 120 | 120 |
| 121 // Generic set specifics method. Will extract the model type from |specifics|. | 121 // Generic set specifics method. Will extract the model type from |specifics|. |
| 122 void SetEntitySpecifics(const sync_pb::EntitySpecifics& specifics); | 122 void SetEntitySpecifics(const sync_pb::EntitySpecifics& specifics); |
| 123 | 123 |
| 124 // Resets the EntitySpecifics for this node based on the unencrypted data. | 124 // Resets the EntitySpecifics for this node based on the unencrypted data. |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 173 | 173 |
| 174 // The sync API transaction that is the parent of this node. | 174 // The sync API transaction that is the parent of this node. |
| 175 WriteTransaction* transaction_; | 175 WriteTransaction* transaction_; |
| 176 | 176 |
| 177 DISALLOW_COPY_AND_ASSIGN(WriteNode); | 177 DISALLOW_COPY_AND_ASSIGN(WriteNode); |
| 178 }; | 178 }; |
| 179 | 179 |
| 180 } // namespace syncer | 180 } // namespace syncer |
| 181 | 181 |
| 182 #endif // COMPONENTS_SYNC_SYNCABLE_WRITE_NODE_H_ | 182 #endif // COMPONENTS_SYNC_SYNCABLE_WRITE_NODE_H_ |
| OLD | NEW |