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