| 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 <stddef.h> |
| 9 #include <stdint.h> |
| 10 |
| 8 #include <string> | 11 #include <string> |
| 9 #include <vector> | 12 #include <vector> |
| 10 | 13 |
| 11 #include "base/basictypes.h" | |
| 12 #include "base/compiler_specific.h" | 14 #include "base/compiler_specific.h" |
| 13 #include "base/gtest_prod_util.h" | 15 #include "base/gtest_prod_util.h" |
| 16 #include "base/macros.h" |
| 14 #include "sync/base/sync_export.h" | 17 #include "sync/base/sync_export.h" |
| 15 #include "sync/internal_api/public/base/model_type.h" | 18 #include "sync/internal_api/public/base/model_type.h" |
| 16 #include "sync/internal_api/public/base_node.h" | 19 #include "sync/internal_api/public/base_node.h" |
| 17 | 20 |
| 18 namespace sync_pb { | 21 namespace sync_pb { |
| 19 class BookmarkSpecifics; | 22 class BookmarkSpecifics; |
| 20 class EntitySpecifics; | 23 class EntitySpecifics; |
| 21 class NigoriSpecifics; | 24 class NigoriSpecifics; |
| 22 class PasswordSpecificsData; | 25 class PasswordSpecificsData; |
| 23 class TypedUrlSpecifics; | 26 class TypedUrlSpecifics; |
| (...skipping 25 matching lines...) Expand all Loading... |
| 49 }; | 52 }; |
| 50 | 53 |
| 51 // Create a WriteNode using the given transaction. | 54 // Create a WriteNode using the given transaction. |
| 52 explicit WriteNode(WriteTransaction* transaction); | 55 explicit WriteNode(WriteTransaction* transaction); |
| 53 ~WriteNode() override; | 56 ~WriteNode() override; |
| 54 | 57 |
| 55 // A client must use one (and only one) of the following Init variants to | 58 // A client must use one (and only one) of the following Init variants to |
| 56 // populate the node. | 59 // populate the node. |
| 57 | 60 |
| 58 // BaseNode implementation. | 61 // BaseNode implementation. |
| 59 InitByLookupResult InitByIdLookup(int64 id) override; | 62 InitByLookupResult InitByIdLookup(int64_t id) override; |
| 60 InitByLookupResult InitByClientTagLookup(ModelType model_type, | 63 InitByLookupResult InitByClientTagLookup(ModelType model_type, |
| 61 const std::string& tag) override; | 64 const std::string& tag) override; |
| 62 | 65 |
| 63 // Create a new bookmark node with the specified parent and predecessor. Use | 66 // Create a new bookmark node with the specified parent and predecessor. Use |
| 64 // a NULL |predecessor| to indicate that this is to be the first child. | 67 // a NULL |predecessor| to indicate that this is to be the first child. |
| 65 // |predecessor| must be a child of |new_parent| or NULL. Returns false on | 68 // |predecessor| must be a child of |new_parent| or NULL. Returns false on |
| 66 // failure. | 69 // failure. |
| 67 bool InitBookmarkByCreation(const BaseNode& parent, | 70 bool InitBookmarkByCreation(const BaseNode& parent, |
| 68 const BaseNode* predecessor); | 71 const BaseNode* predecessor); |
| 69 | 72 |
| (...skipping 18 matching lines...) Expand all Loading... |
| 88 // server during initial sync, though we do eventually wish to remove it from | 91 // server during initial sync, though we do eventually wish to remove it from |
| 89 // the protocol and have the client "fake it" instead. | 92 // the protocol and have the client "fake it" instead. |
| 90 InitByLookupResult InitTypeRoot(ModelType type); | 93 InitByLookupResult InitTypeRoot(ModelType type); |
| 91 | 94 |
| 92 // These Set() functions correspond to the Get() functions of BaseNode. | 95 // These Set() functions correspond to the Get() functions of BaseNode. |
| 93 void SetIsFolder(bool folder); | 96 void SetIsFolder(bool folder); |
| 94 void SetTitle(const std::string& title); | 97 void SetTitle(const std::string& title); |
| 95 | 98 |
| 96 // External ID is a client-only field, so setting it doesn't cause the item to | 99 // External ID is a client-only field, so setting it doesn't cause the item to |
| 97 // be synced again. | 100 // be synced again. |
| 98 void SetExternalId(int64 external_id); | 101 void SetExternalId(int64_t external_id); |
| 99 | 102 |
| 100 // Remove this node and its children and sync deletion to server. | 103 // Remove this node and its children and sync deletion to server. |
| 101 void Tombstone(); | 104 void Tombstone(); |
| 102 | 105 |
| 103 // If the node is known by server, remove it and its children but don't sync | 106 // If the node is known by server, remove it and its children but don't sync |
| 104 // deletion to server. Do nothing if the node is not known by server so that | 107 // deletion to server. Do nothing if the node is not known by server so that |
| 105 // server can have a record of the node. | 108 // server can have a record of the node. |
| 106 void Drop(); | 109 void Drop(); |
| 107 | 110 |
| 108 // Set a new parent and position. Position is specified by |predecessor|; if | 111 // Set a new parent and position. Position is specified by |predecessor|; if |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 169 | 172 |
| 170 // The sync API transaction that is the parent of this node. | 173 // The sync API transaction that is the parent of this node. |
| 171 WriteTransaction* transaction_; | 174 WriteTransaction* transaction_; |
| 172 | 175 |
| 173 DISALLOW_COPY_AND_ASSIGN(WriteNode); | 176 DISALLOW_COPY_AND_ASSIGN(WriteNode); |
| 174 }; | 177 }; |
| 175 | 178 |
| 176 } // namespace syncer | 179 } // namespace syncer |
| 177 | 180 |
| 178 #endif // SYNC_INTERNAL_API_PUBLIC_WRITE_NODE_H_ | 181 #endif // SYNC_INTERNAL_API_PUBLIC_WRITE_NODE_H_ |
| OLD | NEW |