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 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 AppSpecifics; |
78 class AutofillSpecifics; | 78 class AutofillSpecifics; |
79 class BookmarkSpecifics; | 79 class BookmarkSpecifics; |
80 class EntitySpecifics; | 80 class EntitySpecifics; |
81 class ExtensionSpecifics; | 81 class ExtensionSpecifics; |
82 class SessionSpecifics; | |
83 class NigoriSpecifics; | 82 class NigoriSpecifics; |
84 class PasswordSpecifics; | 83 class PasswordSpecifics; |
85 class PreferenceSpecifics; | 84 class PreferenceSpecifics; |
86 class PasswordSpecifics; | 85 class PasswordSpecifics; |
87 class PasswordSpecificsData; | 86 class PasswordSpecificsData; |
88 class ThemeSpecifics; | 87 class ThemeSpecifics; |
89 class TypedUrlSpecifics; | 88 class TypedUrlSpecifics; |
90 } | 89 } |
91 | 90 |
92 namespace sync_api { | 91 namespace sync_api { |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
202 const sync_pb::ThemeSpecifics& GetThemeSpecifics() const; | 201 const sync_pb::ThemeSpecifics& GetThemeSpecifics() const; |
203 | 202 |
204 // Getter specific to the TYPED_URLS datatype. Returns protobuf | 203 // Getter specific to the TYPED_URLS datatype. Returns protobuf |
205 // data. Can only be called if GetModelType() == TYPED_URLS. | 204 // data. Can only be called if GetModelType() == TYPED_URLS. |
206 const sync_pb::TypedUrlSpecifics& GetTypedUrlSpecifics() const; | 205 const sync_pb::TypedUrlSpecifics& GetTypedUrlSpecifics() const; |
207 | 206 |
208 // Getter specific to the EXTENSIONS datatype. Returns protobuf | 207 // Getter specific to the EXTENSIONS datatype. Returns protobuf |
209 // data. Can only be called if GetModelType() == EXTENSIONS. | 208 // data. Can only be called if GetModelType() == EXTENSIONS. |
210 const sync_pb::ExtensionSpecifics& GetExtensionSpecifics() const; | 209 const sync_pb::ExtensionSpecifics& GetExtensionSpecifics() const; |
211 | 210 |
212 // Getter specific to the SESSIONS datatype. Returns protobuf | |
213 // data. Can only be called if GetModelType() == SESSIONS. | |
214 const sync_pb::SessionSpecifics& GetSessionSpecifics() const; | |
215 | |
216 // Returns the local external ID associated with the node. | 211 // Returns the local external ID associated with the node. |
217 int64 GetExternalId() const; | 212 int64 GetExternalId() const; |
218 | 213 |
219 // Return the ID of the node immediately before this in the sibling order. | 214 // Return the ID of the node immediately before this in the sibling order. |
220 // For the first node in the ordering, return 0. | 215 // For the first node in the ordering, return 0. |
221 int64 GetPredecessorId() const; | 216 int64 GetPredecessorId() const; |
222 | 217 |
223 // Return the ID of the node immediately after this in the sibling order. | 218 // Return the ID of the node immediately after this in the sibling order. |
224 // For the last node in the ordering, return 0. | 219 // For the last node in the ordering, return 0. |
225 int64 GetSuccessorId() const; | 220 int64 GetSuccessorId() const; |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
351 void SetThemeSpecifics(const sync_pb::ThemeSpecifics& specifics); | 346 void SetThemeSpecifics(const sync_pb::ThemeSpecifics& specifics); |
352 | 347 |
353 // Set the typed_url specifics (url, title, typed_count, etc). | 348 // Set the typed_url specifics (url, title, typed_count, etc). |
354 // Should only be called if GetModelType() == TYPED_URLS. | 349 // Should only be called if GetModelType() == TYPED_URLS. |
355 void SetTypedUrlSpecifics(const sync_pb::TypedUrlSpecifics& specifics); | 350 void SetTypedUrlSpecifics(const sync_pb::TypedUrlSpecifics& specifics); |
356 | 351 |
357 // Set the extension specifics (id, update url, enabled state, etc). | 352 // Set the extension specifics (id, update url, enabled state, etc). |
358 // Should only be called if GetModelType() == EXTENSIONS. | 353 // Should only be called if GetModelType() == EXTENSIONS. |
359 void SetExtensionSpecifics(const sync_pb::ExtensionSpecifics& specifics); | 354 void SetExtensionSpecifics(const sync_pb::ExtensionSpecifics& specifics); |
360 | 355 |
361 // Set the session specifics (windows, tabs, navigations etc.). | |
362 // Should only be called if GetModelType() == SESSIONS. | |
363 void SetSessionSpecifics(const sync_pb::SessionSpecifics& specifics); | |
364 | |
365 // Implementation of BaseNode's abstract virtual accessors. | 356 // Implementation of BaseNode's abstract virtual accessors. |
366 virtual const syncable::Entry* GetEntry() const; | 357 virtual const syncable::Entry* GetEntry() const; |
367 | 358 |
368 virtual const BaseTransaction* GetTransaction() const; | 359 virtual const BaseTransaction* GetTransaction() const; |
369 | 360 |
370 private: | 361 private: |
371 void* operator new(size_t size); // Node is meant for stack use only. | 362 void* operator new(size_t size); // Node is meant for stack use only. |
372 | 363 |
373 // Helper to set model type. This will clear any specifics data. | 364 // Helper to set model type. This will clear any specifics data. |
374 void PutModelType(syncable::ModelType model_type); | 365 void PutModelType(syncable::ModelType model_type); |
(...skipping 17 matching lines...) Expand all Loading... |
392 void PutPasswordSpecificsAndMarkForSyncing( | 383 void PutPasswordSpecificsAndMarkForSyncing( |
393 const sync_pb::PasswordSpecifics& new_value); | 384 const sync_pb::PasswordSpecifics& new_value); |
394 void PutPreferenceSpecificsAndMarkForSyncing( | 385 void PutPreferenceSpecificsAndMarkForSyncing( |
395 const sync_pb::PreferenceSpecifics& new_value); | 386 const sync_pb::PreferenceSpecifics& new_value); |
396 void PutThemeSpecificsAndMarkForSyncing( | 387 void PutThemeSpecificsAndMarkForSyncing( |
397 const sync_pb::ThemeSpecifics& new_value); | 388 const sync_pb::ThemeSpecifics& new_value); |
398 void PutTypedUrlSpecificsAndMarkForSyncing( | 389 void PutTypedUrlSpecificsAndMarkForSyncing( |
399 const sync_pb::TypedUrlSpecifics& new_value); | 390 const sync_pb::TypedUrlSpecifics& new_value); |
400 void PutExtensionSpecificsAndMarkForSyncing( | 391 void PutExtensionSpecificsAndMarkForSyncing( |
401 const sync_pb::ExtensionSpecifics& new_value); | 392 const sync_pb::ExtensionSpecifics& new_value); |
402 void PutSessionSpecificsAndMarkForSyncing( | |
403 const sync_pb::SessionSpecifics& new_value); | |
404 void PutSpecificsAndMarkForSyncing( | 393 void PutSpecificsAndMarkForSyncing( |
405 const sync_pb::EntitySpecifics& specifics); | 394 const sync_pb::EntitySpecifics& specifics); |
406 | 395 |
407 // Sets IS_UNSYNCED and SYNCING to ensure this entry is considered in an | 396 // Sets IS_UNSYNCED and SYNCING to ensure this entry is considered in an |
408 // upcoming commit pass. | 397 // upcoming commit pass. |
409 void MarkForSyncing(); | 398 void MarkForSyncing(); |
410 | 399 |
411 // The underlying syncable object which this class wraps. | 400 // The underlying syncable object which this class wraps. |
412 syncable::MutableEntry* entry_; | 401 syncable::MutableEntry* entry_; |
413 | 402 |
(...skipping 510 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
924 // This allows actual HttpPostProvider subclass implementations to be | 913 // This allows actual HttpPostProvider subclass implementations to be |
925 // reference counted, which is useful if a particular implementation uses | 914 // reference counted, which is useful if a particular implementation uses |
926 // multiple threads to serve network requests. | 915 // multiple threads to serve network requests. |
927 virtual void Destroy(HttpPostProviderInterface* http) = 0; | 916 virtual void Destroy(HttpPostProviderInterface* http) = 0; |
928 virtual ~HttpPostProviderFactory() { } | 917 virtual ~HttpPostProviderFactory() { } |
929 }; | 918 }; |
930 | 919 |
931 } // namespace sync_api | 920 } // namespace sync_api |
932 | 921 |
933 #endif // CHROME_BROWSER_SYNC_ENGINE_SYNCAPI_H_ | 922 #endif // CHROME_BROWSER_SYNC_ENGINE_SYNCAPI_H_ |
OLD | NEW |