OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 // This file defines the "sync API", an interface to the syncer | 5 // This file defines the "sync API", an interface to the syncer |
6 // backend that exposes (1) the core functionality of maintaining a consistent | 6 // backend that exposes (1) the core functionality of maintaining a consistent |
7 // local snapshot of a hierarchical object set; (2) a means to transactionally | 7 // local snapshot of a hierarchical object set; (2) a means to transactionally |
8 // access and modify those objects; (3) a means to control client/server | 8 // access and modify those objects; (3) a means to control client/server |
9 // synchronization tasks, namely: pushing local object modifications to a | 9 // synchronization tasks, namely: pushing local object modifications to a |
10 // server, pulling nonlocal object modifications from a server to this client, | 10 // server, pulling nonlocal object modifications from a server to this client, |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
67 class BaseTransaction; | 67 class BaseTransaction; |
68 class DirectoryManager; | 68 class DirectoryManager; |
69 class Entry; | 69 class Entry; |
70 class MutableEntry; | 70 class MutableEntry; |
71 class ReadTransaction; | 71 class ReadTransaction; |
72 class ScopedDirLookup; | 72 class ScopedDirLookup; |
73 class WriteTransaction; | 73 class WriteTransaction; |
74 } | 74 } |
75 | 75 |
76 namespace sync_pb { | 76 namespace sync_pb { |
| 77 class AppSpecifics; |
77 class AutofillSpecifics; | 78 class AutofillSpecifics; |
78 class BookmarkSpecifics; | 79 class BookmarkSpecifics; |
79 class EntitySpecifics; | 80 class EntitySpecifics; |
80 class ExtensionSpecifics; | 81 class ExtensionSpecifics; |
81 class NigoriSpecifics; | 82 class NigoriSpecifics; |
82 class PasswordSpecifics; | 83 class PasswordSpecifics; |
83 class PreferenceSpecifics; | 84 class PreferenceSpecifics; |
84 class PasswordSpecifics; | 85 class PasswordSpecifics; |
85 class PasswordSpecificsData; | 86 class PasswordSpecificsData; |
86 class ThemeSpecifics; | 87 class ThemeSpecifics; |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
168 | 169 |
169 // Legacy, bookmark-specific getter that wraps GetBookmarkSpecifics() above. | 170 // Legacy, bookmark-specific getter that wraps GetBookmarkSpecifics() above. |
170 // Fill in a vector with the byte data of this node's favicon. Assumes | 171 // Fill in a vector with the byte data of this node's favicon. Assumes |
171 // that the node is a bookmark. | 172 // that the node is a bookmark. |
172 // Favicons are expected to be PNG images, and though no verification is | 173 // Favicons are expected to be PNG images, and though no verification is |
173 // done on the syncapi client of this, the server may reject favicon updates | 174 // done on the syncapi client of this, the server may reject favicon updates |
174 // that are invalid for whatever reason. | 175 // that are invalid for whatever reason. |
175 // TODO(ncarter): Remove this datatype-specific accessor. | 176 // TODO(ncarter): Remove this datatype-specific accessor. |
176 void GetFaviconBytes(std::vector<unsigned char>* output) const; | 177 void GetFaviconBytes(std::vector<unsigned char>* output) const; |
177 | 178 |
| 179 // Getter specific to the APPS datatype. Returns protobuf |
| 180 // data. Can only be called if GetModelType() == APPS. |
| 181 const sync_pb::AppSpecifics& GetAppSpecifics() const; |
| 182 |
178 // Getter specific to the AUTOFILL datatype. Returns protobuf | 183 // Getter specific to the AUTOFILL datatype. Returns protobuf |
179 // data. Can only be called if GetModelType() == AUTOFILL. | 184 // data. Can only be called if GetModelType() == AUTOFILL. |
180 const sync_pb::AutofillSpecifics& GetAutofillSpecifics() const; | 185 const sync_pb::AutofillSpecifics& GetAutofillSpecifics() const; |
181 | 186 |
182 // Getter specific to the NIGORI datatype. Returns protobuf | 187 // Getter specific to the NIGORI datatype. Returns protobuf |
183 // data. Can only be called if GetModelType() == NIGORI. | 188 // data. Can only be called if GetModelType() == NIGORI. |
184 const sync_pb::NigoriSpecifics& GetNigoriSpecifics() const; | 189 const sync_pb::NigoriSpecifics& GetNigoriSpecifics() const; |
185 | 190 |
186 // Getter specific to the PASSWORD datatype. Returns protobuf | 191 // Getter specific to the PASSWORD datatype. Returns protobuf |
187 // data. Can only be called if GetModelType() == PASSWORD. | 192 // data. Can only be called if GetModelType() == PASSWORD. |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
309 // Set the bookmark specifics (url and favicon). | 314 // Set the bookmark specifics (url and favicon). |
310 // Should only be called if GetModelType() == BOOKMARK. | 315 // Should only be called if GetModelType() == BOOKMARK. |
311 void SetBookmarkSpecifics(const sync_pb::BookmarkSpecifics& specifics); | 316 void SetBookmarkSpecifics(const sync_pb::BookmarkSpecifics& specifics); |
312 | 317 |
313 // Legacy, bookmark-specific setters that wrap SetBookmarkSpecifics() above. | 318 // Legacy, bookmark-specific setters that wrap SetBookmarkSpecifics() above. |
314 // Should only be called if GetModelType() == BOOKMARK. | 319 // Should only be called if GetModelType() == BOOKMARK. |
315 // TODO(ncarter): Remove these two datatype-specific accessors. | 320 // TODO(ncarter): Remove these two datatype-specific accessors. |
316 void SetURL(const GURL& url); | 321 void SetURL(const GURL& url); |
317 void SetFaviconBytes(const std::vector<unsigned char>& bytes); | 322 void SetFaviconBytes(const std::vector<unsigned char>& bytes); |
318 | 323 |
| 324 // Set the app specifics (id, update url, enabled state, etc). |
| 325 // Should only be called if GetModelType() == APPS. |
| 326 void SetAppSpecifics(const sync_pb::AppSpecifics& specifics); |
| 327 |
319 // Set the autofill specifics (name and value). | 328 // Set the autofill specifics (name and value). |
320 // Should only be called if GetModelType() == AUTOFILL. | 329 // Should only be called if GetModelType() == AUTOFILL. |
321 void SetAutofillSpecifics(const sync_pb::AutofillSpecifics& specifics); | 330 void SetAutofillSpecifics(const sync_pb::AutofillSpecifics& specifics); |
322 | 331 |
323 // Set the nigori specifics. | 332 // Set the nigori specifics. |
324 // Should only be called if GetModelType() == NIGORI. | 333 // Should only be called if GetModelType() == NIGORI. |
325 void SetNigoriSpecifics(const sync_pb::NigoriSpecifics& specifics); | 334 void SetNigoriSpecifics(const sync_pb::NigoriSpecifics& specifics); |
326 | 335 |
327 // Set the password specifics. | 336 // Set the password specifics. |
328 // Should only be called if GetModelType() == PASSWORD. | 337 // Should only be called if GetModelType() == PASSWORD. |
(...skipping 27 matching lines...) Expand all Loading... |
356 void PutModelType(syncable::ModelType model_type); | 365 void PutModelType(syncable::ModelType model_type); |
357 | 366 |
358 // Helper to set the previous node. | 367 // Helper to set the previous node. |
359 void PutPredecessor(const BaseNode* predecessor); | 368 void PutPredecessor(const BaseNode* predecessor); |
360 | 369 |
361 // Private helpers to set type-specific protobuf data. These don't | 370 // Private helpers to set type-specific protobuf data. These don't |
362 // do any checking on the previous modeltype, so they can be used | 371 // do any checking on the previous modeltype, so they can be used |
363 // for internal initialization (you can use them to set the modeltype). | 372 // for internal initialization (you can use them to set the modeltype). |
364 // Additionally, they will mark for syncing if the underlying value | 373 // Additionally, they will mark for syncing if the underlying value |
365 // changes. | 374 // changes. |
| 375 void PutAppSpecificsAndMarkForSyncing( |
| 376 const sync_pb::AppSpecifics& new_value); |
366 void PutAutofillSpecificsAndMarkForSyncing( | 377 void PutAutofillSpecificsAndMarkForSyncing( |
367 const sync_pb::AutofillSpecifics& new_value); | 378 const sync_pb::AutofillSpecifics& new_value); |
368 void PutBookmarkSpecificsAndMarkForSyncing( | 379 void PutBookmarkSpecificsAndMarkForSyncing( |
369 const sync_pb::BookmarkSpecifics& new_value); | 380 const sync_pb::BookmarkSpecifics& new_value); |
370 void PutNigoriSpecificsAndMarkForSyncing( | 381 void PutNigoriSpecificsAndMarkForSyncing( |
371 const sync_pb::NigoriSpecifics& new_value); | 382 const sync_pb::NigoriSpecifics& new_value); |
372 void PutPasswordSpecificsAndMarkForSyncing( | 383 void PutPasswordSpecificsAndMarkForSyncing( |
373 const sync_pb::PasswordSpecifics& new_value); | 384 const sync_pb::PasswordSpecifics& new_value); |
374 void PutPreferenceSpecificsAndMarkForSyncing( | 385 void PutPreferenceSpecificsAndMarkForSyncing( |
375 const sync_pb::PreferenceSpecifics& new_value); | 386 const sync_pb::PreferenceSpecifics& new_value); |
(...skipping 515 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
891 // This allows actual HttpPostProvider subclass implementations to be | 902 // This allows actual HttpPostProvider subclass implementations to be |
892 // reference counted, which is useful if a particular implementation uses | 903 // reference counted, which is useful if a particular implementation uses |
893 // multiple threads to serve network requests. | 904 // multiple threads to serve network requests. |
894 virtual void Destroy(HttpPostProviderInterface* http) = 0; | 905 virtual void Destroy(HttpPostProviderInterface* http) = 0; |
895 virtual ~HttpPostProviderFactory() { } | 906 virtual ~HttpPostProviderFactory() { } |
896 }; | 907 }; |
897 | 908 |
898 } // namespace sync_api | 909 } // namespace sync_api |
899 | 910 |
900 #endif // CHROME_BROWSER_SYNC_ENGINE_SYNCAPI_H_ | 911 #endif // CHROME_BROWSER_SYNC_ENGINE_SYNCAPI_H_ |
OLD | NEW |