| 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 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 ExtensionSpecifics; |
| 83 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 { |
| 93 | 92 |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 174 // 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 |
| 175 // 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 |
| 176 // that are invalid for whatever reason. | 175 // that are invalid for whatever reason. |
| 177 // TODO(ncarter): Remove this datatype-specific accessor. | 176 // TODO(ncarter): Remove this datatype-specific accessor. |
| 178 void GetFaviconBytes(std::vector<unsigned char>* output) const; | 177 void GetFaviconBytes(std::vector<unsigned char>* output) const; |
| 179 | 178 |
| 180 // Getter specific to the AUTOFILL datatype. Returns protobuf | 179 // Getter specific to the AUTOFILL datatype. Returns protobuf |
| 181 // data. Can only be called if GetModelType() == AUTOFILL. | 180 // data. Can only be called if GetModelType() == AUTOFILL. |
| 182 const sync_pb::AutofillSpecifics& GetAutofillSpecifics() const; | 181 const sync_pb::AutofillSpecifics& GetAutofillSpecifics() const; |
| 183 | 182 |
| 184 // Getter specific to the NIGORI datatype. Returns protobuf | |
| 185 // data. Can only be called if GetModelType() == NIGORI. | |
| 186 const sync_pb::NigoriSpecifics& GetNigoriSpecifics() const; | |
| 187 | |
| 188 // Getter specific to the PASSWORD datatype. Returns protobuf | 183 // Getter specific to the PASSWORD datatype. Returns protobuf |
| 189 // data. Can only be called if GetModelType() == PASSWORD. | 184 // data. Can only be called if GetModelType() == PASSWORD. |
| 190 bool GetPasswordSpecifics(sync_pb::PasswordSpecificsData*) const; | 185 bool GetPasswordSpecifics(sync_pb::PasswordSpecificsData*) const; |
| 191 | 186 |
| 192 // Getter specific to the PREFERENCE datatype. Returns protobuf | 187 // Getter specific to the PREFERENCE datatype. Returns protobuf |
| 193 // data. Can only be called if GetModelType() == PREFERENCE. | 188 // data. Can only be called if GetModelType() == PREFERENCE. |
| 194 const sync_pb::PreferenceSpecifics& GetPreferenceSpecifics() const; | 189 const sync_pb::PreferenceSpecifics& GetPreferenceSpecifics() const; |
| 195 | 190 |
| 196 // Getter specific to the THEME datatype. Returns protobuf | 191 // Getter specific to the THEME datatype. Returns protobuf |
| 197 // data. Can only be called if GetModelType() == THEME. | 192 // data. Can only be called if GetModelType() == THEME. |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 301 // Legacy, bookmark-specific setters that wrap SetBookmarkSpecifics() above. | 296 // Legacy, bookmark-specific setters that wrap SetBookmarkSpecifics() above. |
| 302 // Should only be called if GetModelType() == BOOKMARK. | 297 // Should only be called if GetModelType() == BOOKMARK. |
| 303 // TODO(ncarter): Remove these two datatype-specific accessors. | 298 // TODO(ncarter): Remove these two datatype-specific accessors. |
| 304 void SetURL(const GURL& url); | 299 void SetURL(const GURL& url); |
| 305 void SetFaviconBytes(const std::vector<unsigned char>& bytes); | 300 void SetFaviconBytes(const std::vector<unsigned char>& bytes); |
| 306 | 301 |
| 307 // Set the autofill specifics (name and value). | 302 // Set the autofill specifics (name and value). |
| 308 // Should only be called if GetModelType() == AUTOFILL. | 303 // Should only be called if GetModelType() == AUTOFILL. |
| 309 void SetAutofillSpecifics(const sync_pb::AutofillSpecifics& specifics); | 304 void SetAutofillSpecifics(const sync_pb::AutofillSpecifics& specifics); |
| 310 | 305 |
| 311 // Set the nigori specifics. | |
| 312 // Should only be called if GetModelType() == NIGORI. | |
| 313 void SetNigoriSpecifics(const sync_pb::NigoriSpecifics& specifics); | |
| 314 | |
| 315 // Set the password specifics. | 306 // Set the password specifics. |
| 316 // Should only be called if GetModelType() == PASSWORD. | 307 // Should only be called if GetModelType() == PASSWORD. |
| 317 void SetPasswordSpecifics(const sync_pb::PasswordSpecificsData& specifics); | 308 void SetPasswordSpecifics(const sync_pb::PasswordSpecificsData& specifics); |
| 318 | 309 |
| 319 // Set the preference specifics (name and value). | 310 // Set the preference specifics (name and value). |
| 320 // Should only be called if GetModelType() == PREFERENCE. | 311 // Should only be called if GetModelType() == PREFERENCE. |
| 321 void SetPreferenceSpecifics(const sync_pb::PreferenceSpecifics& specifics); | 312 void SetPreferenceSpecifics(const sync_pb::PreferenceSpecifics& specifics); |
| 322 | 313 |
| 323 // Set the theme specifics (name and value). | 314 // Set the theme specifics (name and value). |
| 324 // Should only be called if GetModelType() == THEME. | 315 // Should only be called if GetModelType() == THEME. |
| (...skipping 23 matching lines...) Expand all Loading... |
| 348 | 339 |
| 349 // Private helpers to set type-specific protobuf data. These don't | 340 // Private helpers to set type-specific protobuf data. These don't |
| 350 // do any checking on the previous modeltype, so they can be used | 341 // do any checking on the previous modeltype, so they can be used |
| 351 // for internal initialization (you can use them to set the modeltype). | 342 // for internal initialization (you can use them to set the modeltype). |
| 352 // Additionally, they will mark for syncing if the underlying value | 343 // Additionally, they will mark for syncing if the underlying value |
| 353 // changes. | 344 // changes. |
| 354 void PutAutofillSpecificsAndMarkForSyncing( | 345 void PutAutofillSpecificsAndMarkForSyncing( |
| 355 const sync_pb::AutofillSpecifics& new_value); | 346 const sync_pb::AutofillSpecifics& new_value); |
| 356 void PutBookmarkSpecificsAndMarkForSyncing( | 347 void PutBookmarkSpecificsAndMarkForSyncing( |
| 357 const sync_pb::BookmarkSpecifics& new_value); | 348 const sync_pb::BookmarkSpecifics& new_value); |
| 358 void PutNigoriSpecificsAndMarkForSyncing( | |
| 359 const sync_pb::NigoriSpecifics& new_value); | |
| 360 void PutPasswordSpecificsAndMarkForSyncing( | 349 void PutPasswordSpecificsAndMarkForSyncing( |
| 361 const sync_pb::PasswordSpecifics& new_value); | 350 const sync_pb::PasswordSpecifics& new_value); |
| 362 void PutPreferenceSpecificsAndMarkForSyncing( | 351 void PutPreferenceSpecificsAndMarkForSyncing( |
| 363 const sync_pb::PreferenceSpecifics& new_value); | 352 const sync_pb::PreferenceSpecifics& new_value); |
| 364 void PutThemeSpecificsAndMarkForSyncing( | 353 void PutThemeSpecificsAndMarkForSyncing( |
| 365 const sync_pb::ThemeSpecifics& new_value); | 354 const sync_pb::ThemeSpecifics& new_value); |
| 366 void PutTypedUrlSpecificsAndMarkForSyncing( | 355 void PutTypedUrlSpecificsAndMarkForSyncing( |
| 367 const sync_pb::TypedUrlSpecifics& new_value); | 356 const sync_pb::TypedUrlSpecifics& new_value); |
| 368 void PutExtensionSpecificsAndMarkForSyncing( | 357 void PutExtensionSpecificsAndMarkForSyncing( |
| 369 const sync_pb::ExtensionSpecifics& new_value); | 358 const sync_pb::ExtensionSpecifics& new_value); |
| (...skipping 506 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 876 // This allows actual HttpPostProvider subclass implementations to be | 865 // This allows actual HttpPostProvider subclass implementations to be |
| 877 // reference counted, which is useful if a particular implementation uses | 866 // reference counted, which is useful if a particular implementation uses |
| 878 // multiple threads to serve network requests. | 867 // multiple threads to serve network requests. |
| 879 virtual void Destroy(HttpPostProviderInterface* http) = 0; | 868 virtual void Destroy(HttpPostProviderInterface* http) = 0; |
| 880 virtual ~HttpPostProviderFactory() { } | 869 virtual ~HttpPostProviderFactory() { } |
| 881 }; | 870 }; |
| 882 | 871 |
| 883 } // namespace sync_api | 872 } // namespace sync_api |
| 884 | 873 |
| 885 #endif // CHROME_BROWSER_SYNC_ENGINE_SYNCAPI_H_ | 874 #endif // CHROME_BROWSER_SYNC_ENGINE_SYNCAPI_H_ |
| OLD | NEW |