| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 class MutableEntry; | 72 class MutableEntry; |
| 73 class ReadTransaction; | 73 class ReadTransaction; |
| 74 class ScopedDirLookup; | 74 class ScopedDirLookup; |
| 75 class WriteTransaction; | 75 class WriteTransaction; |
| 76 } | 76 } |
| 77 | 77 |
| 78 namespace sync_pb { | 78 namespace sync_pb { |
| 79 class AutofillSpecifics; | 79 class AutofillSpecifics; |
| 80 class BookmarkSpecifics; | 80 class BookmarkSpecifics; |
| 81 class EntitySpecifics; | 81 class EntitySpecifics; |
| 82 class ExtensionSpecifics; |
| 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; |
| 87 class TypedUrlSpecifics; | 88 class TypedUrlSpecifics; |
| 88 } | 89 } |
| 89 | 90 |
| 90 namespace sync_api { | 91 namespace sync_api { |
| 91 | 92 |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 188 const sync_pb::PreferenceSpecifics& GetPreferenceSpecifics() const; | 189 const sync_pb::PreferenceSpecifics& GetPreferenceSpecifics() const; |
| 189 | 190 |
| 190 // Getter specific to the THEME datatype. Returns protobuf | 191 // Getter specific to the THEME datatype. Returns protobuf |
| 191 // data. Can only be called if GetModelType() == THEME. | 192 // data. Can only be called if GetModelType() == THEME. |
| 192 const sync_pb::ThemeSpecifics& GetThemeSpecifics() const; | 193 const sync_pb::ThemeSpecifics& GetThemeSpecifics() const; |
| 193 | 194 |
| 194 // Getter specific to the TYPED_URLS datatype. Returns protobuf | 195 // Getter specific to the TYPED_URLS datatype. Returns protobuf |
| 195 // data. Can only be called if GetModelType() == TYPED_URLS. | 196 // data. Can only be called if GetModelType() == TYPED_URLS. |
| 196 const sync_pb::TypedUrlSpecifics& GetTypedUrlSpecifics() const; | 197 const sync_pb::TypedUrlSpecifics& GetTypedUrlSpecifics() const; |
| 197 | 198 |
| 199 // Getter specific to the EXTENSIONS datatype. Returns protobuf |
| 200 // data. Can only be called if GetModelType() == EXTENSIONS. |
| 201 const sync_pb::ExtensionSpecifics& GetExtensionSpecifics() const; |
| 202 |
| 198 // Returns the local external ID associated with the node. | 203 // Returns the local external ID associated with the node. |
| 199 int64 GetExternalId() const; | 204 int64 GetExternalId() const; |
| 200 | 205 |
| 201 // Return the ID of the node immediately before this in the sibling order. | 206 // Return the ID of the node immediately before this in the sibling order. |
| 202 // For the first node in the ordering, return 0. | 207 // For the first node in the ordering, return 0. |
| 203 int64 GetPredecessorId() const; | 208 int64 GetPredecessorId() const; |
| 204 | 209 |
| 205 // Return the ID of the node immediately after this in the sibling order. | 210 // Return the ID of the node immediately after this in the sibling order. |
| 206 // For the last node in the ordering, return 0. | 211 // For the last node in the ordering, return 0. |
| 207 int64 GetSuccessorId() const; | 212 int64 GetSuccessorId() const; |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 307 void SetPreferenceSpecifics(const sync_pb::PreferenceSpecifics& specifics); | 312 void SetPreferenceSpecifics(const sync_pb::PreferenceSpecifics& specifics); |
| 308 | 313 |
| 309 // Set the theme specifics (name and value). | 314 // Set the theme specifics (name and value). |
| 310 // Should only be called if GetModelType() == THEME. | 315 // Should only be called if GetModelType() == THEME. |
| 311 void SetThemeSpecifics(const sync_pb::ThemeSpecifics& specifics); | 316 void SetThemeSpecifics(const sync_pb::ThemeSpecifics& specifics); |
| 312 | 317 |
| 313 // Set the typed_url specifics (url, title, typed_count, etc). | 318 // Set the typed_url specifics (url, title, typed_count, etc). |
| 314 // Should only be called if GetModelType() == TYPED_URLS. | 319 // Should only be called if GetModelType() == TYPED_URLS. |
| 315 void SetTypedUrlSpecifics(const sync_pb::TypedUrlSpecifics& specifics); | 320 void SetTypedUrlSpecifics(const sync_pb::TypedUrlSpecifics& specifics); |
| 316 | 321 |
| 322 // Set the extension specifics (id, update url, enabled state, etc). |
| 323 // Should only be called if GetModelType() == EXTENSIONS. |
| 324 void SetExtensionSpecifics(const sync_pb::ExtensionSpecifics& specifics); |
| 325 |
| 317 // Implementation of BaseNode's abstract virtual accessors. | 326 // Implementation of BaseNode's abstract virtual accessors. |
| 318 virtual const syncable::Entry* GetEntry() const; | 327 virtual const syncable::Entry* GetEntry() const; |
| 319 | 328 |
| 320 virtual const BaseTransaction* GetTransaction() const; | 329 virtual const BaseTransaction* GetTransaction() const; |
| 321 | 330 |
| 322 private: | 331 private: |
| 323 void* operator new(size_t size); // Node is meant for stack use only. | 332 void* operator new(size_t size); // Node is meant for stack use only. |
| 324 | 333 |
| 325 // Helper to set model type. This will clear any specifics data. | 334 // Helper to set model type. This will clear any specifics data. |
| 326 void PutModelType(syncable::ModelType model_type); | 335 void PutModelType(syncable::ModelType model_type); |
| (...skipping 11 matching lines...) Expand all Loading... |
| 338 void PutBookmarkSpecificsAndMarkForSyncing( | 347 void PutBookmarkSpecificsAndMarkForSyncing( |
| 339 const sync_pb::BookmarkSpecifics& new_value); | 348 const sync_pb::BookmarkSpecifics& new_value); |
| 340 void PutPasswordSpecificsAndMarkForSyncing( | 349 void PutPasswordSpecificsAndMarkForSyncing( |
| 341 const sync_pb::PasswordSpecifics& new_value); | 350 const sync_pb::PasswordSpecifics& new_value); |
| 342 void PutPreferenceSpecificsAndMarkForSyncing( | 351 void PutPreferenceSpecificsAndMarkForSyncing( |
| 343 const sync_pb::PreferenceSpecifics& new_value); | 352 const sync_pb::PreferenceSpecifics& new_value); |
| 344 void PutThemeSpecificsAndMarkForSyncing( | 353 void PutThemeSpecificsAndMarkForSyncing( |
| 345 const sync_pb::ThemeSpecifics& new_value); | 354 const sync_pb::ThemeSpecifics& new_value); |
| 346 void PutTypedUrlSpecificsAndMarkForSyncing( | 355 void PutTypedUrlSpecificsAndMarkForSyncing( |
| 347 const sync_pb::TypedUrlSpecifics& new_value); | 356 const sync_pb::TypedUrlSpecifics& new_value); |
| 357 void PutExtensionSpecificsAndMarkForSyncing( |
| 358 const sync_pb::ExtensionSpecifics& new_value); |
| 348 void PutSpecificsAndMarkForSyncing( | 359 void PutSpecificsAndMarkForSyncing( |
| 349 const sync_pb::EntitySpecifics& specifics); | 360 const sync_pb::EntitySpecifics& specifics); |
| 350 | 361 |
| 351 // Sets IS_UNSYNCED and SYNCING to ensure this entry is considered in an | 362 // Sets IS_UNSYNCED and SYNCING to ensure this entry is considered in an |
| 352 // upcoming commit pass. | 363 // upcoming commit pass. |
| 353 void MarkForSyncing(); | 364 void MarkForSyncing(); |
| 354 | 365 |
| 355 // The underlying syncable object which this class wraps. | 366 // The underlying syncable object which this class wraps. |
| 356 syncable::MutableEntry* entry_; | 367 syncable::MutableEntry* entry_; |
| 357 | 368 |
| (...skipping 487 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 845 // This allows actual HttpPostProvider subclass implementations to be | 856 // This allows actual HttpPostProvider subclass implementations to be |
| 846 // reference counted, which is useful if a particular implementation uses | 857 // reference counted, which is useful if a particular implementation uses |
| 847 // multiple threads to serve network requests. | 858 // multiple threads to serve network requests. |
| 848 virtual void Destroy(HttpPostProviderInterface* http) = 0; | 859 virtual void Destroy(HttpPostProviderInterface* http) = 0; |
| 849 virtual ~HttpPostProviderFactory() { } | 860 virtual ~HttpPostProviderFactory() { } |
| 850 }; | 861 }; |
| 851 | 862 |
| 852 } // namespace sync_api | 863 } // namespace sync_api |
| 853 | 864 |
| 854 #endif // CHROME_BROWSER_SYNC_ENGINE_SYNCAPI_H_ | 865 #endif // CHROME_BROWSER_SYNC_ENGINE_SYNCAPI_H_ |
| OLD | NEW |