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

Unified Diff: chrome/browser/webdata/keyword_table.h

Issue 9982018: Move most TemplateURL data members to a new struct, TemplateURLData. This allows us to eliminate t… (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 8 years, 8 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/webdata/keyword_table.h
===================================================================
--- chrome/browser/webdata/keyword_table.h (revision 130759)
+++ chrome/browser/webdata/keyword_table.h (working copy)
@@ -16,6 +16,7 @@
#include "chrome/browser/search_engines/template_url_id.h"
class TemplateURL;
+struct TemplateURLData;
namespace sql {
class Statement;
@@ -27,7 +28,7 @@
// Note: The database stores time in seconds, UTC.
//
// keywords Most of the columns mirror that of a field in
-// TemplateURL. See TemplateURL for more details.
+// TemplateURLData. See that struct for more details.
// id
// short_name
// keyword
@@ -43,16 +44,16 @@
// input_encodings Semicolon separated list of supported input
// encodings, may be empty.
// suggest_url
-// prepopulate_id See TemplateURL::prepopulate_id.
+// prepopulate_id See TemplateURLData::prepopulate_id.
// autogenerate_keyword
// logo_id Deprecated, to be removed; see crbug.com/113248.
-// created_by_policy See TemplateURL::created_by_policy. This was added
-// in version 26.
-// instant_url See TemplateURL::instant_url. This was added
-// in version 29.
-// last_modified See TemplateURL::last_modified. This was added in
-// version 38.
-// sync_guid See TemplateURL::sync_guid. This was added in
+// created_by_policy See TemplateURLData::created_by_policy. This was
+// added in version 26.
+// instant_url See TemplateURLData::instant_url. This was added in
+// version 29.
+// last_modified See TemplateURLData::last_modified. This was added
+// in version 38.
+// sync_guid See TemplateURLData::sync_guid. This was added in
// version 39.
//
// keywords_backup The full copy of the |keywords| table. Added in
@@ -81,7 +82,7 @@
//
class KeywordTable : public WebDatabaseTable {
public:
- typedef std::vector<TemplateURL*> Keywords;
+ typedef std::vector<TemplateURLData> Keywords;
// Constants exposed for the benefit of test code:
@@ -118,13 +119,13 @@
// Returns true on success.
bool UpdateKeyword(const TemplateURL& url);
- // ID (TemplateURL->id) of the default search provider.
+ // ID (TemplateURLData->id) of the default search provider.
bool SetDefaultSearchProviderID(int64 id);
int64 GetDefaultSearchProviderID();
- // Backup of the default search provider. NULL if the backup is invalid. The
- // returned TemplateURL is owned by the caller.
- TemplateURL* GetDefaultSearchProviderBackup();
+ // If the default search provider backup is valid, returns true and copies the
+ // backup into |backup|. Otherwise returns false.
+ bool GetDefaultSearchProviderBackup(TemplateURLData* backup);
// Returns true if the default search provider has been changed out from under
// us. This can happen if another process modifies our database or the file
@@ -150,10 +151,14 @@
FRIEND_TEST_ALL_PREFIXES(KeywordTableTest, GetTableContents);
FRIEND_TEST_ALL_PREFIXES(KeywordTableTest, GetTableContentsOrdering);
- // Returns a new TemplateURL from the data in |s|. The caller owns the
- // returned pointer.
- static TemplateURL* GetKeywordDataFromStatement(const sql::Statement& s);
+ // 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,
+ TemplateURLData* data);
+
// Returns contents of |keywords_backup| table and default search provider
// id backup as a string through |data|. Return value is true on success,
// false otherwise.
« no previous file with comments | « chrome/browser/ui/search_engines/template_url_table_model.cc ('k') | chrome/browser/webdata/keyword_table.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698