summaryrefslogtreecommitdiffstats
path: root/chrome/browser/importer
diff options
context:
space:
mode:
authorpkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-05-08 01:34:25 +0000
committerpkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-05-08 01:34:25 +0000
commit7b596f69d8211da4a1a642bbdf37ddbcf1546757 (patch)
tree13a9608a191373ac1d4f85fc48631a903dc77030 /chrome/browser/importer
parent80745e361e61c62b38df34f5713f74c4a26a62f4 (diff)
downloadchromium_src-7b596f69d8211da4a1a642bbdf37ddbcf1546757.zip
chromium_src-7b596f69d8211da4a1a642bbdf37ddbcf1546757.tar.gz
chromium_src-7b596f69d8211da4a1a642bbdf37ddbcf1546757.tar.bz2
Remove the "autogenerate keyword" bit on TemplateURL.
This is a large change because a number of other significant pieces were either inherently tied to the above change, or too difficult to separate from it: * Because autogeneration was really only ever supposed to be used for the prepopulated Google entry, replace it with a system that auto-regenerates keywords for TemplateURLs that (a) use {google:baseURL} and (b) have a keyword that's currently "google.<TLD>" whenever the base URL changes. This means that users who manually create such TemplateURLs will automatically get the benefit of "autogenerated" keywords. * Pass information to the KeywordTable as bare TemplateURLData objects instead of TemplateURLs, now that the latter are not needed to perform keyword generation. * Remove the "autogenerate_keyword" column from the KeywordTable. This also takes the opportunity to remove the already-dead "logo_id" column (which I previously asked msw to leave in in order to only have to write the migration code once). This in turn requires adding version numbers to a lot of functions so they know which column set to use, as well as writing migration code to manually generate keywords for previously-autogenerated entries. * Migrate the "autogenerate_keyword" bit in data from prefs and sync as well. For sync this requires a variety of followon changes to send back ACTION_UPDATEs for migrated TemplateURLs and coalesce multiple SyncChanges to the same GUID. * Move various bits of TemplateURLService::GenerateKeyword() that were only used for the "autodetected on a webpage" case to the specific code for that case, in order to make GenerateKeyword() incapable of failing. This is important for the next item. * Remove the possibility for keywords to simply be empty. All TemplateURLs should now have a keyword, whether they were previously marked as "autogenerated" or not. While the UI already tried to guarantee this, the TemplateURL class itself and various pieces of TemplateURLService did not, or didn't deal correctly with exceptions. Enforcing this makes it much easier to reason about keywords and is important for the next item. * Guarantee that all keywords are unique, with one exception noted below. This allows callers to reliably refer to TemplateURLs by keyword; a future change will make AutocompleteMatch do precisely this. It also prevents weird edge cases in the UI and sync. * Exception: explicitly allow extension keywords to overlap with each other and with one non-extension TemplateURL. Previously, the behavior was somewhat random and buggy when we added and removed extensions that defined keywords, especially if we also tried to add/edit/remove keywords from the settings UI. We now define an explicit precedence order: non-replaceable TemplateURL > extension-provided TemplateURLs > replaceable TemplateURL; within the extensions section, the most recently-added extension wins. As we add and remove keywords, the current "TemplateURL for keyword" is always kept up-to-date according to this precedence order (so e.g. removing a later extension will "expose" an earlier one). BUG=none TEST=Adding extensions that specify omnibox keywords which conflict with local keywords should result in predictable behavior as described above; removing the extensions should restore the prior behavior. Review URL: https://chromiumcodereview.appspot.com/10381016 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@135775 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/importer')
-rw-r--r--chrome/browser/importer/ie_importer.cc2
-rw-r--r--chrome/browser/importer/profile_import_process_messages.h6
2 files changed, 2 insertions, 6 deletions
diff --git a/chrome/browser/importer/ie_importer.cc b/chrome/browser/importer/ie_importer.cc
index 93fde8c..052ffdd 100644
--- a/chrome/browser/importer/ie_importer.cc
+++ b/chrome/browser/importer/ie_importer.cc
@@ -586,7 +586,7 @@ void IEImporter::ImportSearchEngines() {
if (gurl.is_valid()) {
TemplateURLData data;
data.short_name = name;
- data.SetKeyword(TemplateURLService::GenerateKeyword(gurl, false));
+ data.SetKeyword(TemplateURLService::GenerateKeyword(gurl));
data.SetURL(url);
data.show_in_default_list = true;
t_iter = search_engines_map.insert(std::make_pair(url,
diff --git a/chrome/browser/importer/profile_import_process_messages.h b/chrome/browser/importer/profile_import_process_messages.h
index 93f62d0..9a6ed03 100644
--- a/chrome/browser/importer/profile_import_process_messages.h
+++ b/chrome/browser/importer/profile_import_process_messages.h
@@ -195,8 +195,7 @@ struct ParamTraits<TemplateURLData> {
typedef TemplateURLData param_type;
static void Write(Message* m, const param_type& p) {
WriteParam(m, p.short_name);
- WriteParam(m, p.raw_keyword());
- WriteParam(m, p.autogenerate_keyword());
+ WriteParam(m, p.keyword());
WriteParam(m, p.url());
WriteParam(m, p.suggestions_url);
WriteParam(m, p.instant_url);
@@ -215,11 +214,9 @@ struct ParamTraits<TemplateURLData> {
}
static bool Read(const Message* m, PickleIterator* iter, param_type* p) {
string16 keyword;
- bool autogenerate_keyword;
std::string url;
if (!ReadParam(m, iter, &p->short_name) ||
!ReadParam(m, iter, &keyword) ||
- !ReadParam(m, iter, &autogenerate_keyword) ||
!ReadParam(m, iter, &url) ||
!ReadParam(m, iter, &p->suggestions_url) ||
!ReadParam(m, iter, &p->instant_url) ||
@@ -237,7 +234,6 @@ struct ParamTraits<TemplateURLData> {
!ReadParam(m, iter, &p->sync_guid))
return false;
p->SetKeyword(keyword);
- p->SetAutogenerateKeyword(autogenerate_keyword);
p->SetURL(url);
return true;
}