Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(211)

Side by Side Diff: sync/internal_api/public/write_node.h

Issue 10696087: [Sync] Move ModelType and related classes to 'syncer' namespace (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: sort headers, update copyrights Created 8 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « sync/internal_api/public/test/test_entry_factory.h ('k') | sync/internal_api/read_node.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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 #pragma once 7 #pragma once
8 8
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 // Create a WriteNode using the given transaction. 58 // Create a WriteNode using the given transaction.
59 explicit WriteNode(WriteTransaction* transaction); 59 explicit WriteNode(WriteTransaction* transaction);
60 virtual ~WriteNode(); 60 virtual ~WriteNode();
61 61
62 // A client must use one (and only one) of the following Init variants to 62 // A client must use one (and only one) of the following Init variants to
63 // populate the node. 63 // populate the node.
64 64
65 // BaseNode implementation. 65 // BaseNode implementation.
66 virtual InitByLookupResult InitByIdLookup(int64 id) OVERRIDE; 66 virtual InitByLookupResult InitByIdLookup(int64 id) OVERRIDE;
67 virtual InitByLookupResult InitByClientTagLookup( 67 virtual InitByLookupResult InitByClientTagLookup(
68 syncable::ModelType model_type, 68 syncer::ModelType model_type,
69 const std::string& tag) OVERRIDE; 69 const std::string& tag) OVERRIDE;
70 70
71 // Create a new node with the specified parent and predecessor. |model_type| 71 // Create a new node with the specified parent and predecessor. |model_type|
72 // dictates the type of the item, and controls which EntitySpecifics proto 72 // dictates the type of the item, and controls which EntitySpecifics proto
73 // extension can be used with this item. Use a NULL |predecessor| 73 // extension can be used with this item. Use a NULL |predecessor|
74 // to indicate that this is to be the first child. 74 // to indicate that this is to be the first child.
75 // |predecessor| must be a child of |new_parent| or NULL. Returns false on 75 // |predecessor| must be a child of |new_parent| or NULL. Returns false on
76 // failure. 76 // failure.
77 bool InitByCreation(syncable::ModelType model_type, 77 bool InitByCreation(syncer::ModelType model_type,
78 const BaseNode& parent, 78 const BaseNode& parent,
79 const BaseNode* predecessor); 79 const BaseNode* predecessor);
80 80
81 // Create nodes using this function if they're unique items that 81 // Create nodes using this function if they're unique items that
82 // you want to fetch using client_tag. Note that the behavior of these 82 // you want to fetch using client_tag. Note that the behavior of these
83 // items is slightly different than that of normal items. 83 // items is slightly different than that of normal items.
84 // Most importantly, if it exists locally, this function will 84 // Most importantly, if it exists locally, this function will
85 // actually undelete it 85 // actually undelete it
86 // Client unique tagged nodes must NOT be folders. 86 // Client unique tagged nodes must NOT be folders.
87 InitUniqueByCreationResult InitUniqueByCreation( 87 InitUniqueByCreationResult InitUniqueByCreation(
88 syncable::ModelType model_type, 88 syncer::ModelType model_type,
89 const BaseNode& parent, 89 const BaseNode& parent,
90 const std::string& client_tag); 90 const std::string& client_tag);
91 91
92 // Each server-created permanent node is tagged with a unique string. 92 // Each server-created permanent node is tagged with a unique string.
93 // Look up the node with the particular tag. If it does not exist, 93 // Look up the node with the particular tag. If it does not exist,
94 // return false. 94 // return false.
95 InitByLookupResult InitByTagLookup(const std::string& tag); 95 InitByLookupResult InitByTagLookup(const std::string& tag);
96 96
97 // These Set() functions correspond to the Get() functions of BaseNode. 97 // These Set() functions correspond to the Get() functions of BaseNode.
98 void SetIsFolder(bool folder); 98 void SetIsFolder(bool folder);
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
171 virtual const BaseTransaction* GetTransaction() const OVERRIDE; 171 virtual const BaseTransaction* GetTransaction() const OVERRIDE;
172 172
173 syncable::MutableEntry* GetMutableEntryForTest(); 173 syncable::MutableEntry* GetMutableEntryForTest();
174 174
175 private: 175 private:
176 FRIEND_TEST_ALL_PREFIXES(SyncManagerTest, EncryptBookmarksWithLegacyData); 176 FRIEND_TEST_ALL_PREFIXES(SyncManagerTest, EncryptBookmarksWithLegacyData);
177 177
178 void* operator new(size_t size); // Node is meant for stack use only. 178 void* operator new(size_t size); // Node is meant for stack use only.
179 179
180 // Helper to set model type. This will clear any specifics data. 180 // Helper to set model type. This will clear any specifics data.
181 void PutModelType(syncable::ModelType model_type); 181 void PutModelType(syncer::ModelType model_type);
182 182
183 // Helper to set the previous node. 183 // Helper to set the previous node.
184 bool PutPredecessor(const BaseNode* predecessor) WARN_UNUSED_RESULT; 184 bool PutPredecessor(const BaseNode* predecessor) WARN_UNUSED_RESULT;
185 185
186 // Sets IS_UNSYNCED and SYNCING to ensure this entry is considered in an 186 // Sets IS_UNSYNCED and SYNCING to ensure this entry is considered in an
187 // upcoming commit pass. 187 // upcoming commit pass.
188 void MarkForSyncing(); 188 void MarkForSyncing();
189 189
190 // The underlying syncable object which this class wraps. 190 // The underlying syncable object which this class wraps.
191 syncable::MutableEntry* entry_; 191 syncable::MutableEntry* entry_;
192 192
193 // The sync API transaction that is the parent of this node. 193 // The sync API transaction that is the parent of this node.
194 WriteTransaction* transaction_; 194 WriteTransaction* transaction_;
195 195
196 DISALLOW_COPY_AND_ASSIGN(WriteNode); 196 DISALLOW_COPY_AND_ASSIGN(WriteNode);
197 }; 197 };
198 198
199 } // namespace syncer 199 } // namespace syncer
200 200
201 #endif // SYNC_INTERNAL_API_PUBLIC_WRITE_NODE_H_ 201 #endif // SYNC_INTERNAL_API_PUBLIC_WRITE_NODE_H_
OLDNEW
« no previous file with comments | « sync/internal_api/public/test/test_entry_factory.h ('k') | sync/internal_api/read_node.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698