| Index: chrome/browser/webdata/autocomplete_syncable_service.cc
|
| diff --git a/chrome/browser/webdata/autocomplete_syncable_service.cc b/chrome/browser/webdata/autocomplete_syncable_service.cc
|
| index 76b2457db9ef2b9ad40706739f01a91a5e408188..c53af859562351815bdfced90512c3eb365d697c 100644
|
| --- a/chrome/browser/webdata/autocomplete_syncable_service.cc
|
| +++ b/chrome/browser/webdata/autocomplete_syncable_service.cc
|
| @@ -107,11 +107,11 @@ AutocompleteSyncableService::AutocompleteSyncableService()
|
| DCHECK(BrowserThread::CurrentlyOn(BrowserThread::DB));
|
| }
|
|
|
| -SyncError AutocompleteSyncableService::MergeDataAndStartSyncing(
|
| +csync::SyncError AutocompleteSyncableService::MergeDataAndStartSyncing(
|
| syncable::ModelType type,
|
| - const SyncDataList& initial_sync_data,
|
| - scoped_ptr<SyncChangeProcessor> sync_processor,
|
| - scoped_ptr<SyncErrorFactory> error_handler) {
|
| + const csync::SyncDataList& initial_sync_data,
|
| + scoped_ptr<csync::SyncChangeProcessor> sync_processor,
|
| + scoped_ptr<csync::SyncErrorFactory> error_handler) {
|
| DCHECK(CalledOnValidThread());
|
| DCHECK(!sync_processor_.get());
|
| DCHECK(sync_processor.get());
|
| @@ -129,7 +129,8 @@ SyncError AutocompleteSyncableService::MergeDataAndStartSyncing(
|
| AutocompleteEntryMap new_db_entries;
|
| for (std::vector<AutofillEntry>::iterator it = entries.begin();
|
| it != entries.end(); ++it) {
|
| - new_db_entries[it->key()] = std::make_pair(SyncChange::ACTION_ADD, it);
|
| + new_db_entries[it->key()] =
|
| + std::make_pair(csync::SyncChange::ACTION_ADD, it);
|
| }
|
|
|
| sync_processor_ = sync_processor.Pass();
|
| @@ -138,7 +139,8 @@ SyncError AutocompleteSyncableService::MergeDataAndStartSyncing(
|
| // Go through and check for all the entries that sync already knows about.
|
| // CreateOrUpdateEntry() will remove entries that are same with the synced
|
| // ones from |new_db_entries|.
|
| - for (SyncDataList::const_iterator sync_iter = initial_sync_data.begin();
|
| + for (csync::SyncDataList::const_iterator sync_iter =
|
| + initial_sync_data.begin();
|
| sync_iter != initial_sync_data.end(); ++sync_iter) {
|
| CreateOrUpdateEntry(*sync_iter, &new_db_entries, &new_synced_entries);
|
| }
|
| @@ -151,11 +153,12 @@ SyncError AutocompleteSyncableService::MergeDataAndStartSyncing(
|
|
|
| WebDataService::NotifyOfMultipleAutofillChanges(web_data_service_);
|
|
|
| - SyncChangeList new_changes;
|
| + csync::SyncChangeList new_changes;
|
| for (AutocompleteEntryMap::iterator i = new_db_entries.begin();
|
| i != new_db_entries.end(); ++i) {
|
| new_changes.push_back(
|
| - SyncChange(i->second.first, CreateSyncData(*(i->second.second))));
|
| + csync::SyncChange(
|
| + i->second.first, CreateSyncData(*(i->second.second))));
|
| }
|
|
|
| if (ShouldCullSyncedData()) {
|
| @@ -164,7 +167,8 @@ SyncError AutocompleteSyncableService::MergeDataAndStartSyncing(
|
| web_data_service_->RemoveExpiredFormElements();
|
| }
|
|
|
| - SyncError error = sync_processor_->ProcessSyncChanges(FROM_HERE, new_changes);
|
| + csync::SyncError error =
|
| + sync_processor_->ProcessSyncChanges(FROM_HERE, new_changes);
|
|
|
| return error;
|
| }
|
| @@ -177,13 +181,13 @@ void AutocompleteSyncableService::StopSyncing(syncable::ModelType type) {
|
| error_handler_.reset();
|
| }
|
|
|
| -SyncDataList AutocompleteSyncableService::GetAllSyncData(
|
| +csync::SyncDataList AutocompleteSyncableService::GetAllSyncData(
|
| syncable::ModelType type) const {
|
| DCHECK(CalledOnValidThread());
|
| DCHECK(sync_processor_.get());
|
| DCHECK_EQ(type, syncable::AUTOFILL);
|
|
|
| - SyncDataList current_data;
|
| + csync::SyncDataList current_data;
|
|
|
| std::vector<AutofillEntry> entries;
|
| if (!LoadAutofillData(&entries))
|
| @@ -197,14 +201,14 @@ SyncDataList AutocompleteSyncableService::GetAllSyncData(
|
| return current_data;
|
| }
|
|
|
| -SyncError AutocompleteSyncableService::ProcessSyncChanges(
|
| +csync::SyncError AutocompleteSyncableService::ProcessSyncChanges(
|
| const tracked_objects::Location& from_here,
|
| - const SyncChangeList& change_list) {
|
| + const csync::SyncChangeList& change_list) {
|
| DCHECK(CalledOnValidThread());
|
| DCHECK(sync_processor_.get());
|
|
|
| if (!sync_processor_.get()) {
|
| - SyncError error(FROM_HERE, "Models not yet associated.",
|
| + csync::SyncError error(FROM_HERE, "Models not yet associated.",
|
| syncable::AUTOFILL);
|
| return error;
|
| }
|
| @@ -214,14 +218,14 @@ SyncError AutocompleteSyncableService::ProcessSyncChanges(
|
| scoped_ptr<AutocompleteEntryMap> db_entries;
|
| std::vector<AutofillEntry> new_entries;
|
|
|
| - SyncError list_processing_error;
|
| + csync::SyncError list_processing_error;
|
|
|
| - for (SyncChangeList::const_iterator i = change_list.begin();
|
| + for (csync::SyncChangeList::const_iterator i = change_list.begin();
|
| i != change_list.end() && !list_processing_error.IsSet(); ++i) {
|
| DCHECK(i->IsValid());
|
| switch (i->change_type()) {
|
| - case SyncChange::ACTION_ADD:
|
| - case SyncChange::ACTION_UPDATE:
|
| + case csync::SyncChange::ACTION_ADD:
|
| + case csync::SyncChange::ACTION_UPDATE:
|
| if (!db_entries.get()) {
|
| if (!LoadAutofillData(&entries)) {
|
| return error_handler_->CreateAndUploadError(
|
| @@ -232,12 +236,12 @@ SyncError AutocompleteSyncableService::ProcessSyncChanges(
|
| for (std::vector<AutofillEntry>::iterator it = entries.begin();
|
| it != entries.end(); ++it) {
|
| (*db_entries)[it->key()] =
|
| - std::make_pair(SyncChange::ACTION_ADD, it);
|
| + std::make_pair(csync::SyncChange::ACTION_ADD, it);
|
| }
|
| }
|
| CreateOrUpdateEntry(i->sync_data(), db_entries.get(), &new_entries);
|
| break;
|
| - case SyncChange::ACTION_DELETE: {
|
| + case csync::SyncChange::ACTION_DELETE: {
|
| DCHECK(i->sync_data().GetSpecifics().has_autofill())
|
| << "Autofill specifics data not present on delete!";
|
| const sync_pb::AutofillSpecifics& autofill =
|
| @@ -254,7 +258,7 @@ SyncError AutocompleteSyncableService::ProcessSyncChanges(
|
| return error_handler_->CreateAndUploadError(
|
| FROM_HERE,
|
| "ProcessSyncChanges failed on ChangeType " +
|
| - SyncChange::ChangeTypeToString(i->change_type()));
|
| + csync::SyncChange::ChangeTypeToString(i->change_type()));
|
| }
|
| }
|
|
|
| @@ -315,7 +319,7 @@ bool AutocompleteSyncableService::SaveChangesToWebData(
|
|
|
| // Creates or updates an autocomplete entry based on |data|.
|
| void AutocompleteSyncableService::CreateOrUpdateEntry(
|
| - const SyncData& data,
|
| + const csync::SyncData& data,
|
| AutocompleteEntryMap* loaded_data,
|
| std::vector<AutofillEntry>* new_entries) {
|
| const sync_pb::EntitySpecifics& specifics = data.GetSpecifics();
|
| @@ -356,7 +360,7 @@ void AutocompleteSyncableService::CreateOrUpdateEntry(
|
| new_entries->push_back(new_entry);
|
| // Update the sync db if the list of timestamps have changed.
|
| *(it->second.second) = new_entry;
|
| - it->second.first = SyncChange::ACTION_UPDATE;
|
| + it->second.first = csync::SyncChange::ACTION_UPDATE;
|
| } else {
|
| loaded_data->erase(it);
|
| }
|
| @@ -377,7 +381,7 @@ void AutocompleteSyncableService::WriteAutofillEntry(
|
| }
|
| }
|
|
|
| -SyncError AutocompleteSyncableService::AutofillEntryDelete(
|
| +csync::SyncError AutocompleteSyncableService::AutofillEntryDelete(
|
| const sync_pb::AutofillSpecifics& autofill) {
|
| if (!web_data_service_->GetDatabase()->GetAutofillTable()->RemoveFormElement(
|
| UTF8ToUTF16(autofill.name()), UTF8ToUTF16(autofill.value()))) {
|
| @@ -385,13 +389,13 @@ SyncError AutocompleteSyncableService::AutofillEntryDelete(
|
| FROM_HERE,
|
| "Could not remove autocomplete entry from WebDatabase.");
|
| }
|
| - return SyncError();
|
| + return csync::SyncError();
|
| }
|
|
|
| void AutocompleteSyncableService::ActOnChanges(
|
| const AutofillChangeList& changes) {
|
| DCHECK(sync_processor_.get());
|
| - SyncChangeList new_changes;
|
| + csync::SyncChangeList new_changes;
|
| for (AutofillChangeList::const_iterator change = changes.begin();
|
| change != changes.end(); ++change) {
|
| switch (change->type()) {
|
| @@ -407,18 +411,19 @@ void AutocompleteSyncableService::ActOnChanges(
|
| return;
|
| }
|
| AutofillEntry entry(change->key(), timestamps);
|
| - SyncChange::SyncChangeType change_type =
|
| + csync::SyncChange::SyncChangeType change_type =
|
| (change->type() == AutofillChange::ADD) ?
|
| - SyncChange::ACTION_ADD : SyncChange::ACTION_UPDATE;
|
| - new_changes.push_back(SyncChange(change_type,
|
| + csync::SyncChange::ACTION_ADD : csync::SyncChange::ACTION_UPDATE;
|
| + new_changes.push_back(csync::SyncChange(change_type,
|
| CreateSyncData(entry)));
|
| break;
|
| }
|
| case AutofillChange::REMOVE: {
|
| std::vector<base::Time> timestamps;
|
| AutofillEntry entry(change->key(), timestamps);
|
| - new_changes.push_back(SyncChange(SyncChange::ACTION_DELETE,
|
| - CreateSyncData(entry)));
|
| + new_changes.push_back(
|
| + csync::SyncChange(csync::SyncChange::ACTION_DELETE,
|
| + CreateSyncData(entry)));
|
| break;
|
| }
|
| default:
|
| @@ -426,7 +431,8 @@ void AutocompleteSyncableService::ActOnChanges(
|
| break;
|
| }
|
| }
|
| - SyncError error = sync_processor_->ProcessSyncChanges(FROM_HERE, new_changes);
|
| + csync::SyncError error =
|
| + sync_processor_->ProcessSyncChanges(FROM_HERE, new_changes);
|
| if (error.IsSet()) {
|
| DLOG(WARNING) << "[AUTOCOMPLETE SYNC]"
|
| << " Failed processing change:"
|
| @@ -434,13 +440,13 @@ void AutocompleteSyncableService::ActOnChanges(
|
| }
|
| }
|
|
|
| -SyncData AutocompleteSyncableService::CreateSyncData(
|
| +csync::SyncData AutocompleteSyncableService::CreateSyncData(
|
| const AutofillEntry& entry) const {
|
| sync_pb::EntitySpecifics autofill_specifics;
|
| WriteAutofillEntry(entry, &autofill_specifics);
|
| std::string tag(KeyToTag(UTF16ToUTF8(entry.key().name()),
|
| UTF16ToUTF8(entry.key().value())));
|
| - return SyncData::CreateLocalData(tag, tag, autofill_specifics);
|
| + return csync::SyncData::CreateLocalData(tag, tag, autofill_specifics);
|
| }
|
|
|
| // static
|
|
|