Chromium Code Reviews| 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 |
| 60 namespace sessions { | 61 namespace sessions { |
| 61 struct SyncSessionSnapshot; | 62 struct SyncSessionSnapshot; |
| 62 } | 63 } |
| 63 } | 64 } |
| 64 | 65 |
| 65 namespace notifier { | 66 namespace notifier { |
| 66 struct NotifierOptions; | 67 struct NotifierOptions; |
| 67 } | 68 } |
| 68 | 69 |
| 69 // Forward declarations of internal class types so that sync API objects | 70 // Forward declarations of internal class types so that sync API objects |
| 70 // may have opaque pointers to these types. | 71 // may have opaque pointers to these types. |
| 71 namespace syncable { | 72 namespace syncable { |
| 72 class BaseTransaction; | 73 class BaseTransaction; |
| 74 class Directory; | |
|
tim (not reviewing)
2010/12/13 19:24:33
dont think this is necessary
lipalani
2010/12/15 09:08:33
Done.
| |
| 73 class DirectoryManager; | 75 class DirectoryManager; |
| 74 class Entry; | 76 class Entry; |
| 75 class MutableEntry; | 77 class MutableEntry; |
| 76 class ReadTransaction; | 78 class ReadTransaction; |
| 77 class ScopedDirLookup; | 79 class ScopedDirLookup; |
| 78 class WriteTransaction; | 80 class WriteTransaction; |
| 79 } | 81 } |
| 80 | 82 |
| 81 namespace sync_pb { | 83 namespace sync_pb { |
| 82 class AppSpecifics; | 84 class AppSpecifics; |
| (...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 340 void SetFaviconBytes(const std::vector<unsigned char>& bytes); | 342 void SetFaviconBytes(const std::vector<unsigned char>& bytes); |
| 341 | 343 |
| 342 // Set the app specifics (id, update url, enabled state, etc). | 344 // Set the app specifics (id, update url, enabled state, etc). |
| 343 // Should only be called if GetModelType() == APPS. | 345 // Should only be called if GetModelType() == APPS. |
| 344 void SetAppSpecifics(const sync_pb::AppSpecifics& specifics); | 346 void SetAppSpecifics(const sync_pb::AppSpecifics& specifics); |
| 345 | 347 |
| 346 // Set the autofill specifics (name and value). | 348 // Set the autofill specifics (name and value). |
| 347 // Should only be called if GetModelType() == AUTOFILL. | 349 // Should only be called if GetModelType() == AUTOFILL. |
| 348 void SetAutofillSpecifics(const sync_pb::AutofillSpecifics& specifics); | 350 void SetAutofillSpecifics(const sync_pb::AutofillSpecifics& specifics); |
| 349 | 351 |
| 352 void SetAutofillProfileSpecifics( | |
| 353 const sync_pb::AutofillProfileSpecifics& specifics); | |
| 354 | |
| 350 // Set the nigori specifics. | 355 // Set the nigori specifics. |
| 351 // Should only be called if GetModelType() == NIGORI. | 356 // Should only be called if GetModelType() == NIGORI. |
| 352 void SetNigoriSpecifics(const sync_pb::NigoriSpecifics& specifics); | 357 void SetNigoriSpecifics(const sync_pb::NigoriSpecifics& specifics); |
| 353 | 358 |
| 354 // Set the password specifics. | 359 // Set the password specifics. |
| 355 // Should only be called if GetModelType() == PASSWORD. | 360 // Should only be called if GetModelType() == PASSWORD. |
| 356 void SetPasswordSpecifics(const sync_pb::PasswordSpecificsData& specifics); | 361 void SetPasswordSpecifics(const sync_pb::PasswordSpecificsData& specifics); |
| 357 | 362 |
| 358 // Set the preference specifics (name and value). | 363 // Set the preference specifics (name and value). |
| 359 // Should only be called if GetModelType() == PREFERENCE. | 364 // Should only be called if GetModelType() == PREFERENCE. |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 391 | 396 |
| 392 // Private helpers to set type-specific protobuf data. These don't | 397 // Private helpers to set type-specific protobuf data. These don't |
| 393 // do any checking on the previous modeltype, so they can be used | 398 // do any checking on the previous modeltype, so they can be used |
| 394 // for internal initialization (you can use them to set the modeltype). | 399 // for internal initialization (you can use them to set the modeltype). |
| 395 // Additionally, they will mark for syncing if the underlying value | 400 // Additionally, they will mark for syncing if the underlying value |
| 396 // changes. | 401 // changes. |
| 397 void PutAppSpecificsAndMarkForSyncing( | 402 void PutAppSpecificsAndMarkForSyncing( |
| 398 const sync_pb::AppSpecifics& new_value); | 403 const sync_pb::AppSpecifics& new_value); |
| 399 void PutAutofillSpecificsAndMarkForSyncing( | 404 void PutAutofillSpecificsAndMarkForSyncing( |
| 400 const sync_pb::AutofillSpecifics& new_value); | 405 const sync_pb::AutofillSpecifics& new_value); |
| 406 void PutAutofillProfileSpecificsAndMarkForSyncing( | |
| 407 const sync_pb::AutofillProfileSpecifics& new_value); | |
| 401 void PutBookmarkSpecificsAndMarkForSyncing( | 408 void PutBookmarkSpecificsAndMarkForSyncing( |
| 402 const sync_pb::BookmarkSpecifics& new_value); | 409 const sync_pb::BookmarkSpecifics& new_value); |
| 403 void PutNigoriSpecificsAndMarkForSyncing( | 410 void PutNigoriSpecificsAndMarkForSyncing( |
| 404 const sync_pb::NigoriSpecifics& new_value); | 411 const sync_pb::NigoriSpecifics& new_value); |
| 405 void PutPasswordSpecificsAndMarkForSyncing( | 412 void PutPasswordSpecificsAndMarkForSyncing( |
| 406 const sync_pb::PasswordSpecifics& new_value); | 413 const sync_pb::PasswordSpecifics& new_value); |
| 407 void PutPreferenceSpecificsAndMarkForSyncing( | 414 void PutPreferenceSpecificsAndMarkForSyncing( |
| 408 const sync_pb::PreferenceSpecifics& new_value); | 415 const sync_pb::PreferenceSpecifics& new_value); |
| 409 void PutThemeSpecificsAndMarkForSyncing( | 416 void PutThemeSpecificsAndMarkForSyncing( |
| 410 const sync_pb::ThemeSpecifics& new_value); | 417 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. | 817 // Returns the username last used for a successful authentication. |
| 811 // Returns empty if there is no such username. | 818 // Returns empty if there is no such username. |
| 812 const std::string& GetAuthenticatedUsername(); | 819 const std::string& GetAuthenticatedUsername(); |
| 813 | 820 |
| 814 // Check if the database has been populated with a full "initial" download of | 821 // 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. | 822 // sync items for each data type currently present in the routing info. |
| 816 // Prerequisite for calling this is that OnInitializationComplete has been | 823 // Prerequisite for calling this is that OnInitializationComplete has been |
| 817 // called. | 824 // called. |
| 818 bool InitialSyncEndedForAllEnabledTypes(); | 825 bool InitialSyncEndedForAllEnabledTypes(); |
| 819 | 826 |
| 827 syncable::AutofillMigrationState | |
| 828 GetAutofillMigrationState(); | |
| 829 | |
| 830 void SetAutofillMigrationState( | |
| 831 syncable::AutofillMigrationState state); | |
| 832 | |
| 833 syncable::AutofillMigrationDebugInfo | |
| 834 GetAutofillMigrationDebugInfo(); | |
| 835 | |
| 836 void SetAutofillMigrationDebugInfo( | |
| 837 syncable::AutofillMigrationDebugInfo::PropertyToSet property_to_set, | |
| 838 const syncable::AutofillMigrationDebugInfo& info); | |
| 839 | |
| 820 // Migrate tokens from user settings DB to the token service. | 840 // Migrate tokens from user settings DB to the token service. |
| 821 void MigrateTokens(); | 841 void MigrateTokens(); |
| 822 | 842 |
| 823 // Update tokens that we're using in Sync. Email must stay the same. | 843 // Update tokens that we're using in Sync. Email must stay the same. |
| 824 void UpdateCredentials(const SyncCredentials& credentials); | 844 void UpdateCredentials(const SyncCredentials& credentials); |
| 825 | 845 |
| 826 // Start the SyncerThread. | 846 // Start the SyncerThread. |
| 827 void StartSyncing(); | 847 void StartSyncing(); |
| 828 | 848 |
| 829 // Attempt to set the passphrase. If the passphrase is valid, | 849 // 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 | 988 // This allows actual HttpPostProvider subclass implementations to be |
| 969 // reference counted, which is useful if a particular implementation uses | 989 // reference counted, which is useful if a particular implementation uses |
| 970 // multiple threads to serve network requests. | 990 // multiple threads to serve network requests. |
| 971 virtual void Destroy(HttpPostProviderInterface* http) = 0; | 991 virtual void Destroy(HttpPostProviderInterface* http) = 0; |
| 972 virtual ~HttpPostProviderFactory() { } | 992 virtual ~HttpPostProviderFactory() { } |
| 973 }; | 993 }; |
| 974 | 994 |
| 975 } // namespace sync_api | 995 } // namespace sync_api |
| 976 | 996 |
| 977 #endif // CHROME_BROWSER_SYNC_ENGINE_SYNCAPI_H_ | 997 #endif // CHROME_BROWSER_SYNC_ENGINE_SYNCAPI_H_ |
| OLD | NEW |