Chromium Code Reviews| Index: chrome/browser/sync/engine/syncapi.cc |
| diff --git a/chrome/browser/sync/engine/syncapi.cc b/chrome/browser/sync/engine/syncapi.cc |
| index 7965f651167a70c13fd457837585a1ba05cdbe9a..7c8b6e4e136efe8741891e34c39cf88e6e6d1dcf 100644 |
| --- a/chrome/browser/sync/engine/syncapi.cc |
| +++ b/chrome/browser/sync/engine/syncapi.cc |
| @@ -43,6 +43,7 @@ |
| #include "chrome/browser/sync/protocol/theme_specifics.pb.h" |
| #include "chrome/browser/sync/protocol/typed_url_specifics.pb.h" |
| #include "chrome/browser/sync/sessions/sync_session_context.h" |
| +#include "chrome/browser/sync/syncable/autofill_migration.h" |
| #include "chrome/browser/sync/syncable/directory_manager.h" |
| #include "chrome/browser/sync/syncable/syncable.h" |
| #include "chrome/browser/sync/util/crypto_helpers.h" |
| @@ -375,6 +376,20 @@ void WriteNode::PutAutofillSpecificsAndMarkForSyncing( |
| PutSpecificsAndMarkForSyncing(entity_specifics); |
| } |
| +void WriteNode::SetAutofillProfileSpecifics( |
| + const sync_pb::AutofillProfileSpecifics& new_value) { |
| + DCHECK_EQ(GetModelType(), syncable::AUTOFILL_PROFILE); |
| + PutAutofillProfileSpecificsAndMarkForSyncing(new_value); |
| +} |
| + |
| +void WriteNode::PutAutofillProfileSpecificsAndMarkForSyncing( |
| + const sync_pb::AutofillProfileSpecifics& new_value) { |
| + sync_pb::EntitySpecifics entity_specifics; |
| + entity_specifics.MutableExtension(sync_pb::autofill_profile)->CopyFrom( |
| + new_value); |
| + PutSpecificsAndMarkForSyncing(entity_specifics); |
| +} |
| + |
| void WriteNode::SetBookmarkSpecifics( |
| const sync_pb::BookmarkSpecifics& new_value) { |
| DCHECK(GetModelType() == syncable::BOOKMARKS); |
| @@ -1094,6 +1109,53 @@ class SyncManager::SyncInternal |
| return true; |
| } |
| + syncable::AutofillMigrationState |
| + GetAutofillMigrationState() { |
|
tim (not reviewing)
2010/12/13 19:24:33
indent or previous line
lipalani
2010/12/14 21:05:57
Done.
|
| + syncable::ScopedDirLookup lookup(dir_manager(), username_for_share()); |
| + if (!lookup.good()) { |
| + DCHECK(false) << "ScopedDirLookup failed when checking initial sync"; |
| + return |
| + syncable::NOT_MIGRATED; |
|
tim (not reviewing)
2010/12/13 19:24:33
previous line?
lipalani
2010/12/14 21:05:57
Done.
|
| + } |
| + |
| + return lookup->get_autofill_migration_state(); |
| + } |
| + |
| + void SetAutofillMigrationState( |
| + syncable::AutofillMigrationState state) { |
|
tim (not reviewing)
2010/12/13 19:24:33
previous line? or indent 4
lipalani
2010/12/14 21:05:57
Done.
|
| + syncable::ScopedDirLookup lookup(dir_manager(), username_for_share()); |
| + if (!lookup.good()) { |
| + DCHECK(false) << "ScopedDirLookup failed when checking initial sync"; |
| + return; |
| + } |
| + |
| + return lookup->set_autofill_migration_state(state); |
| + } |
| + |
| + void SetAutofillMigrationDebugInfo( |
| + syncable::AutofillMigrationDebugInfo::PropertyToSet property_to_set, |
| + const syncable::AutofillMigrationDebugInfo& info) { |
| + syncable::ScopedDirLookup lookup(dir_manager(), username_for_share()); |
| + if (!lookup.good()) { |
| + DCHECK(false) << "ScopedDirLookup failed when checking initial sync"; |
| + return; |
| + } |
| + |
| + return |
| + lookup->set_autofill_migration_state_debug_info(property_to_set, info); |
|
tim (not reviewing)
2010/12/13 19:24:33
should start this on the previous line and then in
lipalani
2010/12/14 21:05:57
Done.
|
| + } |
| + |
| + syncable::AutofillMigrationDebugInfo |
| + GetAutofillMigrationDebugInfo() { |
| + syncable::ScopedDirLookup lookup(dir_manager(), username_for_share()); |
| + if (!lookup.good()) { |
| + DCHECK(false) << "ScopedDirLookup failed when checking initial sync"; |
| + syncable::AutofillMigrationDebugInfo null_value = {0}; |
| + return null_value; |
| + } |
| + return lookup->get_autofill_migration_debug_info(); |
| + } |
| + |
| // SyncEngineEventListener implementation. |
| virtual void OnSyncEngineEvent(const SyncEngineEvent& event); |
| private: |
| @@ -1315,6 +1377,27 @@ void SyncManager::StartSyncing() { |
| data_->StartSyncing(); |
| } |
| +syncable::AutofillMigrationState |
| + SyncManager::GetAutofillMigrationState() { |
| + return data_->GetAutofillMigrationState(); |
| +} |
| + |
| +void SyncManager::SetAutofillMigrationState( |
| + syncable::AutofillMigrationState state) { |
| + return data_->SetAutofillMigrationState(state); |
| +} |
| + |
| +syncable::AutofillMigrationDebugInfo |
| + SyncManager::GetAutofillMigrationDebugInfo() { |
| + return data_->GetAutofillMigrationDebugInfo(); |
| +} |
| + |
| +void SyncManager::SetAutofillMigrationDebugInfo( |
| + syncable::AutofillMigrationDebugInfo::PropertyToSet property_to_set, |
| + const syncable::AutofillMigrationDebugInfo& info) { |
| + return data_->SetAutofillMigrationDebugInfo(property_to_set, info); |
| +} |
| + |
| void SyncManager::SetPassphrase(const std::string& passphrase, |
| bool is_explicit) { |
| data_->SetPassphrase(passphrase, is_explicit); |