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

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

Issue 11412211: [sync] Componentize sync: Part Final: Target 'sync' is now its own component (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase on r171683 (no code changes) Created 8 years 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
OLDNEW
1 // Copyright (c) 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_BASE_NODE_H_ 5 #ifndef SYNC_INTERNAL_API_PUBLIC_BASE_NODE_H_
6 #define SYNC_INTERNAL_API_PUBLIC_BASE_NODE_H_ 6 #define SYNC_INTERNAL_API_PUBLIC_BASE_NODE_H_
7 7
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
11 #include "base/basictypes.h" 11 #include "base/basictypes.h"
12 #include "base/gtest_prod_util.h" 12 #include "base/gtest_prod_util.h"
13 #include "base/memory/scoped_ptr.h" 13 #include "base/memory/scoped_ptr.h"
14 #include "base/time.h" 14 #include "base/time.h"
15 #include "googleurl/src/gurl.h" 15 #include "googleurl/src/gurl.h"
16 #include "sync/base/sync_export.h"
16 #include "sync/internal_api/public/base/model_type.h" 17 #include "sync/internal_api/public/base/model_type.h"
17 #include "sync/protocol/sync.pb.h" 18 #include "sync/protocol/sync.pb.h"
18 19
19 // Forward declarations of internal class types so that sync API objects 20 // Forward declarations of internal class types so that sync API objects
20 // may have opaque pointers to these types. 21 // may have opaque pointers to these types.
21 namespace base { 22 namespace base {
22 class DictionaryValue; 23 class DictionaryValue;
23 } 24 }
24 25
25 namespace sync_pb { 26 namespace sync_pb {
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 // by doing a client tag lookup. Returns false on failure. A deleted node 80 // by doing a client tag lookup. Returns false on failure. A deleted node
80 // will return FALSE. 81 // will return FALSE.
81 virtual InitByLookupResult InitByClientTagLookup( 82 virtual InitByLookupResult InitByClientTagLookup(
82 ModelType model_type, 83 ModelType model_type,
83 const std::string& tag) = 0; 84 const std::string& tag) = 0;
84 85
85 // Each object is identified by a 64-bit id (internally, the syncable 86 // Each object is identified by a 64-bit id (internally, the syncable
86 // metahandle). These ids are strictly local handles. They will persist 87 // metahandle). These ids are strictly local handles. They will persist
87 // on this client, but the same object on a different client may have a 88 // on this client, but the same object on a different client may have a
88 // different ID value. 89 // different ID value.
89 virtual int64 GetId() const; 90 SYNC_EXPORT virtual int64 GetId() const;
90 91
91 // Returns the modification time of the object. 92 // Returns the modification time of the object.
92 base::Time GetModificationTime() const; 93 SYNC_EXPORT base::Time GetModificationTime() const;
93 94
94 // Nodes are hierarchically arranged into a single-rooted tree. 95 // Nodes are hierarchically arranged into a single-rooted tree.
95 // InitByRootLookup on ReadNode allows access to the root. GetParentId is 96 // InitByRootLookup on ReadNode allows access to the root. GetParentId is
96 // how you find a node's parent. 97 // how you find a node's parent.
97 int64 GetParentId() const; 98 SYNC_EXPORT int64 GetParentId() const;
98 99
99 // Nodes are either folders or not. This corresponds to the IS_DIR property 100 // Nodes are either folders or not. This corresponds to the IS_DIR property
100 // of syncable::Entry. 101 // of syncable::Entry.
101 bool GetIsFolder() const; 102 SYNC_EXPORT bool GetIsFolder() const;
102 103
103 // Returns the title of the object. 104 // Returns the title of the object.
104 // Uniqueness of the title is not enforced on siblings -- it is not an error 105 // Uniqueness of the title is not enforced on siblings -- it is not an error
105 // for two children to share a title. 106 // for two children to share a title.
106 std::string GetTitle() const; 107 SYNC_EXPORT std::string GetTitle() const;
107 108
108 // Returns the model type of this object. The model type is set at node 109 // Returns the model type of this object. The model type is set at node
109 // creation time and is expected never to change. 110 // creation time and is expected never to change.
110 ModelType GetModelType() const; 111 SYNC_EXPORT ModelType GetModelType() const;
111 112
112 // Getter specific to the BOOKMARK datatype. Returns protobuf 113 // Getter specific to the BOOKMARK datatype. Returns protobuf
113 // data. Can only be called if GetModelType() == BOOKMARK. 114 // data. Can only be called if GetModelType() == BOOKMARK.
114 const sync_pb::BookmarkSpecifics& GetBookmarkSpecifics() const; 115 SYNC_EXPORT const sync_pb::BookmarkSpecifics& GetBookmarkSpecifics() const;
115 116
116 // Getter specific to the APPS datatype. Returns protobuf 117 // Getter specific to the APPS datatype. Returns protobuf
117 // data. Can only be called if GetModelType() == APPS. 118 // data. Can only be called if GetModelType() == APPS.
118 const sync_pb::AppSpecifics& GetAppSpecifics() const; 119 const sync_pb::AppSpecifics& GetAppSpecifics() const;
119 120
120 // Getter specific to the AUTOFILL datatype. Returns protobuf 121 // Getter specific to the AUTOFILL datatype. Returns protobuf
121 // data. Can only be called if GetModelType() == AUTOFILL. 122 // data. Can only be called if GetModelType() == AUTOFILL.
122 const sync_pb::AutofillSpecifics& GetAutofillSpecifics() const; 123 const sync_pb::AutofillSpecifics& GetAutofillSpecifics() const;
123 124
124 virtual const sync_pb::AutofillProfileSpecifics& 125 virtual const sync_pb::AutofillProfileSpecifics&
125 GetAutofillProfileSpecifics() const; 126 GetAutofillProfileSpecifics() const;
126 127
127 // Getter specific to the NIGORI datatype. Returns protobuf 128 // Getter specific to the NIGORI datatype. Returns protobuf
128 // data. Can only be called if GetModelType() == NIGORI. 129 // data. Can only be called if GetModelType() == NIGORI.
129 const sync_pb::NigoriSpecifics& GetNigoriSpecifics() const; 130 const sync_pb::NigoriSpecifics& GetNigoriSpecifics() const;
130 131
131 // Getter specific to the PASSWORD datatype. Returns protobuf 132 // Getter specific to the PASSWORD datatype. Returns protobuf
132 // data. Can only be called if GetModelType() == PASSWORD. 133 // data. Can only be called if GetModelType() == PASSWORD.
133 const sync_pb::PasswordSpecificsData& GetPasswordSpecifics() const; 134 SYNC_EXPORT const sync_pb::PasswordSpecificsData&
135 GetPasswordSpecifics() const;
134 136
135 // Getter specific to the PREFERENCE datatype. Returns protobuf 137 // Getter specific to the PREFERENCE datatype. Returns protobuf
136 // data. Can only be called if GetModelType() == PREFERENCE. 138 // data. Can only be called if GetModelType() == PREFERENCE.
137 const sync_pb::PreferenceSpecifics& GetPreferenceSpecifics() const; 139 const sync_pb::PreferenceSpecifics& GetPreferenceSpecifics() const;
138 140
139 // Getter specific to the THEME datatype. Returns protobuf 141 // Getter specific to the THEME datatype. Returns protobuf
140 // data. Can only be called if GetModelType() == THEME. 142 // data. Can only be called if GetModelType() == THEME.
141 const sync_pb::ThemeSpecifics& GetThemeSpecifics() const; 143 const sync_pb::ThemeSpecifics& GetThemeSpecifics() const;
142 144
143 // Getter specific to the TYPED_URLS datatype. Returns protobuf 145 // Getter specific to the TYPED_URLS datatype. Returns protobuf
144 // data. Can only be called if GetModelType() == TYPED_URLS. 146 // data. Can only be called if GetModelType() == TYPED_URLS.
145 const sync_pb::TypedUrlSpecifics& GetTypedUrlSpecifics() const; 147 SYNC_EXPORT const sync_pb::TypedUrlSpecifics& GetTypedUrlSpecifics() const;
146 148
147 // Getter specific to the EXTENSIONS datatype. Returns protobuf 149 // Getter specific to the EXTENSIONS datatype. Returns protobuf
148 // data. Can only be called if GetModelType() == EXTENSIONS. 150 // data. Can only be called if GetModelType() == EXTENSIONS.
149 const sync_pb::ExtensionSpecifics& GetExtensionSpecifics() const; 151 const sync_pb::ExtensionSpecifics& GetExtensionSpecifics() const;
150 152
151 // Getter specific to the SESSIONS datatype. Returns protobuf 153 // Getter specific to the SESSIONS datatype. Returns protobuf
152 // data. Can only be called if GetModelType() == SESSIONS. 154 // data. Can only be called if GetModelType() == SESSIONS.
153 const sync_pb::SessionSpecifics& GetSessionSpecifics() const; 155 SYNC_EXPORT const sync_pb::SessionSpecifics& GetSessionSpecifics() const;
154 156
155 // Getter specific to the DEVICE_INFO datatype. Returns protobuf 157 // Getter specific to the DEVICE_INFO datatype. Returns protobuf
156 // data. Can only be called if GetModelType() == DEVICE_INFO. 158 // data. Can only be called if GetModelType() == DEVICE_INFO.
157 const sync_pb::DeviceInfoSpecifics& GetDeviceInfoSpecifics() const; 159 SYNC_EXPORT const sync_pb::DeviceInfoSpecifics&
160 GetDeviceInfoSpecifics() const;
158 161
159 // Getter specific to the EXPERIMENTS datatype. Returns protobuf 162 // Getter specific to the EXPERIMENTS datatype. Returns protobuf
160 // data. Can only be called if GetModelType() == EXPERIMENTS. 163 // data. Can only be called if GetModelType() == EXPERIMENTS.
161 const sync_pb::ExperimentsSpecifics& GetExperimentsSpecifics() const; 164 const sync_pb::ExperimentsSpecifics& GetExperimentsSpecifics() const;
162 165
163 const sync_pb::EntitySpecifics& GetEntitySpecifics() const; 166 SYNC_EXPORT const sync_pb::EntitySpecifics& GetEntitySpecifics() const;
164 167
165 // Returns the local external ID associated with the node. 168 // Returns the local external ID associated with the node.
166 int64 GetExternalId() const; 169 SYNC_EXPORT int64 GetExternalId() const;
167 170
168 // Returns true iff this node has children. 171 // Returns true iff this node has children.
169 bool HasChildren() const; 172 SYNC_EXPORT bool HasChildren() const;
170 173
171 // Return the ID of the node immediately before this in the sibling order. 174 // Return the ID of the node immediately before this in the sibling order.
172 // For the first node in the ordering, return 0. 175 // For the first node in the ordering, return 0.
173 int64 GetPredecessorId() const; 176 SYNC_EXPORT int64 GetPredecessorId() const;
174 177
175 // Return the ID of the node immediately after this in the sibling order. 178 // Return the ID of the node immediately after this in the sibling order.
176 // For the last node in the ordering, return 0. 179 // For the last node in the ordering, return 0.
177 int64 GetSuccessorId() const; 180 SYNC_EXPORT int64 GetSuccessorId() const;
178 181
179 // Return the ID of the first child of this node. If this node has no 182 // Return the ID of the first child of this node. If this node has no
180 // children, return 0. 183 // children, return 0.
181 int64 GetFirstChildId() const; 184 SYNC_EXPORT int64 GetFirstChildId() const;
182 185
183 // Returns the total number of nodes including and beneath this node. 186 // Returns the total number of nodes including and beneath this node.
184 // Recursively iterates through all children. 187 // Recursively iterates through all children.
185 int GetTotalNodeCount() const; 188 SYNC_EXPORT int GetTotalNodeCount() const;
186 189
187 // These virtual accessors provide access to data members of derived classes. 190 // These virtual accessors provide access to data members of derived classes.
188 virtual const syncable::Entry* GetEntry() const = 0; 191 virtual const syncable::Entry* GetEntry() const = 0;
189 virtual const BaseTransaction* GetTransaction() const = 0; 192 virtual const BaseTransaction* GetTransaction() const = 0;
190 193
191 // Dumps a summary of node info into a DictionaryValue and returns it. 194 // Dumps a summary of node info into a DictionaryValue and returns it.
192 // Transfers ownership of the DictionaryValue to the caller. 195 // Transfers ownership of the DictionaryValue to the caller.
193 base::DictionaryValue* GetSummaryAsValue() const; 196 base::DictionaryValue* GetSummaryAsValue() const;
194 197
195 // Dumps all node details into a DictionaryValue and returns it. 198 // Dumps all node details into a DictionaryValue and returns it.
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
246 249
247 // Same as |unencrypted_data_|, but for legacy password encryption. 250 // Same as |unencrypted_data_|, but for legacy password encryption.
248 scoped_ptr<sync_pb::PasswordSpecificsData> password_data_; 251 scoped_ptr<sync_pb::PasswordSpecificsData> password_data_;
249 252
250 DISALLOW_COPY_AND_ASSIGN(BaseNode); 253 DISALLOW_COPY_AND_ASSIGN(BaseNode);
251 }; 254 };
252 255
253 } // namespace syncer 256 } // namespace syncer
254 257
255 #endif // SYNC_INTERNAL_API_PUBLIC_BASE_NODE_H_ 258 #endif // SYNC_INTERNAL_API_PUBLIC_BASE_NODE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698