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

Unified Diff: chrome/browser/search_engines/template_url_service.cc

Issue 10766016: [Sync] Add location parameter to SyncChange in Sync API. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: F 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/search_engines/template_url_service.cc
diff --git a/chrome/browser/search_engines/template_url_service.cc b/chrome/browser/search_engines/template_url_service.cc
index 1764936d61a50f101344c98ffd8a88e0a337f0e6..9487a494538c215fdb5414c653fd0695c081b7ee 100644
--- a/chrome/browser/search_engines/template_url_service.cc
+++ b/chrome/browser/search_engines/template_url_service.cc
@@ -1090,7 +1090,8 @@ syncer::SyncError TemplateURLService::MergeDataAndStartSyncing(
// preprocessing in TemplateURLService's loading code). Ignore it and send
// an ACTION_DELETE up to the server.
new_changes.push_back(
- syncer::SyncChange(syncer::SyncChange::ACTION_DELETE,
+ syncer::SyncChange(FROM_HERE,
+ syncer::SyncChange::ACTION_DELETE,
iter->second));
continue;
}
@@ -1112,8 +1113,9 @@ syncer::SyncError TemplateURLService::MergeDataAndStartSyncing(
// Otherwise, we know we have newer data, so update Sync with our
// data fields.
new_changes.push_back(
- syncer::SyncChange(syncer::SyncChange::ACTION_UPDATE,
- local_data_map[local_turl->sync_guid()]));
+ syncer::SyncChange(FROM_HERE,
+ syncer::SyncChange::ACTION_UPDATE,
+ local_data_map[local_turl->sync_guid()]));
}
local_data_map.erase(iter->first);
} else {
@@ -1155,7 +1157,9 @@ syncer::SyncError TemplateURLService::MergeDataAndStartSyncing(
for (SyncDataMap::const_iterator iter = local_data_map.begin();
iter != local_data_map.end(); ++iter) {
new_changes.push_back(
- syncer::SyncChange(syncer::SyncChange::ACTION_ADD, iter->second));
+ syncer::SyncChange(FROM_HERE,
+ syncer::SyncChange::ACTION_ADD,
+ iter->second));
}
// Do some post-processing on the change list to ensure that we are sending
@@ -1183,6 +1187,7 @@ void TemplateURLService::StopSyncing(syncer::ModelType type) {
}
void TemplateURLService::ProcessTemplateURLChange(
+ const tracked_objects::Location& from_here,
const TemplateURL* turl,
syncer::SyncChange::SyncChangeType type) {
DCHECK_NE(type, syncer::SyncChange::ACTION_INVALID);
@@ -1207,7 +1212,9 @@ void TemplateURLService::ProcessTemplateURLChange(
syncer::SyncChangeList changes;
syncer::SyncData sync_data = CreateSyncDataFromTemplateURL(*turl);
- changes.push_back(syncer::SyncChange(type, sync_data));
+ changes.push_back(syncer::SyncChange(from_here,
+ type,
+ sync_data));
sync_processor_->ProcessSyncChanges(FROM_HERE, changes);
}
@@ -1252,7 +1259,9 @@ TemplateURL* TemplateURLService::CreateTemplateURLFromTemplateURLAndSyncData(
// delete this data off the server.
if (specifics.url().empty() || specifics.sync_guid().empty()) {
change_list->push_back(
- syncer::SyncChange(syncer::SyncChange::ACTION_DELETE, sync_data));
+ syncer::SyncChange(FROM_HERE,
+ syncer::SyncChange::ACTION_DELETE,
+ sync_data));
return NULL;
}
@@ -1295,7 +1304,9 @@ TemplateURL* TemplateURLService::CreateTemplateURLFromTemplateURLAndSyncData(
turl->ResetKeywordIfNecessary(true);
syncer::SyncData sync_data = CreateSyncDataFromTemplateURL(*turl);
change_list->push_back(
- syncer::SyncChange(syncer::SyncChange::ACTION_UPDATE, sync_data));
+ syncer::SyncChange(FROM_HERE,
+ syncer::SyncChange::ACTION_UPDATE,
+ sync_data));
} else if (turl->IsGoogleSearchURLWithReplaceableKeyword()) {
if (!existing_turl) {
// We're adding a new TemplateURL that uses the Google base URL, so set
@@ -1751,7 +1762,9 @@ bool TemplateURLService::UpdateNoNotify(
service_->UpdateKeyword(existing_turl->data());
// Inform sync of the update.
- ProcessTemplateURLChange(existing_turl, syncer::SyncChange::ACTION_UPDATE);
+ ProcessTemplateURLChange(FROM_HERE,
+ existing_turl,
+ syncer::SyncChange::ACTION_UPDATE);
if (default_search_provider_ == existing_turl) {
bool success = SetDefaultSearchProviderNoNotify(existing_turl);
@@ -2082,7 +2095,9 @@ bool TemplateURLService::SetDefaultSearchProviderNoNotify(TemplateURL* url) {
// Inform sync the change to the show_in_default_list flag.
if (url)
- ProcessTemplateURLChange(url, syncer::SyncChange::ACTION_UPDATE);
+ ProcessTemplateURLChange(FROM_HERE,
+ url,
+ syncer::SyncChange::ACTION_UPDATE);
return true;
}
@@ -2131,7 +2146,9 @@ bool TemplateURLService::AddNoNotify(TemplateURL* template_url,
// Inform sync of the addition. Note that this will assign a GUID to
// template_url and add it to the guid_to_template_map_.
- ProcessTemplateURLChange(template_url, syncer::SyncChange::ACTION_ADD);
+ ProcessTemplateURLChange(FROM_HERE,
+ template_url,
+ syncer::SyncChange::ACTION_ADD);
}
return true;
@@ -2161,7 +2178,9 @@ void TemplateURLService::RemoveNoNotify(TemplateURL* template_url) {
service_->RemoveKeyword(template_url->id());
// Inform sync of the deletion.
- ProcessTemplateURLChange(template_url, syncer::SyncChange::ACTION_DELETE);
+ ProcessTemplateURLChange(FROM_HERE,
+ template_url,
+ syncer::SyncChange::ACTION_DELETE);
if (profile_) {
content::Source<Profile> source(profile_);
@@ -2288,8 +2307,9 @@ bool TemplateURLService::ResolveSyncKeywordConflict(
const bool can_replace_local = CanReplace(local_turl);
if (CanReplace(sync_turl) && (local_is_better || !can_replace_local)) {
syncer::SyncData sync_data = CreateSyncDataFromTemplateURL(*sync_turl);
- change_list->push_back(
- syncer::SyncChange(syncer::SyncChange::ACTION_DELETE, sync_data));
+ change_list->push_back(syncer::SyncChange(FROM_HERE,
+ syncer::SyncChange::ACTION_DELETE,
+ sync_data));
return false;
}
if (can_replace_local) {
@@ -2302,7 +2322,9 @@ bool TemplateURLService::ResolveSyncKeywordConflict(
// PruneSyncChanges() will prune out the ACTION_DELETE we create here.
syncer::SyncData sync_data = CreateSyncDataFromTemplateURL(*local_turl);
change_list->push_back(
- syncer::SyncChange(syncer::SyncChange::ACTION_DELETE, sync_data));
+ syncer::SyncChange(FROM_HERE,
+ syncer::SyncChange::ACTION_DELETE,
+ sync_data));
Remove(local_turl);
} else if (local_is_better) {
string16 new_keyword = UniquifyKeyword(*sync_turl);
@@ -2311,8 +2333,9 @@ bool TemplateURLService::ResolveSyncKeywordConflict(
// If we update the cloud TURL, we need to push an update back to sync
// informing it that something has changed.
syncer::SyncData sync_data = CreateSyncDataFromTemplateURL(*sync_turl);
- change_list->push_back(
- syncer::SyncChange(syncer::SyncChange::ACTION_UPDATE, sync_data));
+ change_list->push_back(syncer::SyncChange(FROM_HERE,
+ syncer::SyncChange::ACTION_UPDATE,
+ sync_data));
} else {
string16 new_keyword = UniquifyKeyword(*local_turl);
TemplateURLData data(local_turl->data());
@@ -2330,8 +2353,9 @@ bool TemplateURLService::ResolveSyncKeywordConflict(
// caller will later generate; but in this case, PruneSyncChanges() will
// prune out the ACTION_UPDATE we create here.
syncer::SyncData sync_data = CreateSyncDataFromTemplateURL(*local_turl);
- change_list->push_back(
- syncer::SyncChange(syncer::SyncChange::ACTION_UPDATE, sync_data));
+ change_list->push_back(syncer::SyncChange(FROM_HERE,
+ syncer::SyncChange::ACTION_UPDATE,
+ sync_data));
}
return true;
}
@@ -2365,8 +2389,9 @@ void TemplateURLService::MergeSyncAndLocalURLDuplicates(
// See comments in ResolveSyncKeywordConflict() regarding generating an
// ACTION_DELETE manually since Remove() won't do it.
syncer::SyncData sync_data = CreateSyncDataFromTemplateURL(*local_turl);
- change_list->push_back(
- syncer::SyncChange(syncer::SyncChange::ACTION_DELETE, sync_data));
+ change_list->push_back(syncer::SyncChange(FROM_HERE,
+ syncer::SyncChange::ACTION_DELETE,
+ sync_data));
Remove(local_turl);
// Force the local ID to kInvalidTemplateURLID so we can add it.
@@ -2381,8 +2406,9 @@ void TemplateURLService::MergeSyncAndLocalURLDuplicates(
// having the same GUID.
ResetTemplateURLGUID(local_turl, sync_turl->sync_guid());
syncer::SyncData sync_data = CreateSyncDataFromTemplateURL(*local_turl);
- change_list->push_back(
- syncer::SyncChange(syncer::SyncChange::ACTION_UPDATE, sync_data));
+ change_list->push_back(syncer::SyncChange(FROM_HERE,
+ syncer::SyncChange::ACTION_UPDATE,
+ sync_data));
}
}

Powered by Google App Engine
This is Rietveld 408576698