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

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

Issue 10806065: Rewrite TemplateURLService's SyncableService implmentation to avoid sending ACTION_DELETEs to Sync. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Initial draft 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.h
diff --git a/chrome/browser/search_engines/template_url_service.h b/chrome/browser/search_engines/template_url_service.h
index b4641ea67072c6e68c73ed5d6d4f44170193faa9..dccc8a1bf63ac77726a55e51cce6f4f8aef485a2 100644
--- a/chrome/browser/search_engines/template_url_service.h
+++ b/chrome/browser/search_engines/template_url_service.h
@@ -532,6 +532,21 @@ class TemplateURLService : public WebDataServiceConsumer,
// execute the special character appending functionality.
string16 UniquifyKeyword(const TemplateURL& turl, bool force);
+ // Adds |sync_turl| into the local model, possibly removing or updating a
+ // local TemplateURL to make room for it. This expects |sync_turl| to be a new
+ // entry from Sync, not currently known to the local model. |sync_data| should
+ // be a SyncDataMap where the contents are entries initially known to Sync
+ // during MergeDataAndStartSyncing. Any necessary updates to Sync will be
+ // appended to |change_list|. This can include updates on local TemplateURLs,
+ // if they are already synced. |initial_data| should be a SyncDataMap of the
+ // entries known to the local model during MergeDataAndStartSyncing. If
+ // |sync_turl| replaces a local entry, that entry is removed from
+ // |initial_data| to prevent it from being sent up to Sync.
+ void MergeInSyncTemplateURL(TemplateURL* sync_turl,
+ SyncDataMap& sync_data,
+ syncer::SyncChangeList* change_list,
+ SyncDataMap* initial_data);
+
// Given a TemplateURL from Sync (cloud) and a local, non-extension
// TemplateURL with the same keyword, selects "better" and "worse" entries:
// * If one of the TemplateURLs is replaceable and the other is not, the
@@ -561,6 +576,18 @@ class TemplateURLService : public WebDataServiceConsumer,
TemplateURL* local_turl,
syncer::SyncChangeList* change_list);
+ // Given two synced TemplateURLs with a conflicting keyword, one of which
+ // needs to be added to or updated in the local model (|sync_turl|) and one
+ // which is already known to the local model (|local_turl|), prepares the
+ // local model so that |sync_turl| can be added to it, or applied as an update
+ // to an existing TemplateURL. Since both entries are known to Sync and one of
+ // their keywords will change, an ACTION_UPDATE will be appended to
+ // |change_list| to reflect this change. Note that |local_turl| must not be an
+ // extension keyword.
+ void ResolveSyncKeywordConflict2(TemplateURL* sync_turl,
+ TemplateURL* local_turl,
+ syncer::SyncChangeList* change_list);
+
// Returns a TemplateURL from the service that has the same keyword and search
// URL as |sync_turl|, if it exists.
TemplateURL* FindDuplicateOfSyncTemplateURL(const TemplateURL& sync_turl);
@@ -572,8 +599,10 @@ class TemplateURLService : public WebDataServiceConsumer,
// through through adding appropriate SyncChanges to |change_list|. This
// method takes ownership of |sync_turl|, and adds it to the model if it is
// newer, so the caller must release it if need be.
+ // TODO Update document to describe |sync_data|.
void MergeSyncAndLocalURLDuplicates(TemplateURL* sync_turl,
TemplateURL* local_turl,
+ SyncDataMap& sync_data,
syncer::SyncChangeList* change_list);
// Checks a newly added TemplateURL from Sync by its sync_guid and sets it as

Powered by Google App Engine
This is Rietveld 408576698