| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CHROME_BROWSER_WEBDATA_KEYWORD_TABLE_H_ | 5 #ifndef CHROME_BROWSER_WEBDATA_KEYWORD_TABLE_H_ |
| 6 #define CHROME_BROWSER_WEBDATA_KEYWORD_TABLE_H_ | 6 #define CHROME_BROWSER_WEBDATA_KEYWORD_TABLE_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 // suggest_url | 44 // suggest_url |
| 45 // prepopulate_id See TemplateURLData::prepopulate_id. | 45 // prepopulate_id See TemplateURLData::prepopulate_id. |
| 46 // created_by_policy See TemplateURLData::created_by_policy. This was | 46 // created_by_policy See TemplateURLData::created_by_policy. This was |
| 47 // added in version 26. | 47 // added in version 26. |
| 48 // instant_url See TemplateURLData::instant_url. This was added in | 48 // instant_url See TemplateURLData::instant_url. This was added in |
| 49 // version 29. | 49 // version 29. |
| 50 // last_modified See TemplateURLData::last_modified. This was added | 50 // last_modified See TemplateURLData::last_modified. This was added |
| 51 // in version 38. | 51 // in version 38. |
| 52 // sync_guid See TemplateURLData::sync_guid. This was added in | 52 // sync_guid See TemplateURLData::sync_guid. This was added in |
| 53 // version 39. | 53 // version 39. |
| 54 // alternate_urls See TemplateURLData::alternate_urls_. This was added |
| 55 // in version 47. |
| 54 // | 56 // |
| 55 // keywords_backup The full copy of the |keywords| table. Added in | 57 // keywords_backup The full copy of the |keywords| table. Added in |
| 56 // version 43. Must be in sync with |keywords| | 58 // version 43. Must be in sync with |keywords| |
| 57 // table otherwise verification of default search | 59 // table otherwise verification of default search |
| 58 // provider settings will fail. | 60 // provider settings will fail. |
| 59 // | 61 // |
| 60 // This class also manages some fields in the |meta| table: | 62 // This class also manages some fields in the |meta| table: |
| 61 // | 63 // |
| 62 // Default Search Provider ID The id of the default search provider. | 64 // Default Search Provider ID The id of the default search provider. |
| 63 // Default Search Provider ID Backup | 65 // Default Search Provider ID Backup |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 134 // Table migration functions. | 136 // Table migration functions. |
| 135 bool MigrateToVersion21AutoGenerateKeywordColumn(); | 137 bool MigrateToVersion21AutoGenerateKeywordColumn(); |
| 136 bool MigrateToVersion25AddLogoIDColumn(); | 138 bool MigrateToVersion25AddLogoIDColumn(); |
| 137 bool MigrateToVersion26AddCreatedByPolicyColumn(); | 139 bool MigrateToVersion26AddCreatedByPolicyColumn(); |
| 138 bool MigrateToVersion28SupportsInstantColumn(); | 140 bool MigrateToVersion28SupportsInstantColumn(); |
| 139 bool MigrateToVersion29InstantUrlToSupportsInstant(); | 141 bool MigrateToVersion29InstantUrlToSupportsInstant(); |
| 140 bool MigrateToVersion38AddLastModifiedColumn(); | 142 bool MigrateToVersion38AddLastModifiedColumn(); |
| 141 bool MigrateToVersion39AddSyncGUIDColumn(); | 143 bool MigrateToVersion39AddSyncGUIDColumn(); |
| 142 bool MigrateToVersion44AddDefaultSearchProviderBackup(); | 144 bool MigrateToVersion44AddDefaultSearchProviderBackup(); |
| 143 bool MigrateToVersion45RemoveLogoIDAndAutogenerateColumns(); | 145 bool MigrateToVersion45RemoveLogoIDAndAutogenerateColumns(); |
| 146 bool MigrateToVersion47AddAlternateUrlsColumn(); |
| 144 | 147 |
| 145 private: | 148 private: |
| 146 FRIEND_TEST_ALL_PREFIXES(KeywordTableTest, DefaultSearchProviderBackup); | 149 FRIEND_TEST_ALL_PREFIXES(KeywordTableTest, DefaultSearchProviderBackup); |
| 147 FRIEND_TEST_ALL_PREFIXES(KeywordTableTest, GetTableContents); | 150 FRIEND_TEST_ALL_PREFIXES(KeywordTableTest, GetTableContents); |
| 148 FRIEND_TEST_ALL_PREFIXES(KeywordTableTest, GetTableContentsOrdering); | 151 FRIEND_TEST_ALL_PREFIXES(KeywordTableTest, GetTableContentsOrdering); |
| 149 FRIEND_TEST_ALL_PREFIXES(KeywordTableTest, SanitizeURLs); | 152 FRIEND_TEST_ALL_PREFIXES(KeywordTableTest, SanitizeURLs); |
| 150 FRIEND_TEST_ALL_PREFIXES(WebDatabaseMigrationTest, MigrateVersion44ToCurrent); | 153 FRIEND_TEST_ALL_PREFIXES(WebDatabaseMigrationTest, MigrateVersion44ToCurrent); |
| 151 | 154 |
| 152 // NOTE: Since the table columns have changed in different versions, many | 155 // NOTE: Since the table columns have changed in different versions, many |
| 153 // functions below take a |table_version| argument which dictates which | 156 // functions below take a |table_version| argument which dictates which |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 187 // keyword. Returns true on success, false otherwise. | 190 // keyword. Returns true on success, false otherwise. |
| 188 bool GetKeywordAsString(TemplateURLID id, | 191 bool GetKeywordAsString(TemplateURLID id, |
| 189 const std::string& table_name, | 192 const std::string& table_name, |
| 190 std::string* result); | 193 std::string* result); |
| 191 | 194 |
| 192 // Updates default search provider id backup in |meta| table. Returns | 195 // Updates default search provider id backup in |meta| table. Returns |
| 193 // true on success. The id is returned back via |id| parameter. | 196 // true on success. The id is returned back via |id| parameter. |
| 194 bool UpdateDefaultSearchProviderIDBackup(TemplateURLID* id); | 197 bool UpdateDefaultSearchProviderIDBackup(TemplateURLID* id); |
| 195 | 198 |
| 196 // Migrates table |name| (which should be either "keywords" or | 199 // Migrates table |name| (which should be either "keywords" or |
| 197 // "keywords_backup" from version 44 to version 45. | 200 // "keywords_backup") from version 44 to version 45. |
| 198 bool MigrateKeywordsTableForVersion45(const std::string& name); | 201 bool MigrateKeywordsTableForVersion45(const std::string& name); |
| 199 | 202 |
| 200 // Whether the backup was overwritten during migration. | 203 // Whether the backup was overwritten during migration. |
| 201 bool backup_overwritten_; | 204 bool backup_overwritten_; |
| 202 | 205 |
| 203 DISALLOW_COPY_AND_ASSIGN(KeywordTable); | 206 DISALLOW_COPY_AND_ASSIGN(KeywordTable); |
| 204 }; | 207 }; |
| 205 | 208 |
| 206 #endif // CHROME_BROWSER_WEBDATA_KEYWORD_TABLE_H_ | 209 #endif // CHROME_BROWSER_WEBDATA_KEYWORD_TABLE_H_ |
| OLD | NEW |