| 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 29 matching lines...) Expand all Loading... |
| 40 #pragma once | 40 #pragma once |
| 41 | 41 |
| 42 #include <string> | 42 #include <string> |
| 43 #include <vector> | 43 #include <vector> |
| 44 | 44 |
| 45 #include "base/basictypes.h" | 45 #include "base/basictypes.h" |
| 46 #include "base/gtest_prod_util.h" | 46 #include "base/gtest_prod_util.h" |
| 47 #include "base/scoped_ptr.h" | 47 #include "base/scoped_ptr.h" |
| 48 #include "build/build_config.h" | 48 #include "build/build_config.h" |
| 49 #include "chrome/browser/sync/protocol/password_specifics.pb.h" | 49 #include "chrome/browser/sync/protocol/password_specifics.pb.h" |
| 50 #include "chrome/browser/sync/syncable/autofill_migration.h" |
| 50 #include "chrome/browser/sync/syncable/model_type.h" | 51 #include "chrome/browser/sync/syncable/model_type.h" |
| 51 #include "chrome/browser/sync/util/cryptographer.h" | 52 #include "chrome/browser/sync/util/cryptographer.h" |
| 52 #include "chrome/common/net/gaia/google_service_auth_error.h" | 53 #include "chrome/common/net/gaia/google_service_auth_error.h" |
| 53 #include "googleurl/src/gurl.h" | 54 #include "googleurl/src/gurl.h" |
| 54 | 55 |
| 55 class FilePath; | 56 class FilePath; |
| 56 | 57 |
| 57 namespace browser_sync { | 58 namespace browser_sync { |
| 58 class ModelSafeWorkerRegistrar; | 59 class ModelSafeWorkerRegistrar; |
| 59 | 60 |
| (...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 340 void SetFaviconBytes(const std::vector<unsigned char>& bytes); | 341 void SetFaviconBytes(const std::vector<unsigned char>& bytes); |
| 341 | 342 |
| 342 // Set the app specifics (id, update url, enabled state, etc). | 343 // Set the app specifics (id, update url, enabled state, etc). |
| 343 // Should only be called if GetModelType() == APPS. | 344 // Should only be called if GetModelType() == APPS. |
| 344 void SetAppSpecifics(const sync_pb::AppSpecifics& specifics); | 345 void SetAppSpecifics(const sync_pb::AppSpecifics& specifics); |
| 345 | 346 |
| 346 // Set the autofill specifics (name and value). | 347 // Set the autofill specifics (name and value). |
| 347 // Should only be called if GetModelType() == AUTOFILL. | 348 // Should only be called if GetModelType() == AUTOFILL. |
| 348 void SetAutofillSpecifics(const sync_pb::AutofillSpecifics& specifics); | 349 void SetAutofillSpecifics(const sync_pb::AutofillSpecifics& specifics); |
| 349 | 350 |
| 351 void SetAutofillProfileSpecifics( |
| 352 const sync_pb::AutofillProfileSpecifics& specifics); |
| 353 |
| 350 // Set the nigori specifics. | 354 // Set the nigori specifics. |
| 351 // Should only be called if GetModelType() == NIGORI. | 355 // Should only be called if GetModelType() == NIGORI. |
| 352 void SetNigoriSpecifics(const sync_pb::NigoriSpecifics& specifics); | 356 void SetNigoriSpecifics(const sync_pb::NigoriSpecifics& specifics); |
| 353 | 357 |
| 354 // Set the password specifics. | 358 // Set the password specifics. |
| 355 // Should only be called if GetModelType() == PASSWORD. | 359 // Should only be called if GetModelType() == PASSWORD. |
| 356 void SetPasswordSpecifics(const sync_pb::PasswordSpecificsData& specifics); | 360 void SetPasswordSpecifics(const sync_pb::PasswordSpecificsData& specifics); |
| 357 | 361 |
| 358 // Set the preference specifics (name and value). | 362 // Set the preference specifics (name and value). |
| 359 // Should only be called if GetModelType() == PREFERENCE. | 363 // Should only be called if GetModelType() == PREFERENCE. |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 391 | 395 |
| 392 // Private helpers to set type-specific protobuf data. These don't | 396 // Private helpers to set type-specific protobuf data. These don't |
| 393 // do any checking on the previous modeltype, so they can be used | 397 // do any checking on the previous modeltype, so they can be used |
| 394 // for internal initialization (you can use them to set the modeltype). | 398 // for internal initialization (you can use them to set the modeltype). |
| 395 // Additionally, they will mark for syncing if the underlying value | 399 // Additionally, they will mark for syncing if the underlying value |
| 396 // changes. | 400 // changes. |
| 397 void PutAppSpecificsAndMarkForSyncing( | 401 void PutAppSpecificsAndMarkForSyncing( |
| 398 const sync_pb::AppSpecifics& new_value); | 402 const sync_pb::AppSpecifics& new_value); |
| 399 void PutAutofillSpecificsAndMarkForSyncing( | 403 void PutAutofillSpecificsAndMarkForSyncing( |
| 400 const sync_pb::AutofillSpecifics& new_value); | 404 const sync_pb::AutofillSpecifics& new_value); |
| 405 void PutAutofillProfileSpecificsAndMarkForSyncing( |
| 406 const sync_pb::AutofillProfileSpecifics& new_value); |
| 401 void PutBookmarkSpecificsAndMarkForSyncing( | 407 void PutBookmarkSpecificsAndMarkForSyncing( |
| 402 const sync_pb::BookmarkSpecifics& new_value); | 408 const sync_pb::BookmarkSpecifics& new_value); |
| 403 void PutNigoriSpecificsAndMarkForSyncing( | 409 void PutNigoriSpecificsAndMarkForSyncing( |
| 404 const sync_pb::NigoriSpecifics& new_value); | 410 const sync_pb::NigoriSpecifics& new_value); |
| 405 void PutPasswordSpecificsAndMarkForSyncing( | 411 void PutPasswordSpecificsAndMarkForSyncing( |
| 406 const sync_pb::PasswordSpecifics& new_value); | 412 const sync_pb::PasswordSpecifics& new_value); |
| 407 void PutPreferenceSpecificsAndMarkForSyncing( | 413 void PutPreferenceSpecificsAndMarkForSyncing( |
| 408 const sync_pb::PreferenceSpecifics& new_value); | 414 const sync_pb::PreferenceSpecifics& new_value); |
| 409 void PutThemeSpecificsAndMarkForSyncing( | 415 void PutThemeSpecificsAndMarkForSyncing( |
| 410 const sync_pb::ThemeSpecifics& new_value); | 416 const sync_pb::ThemeSpecifics& new_value); |
| (...skipping 399 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 810 // Returns the username last used for a successful authentication. | 816 // Returns the username last used for a successful authentication. |
| 811 // Returns empty if there is no such username. | 817 // Returns empty if there is no such username. |
| 812 const std::string& GetAuthenticatedUsername(); | 818 const std::string& GetAuthenticatedUsername(); |
| 813 | 819 |
| 814 // Check if the database has been populated with a full "initial" download of | 820 // Check if the database has been populated with a full "initial" download of |
| 815 // sync items for each data type currently present in the routing info. | 821 // sync items for each data type currently present in the routing info. |
| 816 // Prerequisite for calling this is that OnInitializationComplete has been | 822 // Prerequisite for calling this is that OnInitializationComplete has been |
| 817 // called. | 823 // called. |
| 818 bool InitialSyncEndedForAllEnabledTypes(); | 824 bool InitialSyncEndedForAllEnabledTypes(); |
| 819 | 825 |
| 826 syncable::AutofillMigrationState GetAutofillMigrationState(); |
| 827 |
| 828 void SetAutofillMigrationState( |
| 829 syncable::AutofillMigrationState state); |
| 830 |
| 831 syncable::AutofillMigrationDebugInfo GetAutofillMigrationDebugInfo(); |
| 832 |
| 833 void SetAutofillMigrationDebugInfo( |
| 834 syncable::AutofillMigrationDebugInfo::PropertyToSet property_to_set, |
| 835 const syncable::AutofillMigrationDebugInfo& info); |
| 836 |
| 820 // Migrate tokens from user settings DB to the token service. | 837 // Migrate tokens from user settings DB to the token service. |
| 821 void MigrateTokens(); | 838 void MigrateTokens(); |
| 822 | 839 |
| 823 // Update tokens that we're using in Sync. Email must stay the same. | 840 // Update tokens that we're using in Sync. Email must stay the same. |
| 824 void UpdateCredentials(const SyncCredentials& credentials); | 841 void UpdateCredentials(const SyncCredentials& credentials); |
| 825 | 842 |
| 826 // Start the SyncerThread. | 843 // Start the SyncerThread. |
| 827 void StartSyncing(); | 844 void StartSyncing(); |
| 828 | 845 |
| 829 // Attempt to set the passphrase. If the passphrase is valid, | 846 // Attempt to set the passphrase. If the passphrase is valid, |
| (...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 968 // This allows actual HttpPostProvider subclass implementations to be | 985 // This allows actual HttpPostProvider subclass implementations to be |
| 969 // reference counted, which is useful if a particular implementation uses | 986 // reference counted, which is useful if a particular implementation uses |
| 970 // multiple threads to serve network requests. | 987 // multiple threads to serve network requests. |
| 971 virtual void Destroy(HttpPostProviderInterface* http) = 0; | 988 virtual void Destroy(HttpPostProviderInterface* http) = 0; |
| 972 virtual ~HttpPostProviderFactory() { } | 989 virtual ~HttpPostProviderFactory() { } |
| 973 }; | 990 }; |
| 974 | 991 |
| 975 } // namespace sync_api | 992 } // namespace sync_api |
| 976 | 993 |
| 977 #endif // CHROME_BROWSER_SYNC_ENGINE_SYNCAPI_H_ | 994 #endif // CHROME_BROWSER_SYNC_ENGINE_SYNCAPI_H_ |
| OLD | NEW |