Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(140)

Side by Side Diff: chrome/browser/webdata/autocomplete_syncable_service.cc

Issue 10698141: Revert 145993 - [Sync] Add location parameter to SyncChange in Sync API. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 #include "chrome/browser/webdata/autocomplete_syncable_service.h" 5 #include "chrome/browser/webdata/autocomplete_syncable_service.h"
6 6
7 #include "base/location.h" 7 #include "base/location.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/rand_util.h" 9 #include "base/rand_util.h"
10 #include "base/utf_string_conversions.h" 10 #include "base/utf_string_conversions.h"
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 FROM_HERE, 150 FROM_HERE,
151 "Failed to update webdata."); 151 "Failed to update webdata.");
152 } 152 }
153 153
154 WebDataService::NotifyOfMultipleAutofillChanges(web_data_service_); 154 WebDataService::NotifyOfMultipleAutofillChanges(web_data_service_);
155 155
156 syncer::SyncChangeList new_changes; 156 syncer::SyncChangeList new_changes;
157 for (AutocompleteEntryMap::iterator i = new_db_entries.begin(); 157 for (AutocompleteEntryMap::iterator i = new_db_entries.begin();
158 i != new_db_entries.end(); ++i) { 158 i != new_db_entries.end(); ++i) {
159 new_changes.push_back( 159 new_changes.push_back(
160 syncer::SyncChange(FROM_HERE, 160 syncer::SyncChange(
161 i->second.first, 161 i->second.first, CreateSyncData(*(i->second.second))));
162 CreateSyncData(*(i->second.second))));
163 } 162 }
164 163
165 if (ShouldCullSyncedData()) { 164 if (ShouldCullSyncedData()) {
166 // This will schedule a deletion operation on the DB thread, which will 165 // This will schedule a deletion operation on the DB thread, which will
167 // trigger a notification to propagate the deletion to Sync. 166 // trigger a notification to propagate the deletion to Sync.
168 web_data_service_->RemoveExpiredFormElements(); 167 web_data_service_->RemoveExpiredFormElements();
169 } 168 }
170 169
171 syncer::SyncError error = 170 syncer::SyncError error =
172 sync_processor_->ProcessSyncChanges(FROM_HERE, new_changes); 171 sync_processor_->ProcessSyncChanges(FROM_HERE, new_changes);
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after
409 change->key().value(), 408 change->key().value(),
410 &timestamps)) { 409 &timestamps)) {
411 NOTREACHED(); 410 NOTREACHED();
412 return; 411 return;
413 } 412 }
414 AutofillEntry entry(change->key(), timestamps); 413 AutofillEntry entry(change->key(), timestamps);
415 syncer::SyncChange::SyncChangeType change_type = 414 syncer::SyncChange::SyncChangeType change_type =
416 (change->type() == AutofillChange::ADD) ? 415 (change->type() == AutofillChange::ADD) ?
417 syncer::SyncChange::ACTION_ADD : 416 syncer::SyncChange::ACTION_ADD :
418 syncer::SyncChange::ACTION_UPDATE; 417 syncer::SyncChange::ACTION_UPDATE;
419 new_changes.push_back(syncer::SyncChange(FROM_HERE, 418 new_changes.push_back(syncer::SyncChange(change_type,
420 change_type, 419 CreateSyncData(entry)));
421 CreateSyncData(entry)));
422 break; 420 break;
423 } 421 }
424 case AutofillChange::REMOVE: { 422 case AutofillChange::REMOVE: {
425 std::vector<base::Time> timestamps; 423 std::vector<base::Time> timestamps;
426 AutofillEntry entry(change->key(), timestamps); 424 AutofillEntry entry(change->key(), timestamps);
427 new_changes.push_back( 425 new_changes.push_back(
428 syncer::SyncChange(FROM_HERE, 426 syncer::SyncChange(syncer::SyncChange::ACTION_DELETE,
429 syncer::SyncChange::ACTION_DELETE, 427 CreateSyncData(entry)));
430 CreateSyncData(entry)));
431 break; 428 break;
432 } 429 }
433 default: 430 default:
434 NOTREACHED(); 431 NOTREACHED();
435 break; 432 break;
436 } 433 }
437 } 434 }
438 syncer::SyncError error = 435 syncer::SyncError error =
439 sync_processor_->ProcessSyncChanges(FROM_HERE, new_changes); 436 sync_processor_->ProcessSyncChanges(FROM_HERE, new_changes);
440 if (error.IsSet()) { 437 if (error.IsSet()) {
(...skipping 11 matching lines...) Expand all
452 UTF16ToUTF8(entry.key().value()))); 449 UTF16ToUTF8(entry.key().value())));
453 return syncer::SyncData::CreateLocalData(tag, tag, autofill_specifics); 450 return syncer::SyncData::CreateLocalData(tag, tag, autofill_specifics);
454 } 451 }
455 452
456 // static 453 // static
457 std::string AutocompleteSyncableService::KeyToTag(const std::string& name, 454 std::string AutocompleteSyncableService::KeyToTag(const std::string& name,
458 const std::string& value) { 455 const std::string& value) {
459 std::string ns(kAutofillEntryNamespaceTag); 456 std::string ns(kAutofillEntryNamespaceTag);
460 return ns + net::EscapePath(name) + "|" + net::EscapePath(value); 457 return ns + net::EscapePath(name) + "|" + net::EscapePath(value);
461 } 458 }
OLDNEW
« no previous file with comments | « chrome/browser/sync/glue/generic_change_processor.cc ('k') | chrome/browser/webdata/autofill_profile_syncable_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698