summaryrefslogtreecommitdiffstats
path: root/chrome/browser/webdata/keyword_table.h
diff options
context:
space:
mode:
authorpkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-04-19 01:07:08 +0000
committerpkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-04-19 01:07:08 +0000
commit4e40f59bb0a560ce5c606d9e9b31b462f86a8c3e (patch)
tree89f57076929ad36770aec4dc0cc7ee7e888f5bec /chrome/browser/webdata/keyword_table.h
parentb89852f5c5d3171a76ec2dee6e85c9fd0e078be6 (diff)
downloadchromium_src-4e40f59bb0a560ce5c606d9e9b31b462f86a8c3e.zip
chromium_src-4e40f59bb0a560ce5c606d9e9b31b462f86a8c3e.tar.gz
chromium_src-4e40f59bb0a560ce5c606d9e9b31b462f86a8c3e.tar.bz2
Enforce that TemplateURLs' URLs cannot be empty.
This should already have been true in non-test code: the keyword editor, the importer, the extension system, and the search engine autodetection code all tried to ensure that the URLs are non-empty. However, because we've seen problems occur, this change tries to sanitize the pref, database, and sync inputs to expunge any bogus entries. We also fix tests, add some more DCHECKs to make this assertion clearer in some of the TemplateURL-adding paths, and then remove conditionals that checked for empty URLs. This also cleans up a silly design where TemplateURLService listened for changes to the default search provider prefs -- meaning that anyone who tried to write them wound up calling back to the observer as every single pref was written. This led to reading back bad state. Eliminating this ought to allow for some other cleanups in TemplateURLService, but I haven't tried to make them here. BUG=none TEST=none Review URL: https://chromiumcodereview.appspot.com/10014033 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@132909 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/webdata/keyword_table.h')
-rw-r--r--chrome/browser/webdata/keyword_table.h7
1 files changed, 5 insertions, 2 deletions
diff --git a/chrome/browser/webdata/keyword_table.h b/chrome/browser/webdata/keyword_table.h
index da62e4c..a5285e7 100644
--- a/chrome/browser/webdata/keyword_table.h
+++ b/chrome/browser/webdata/keyword_table.h
@@ -150,13 +150,16 @@ class KeywordTable : public WebDatabaseTable {
FRIEND_TEST_ALL_PREFIXES(KeywordTableTest, DefaultSearchProviderBackup);
FRIEND_TEST_ALL_PREFIXES(KeywordTableTest, GetTableContents);
FRIEND_TEST_ALL_PREFIXES(KeywordTableTest, GetTableContentsOrdering);
+ FRIEND_TEST_ALL_PREFIXES(KeywordTableTest, SanitizeURLs);
// NOTE: Since the table columns have changed in different versions, many
// functions below take a |table_version| argument which dictates which
// version number's column set to use.
- // Fills |data| with the data in |s|.
- static void GetKeywordDataFromStatement(const sql::Statement& s,
+ // Fills |data| with the data in |s|. Returns false if we couldn't fill
+ // |data| for some reason, e.g. |s| tried to set one of the fields to an
+ // illegal value.
+ static bool GetKeywordDataFromStatement(const sql::Statement& s,
TemplateURLData* data);
// Returns contents of |keywords_backup| table and default search provider