OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 COMPONENTS_SEARCH_ENGINES_KEYWORD_TABLE_H_ | 5 #ifndef COMPONENTS_SEARCH_ENGINES_KEYWORD_TABLE_H_ |
6 #define COMPONENTS_SEARCH_ENGINES_KEYWORD_TABLE_H_ | 6 #define COMPONENTS_SEARCH_ENGINES_KEYWORD_TABLE_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 | 85 |
86 typedef std::pair<OperationType, TemplateURLData> Operation; | 86 typedef std::pair<OperationType, TemplateURLData> Operation; |
87 typedef std::vector<Operation> Operations; | 87 typedef std::vector<Operation> Operations; |
88 typedef std::vector<TemplateURLData> Keywords; | 88 typedef std::vector<TemplateURLData> Keywords; |
89 | 89 |
90 // Constants exposed for the benefit of test code: | 90 // Constants exposed for the benefit of test code: |
91 | 91 |
92 static const char kDefaultSearchProviderKey[]; | 92 static const char kDefaultSearchProviderKey[]; |
93 | 93 |
94 KeywordTable(); | 94 KeywordTable(); |
95 virtual ~KeywordTable(); | 95 ~KeywordTable() override; |
96 | 96 |
97 // Retrieves the KeywordTable* owned by |database|. | 97 // Retrieves the KeywordTable* owned by |database|. |
98 static KeywordTable* FromWebDatabase(WebDatabase* db); | 98 static KeywordTable* FromWebDatabase(WebDatabase* db); |
99 | 99 |
100 virtual WebDatabaseTable::TypeKey GetTypeKey() const override; | 100 WebDatabaseTable::TypeKey GetTypeKey() const override; |
101 virtual bool CreateTablesIfNecessary() override; | 101 bool CreateTablesIfNecessary() override; |
102 virtual bool IsSyncable() override; | 102 bool IsSyncable() override; |
103 virtual bool MigrateToVersion(int version, | 103 bool MigrateToVersion(int version, bool* update_compatible_version) override; |
104 bool* update_compatible_version) override; | |
105 | 104 |
106 // Performs an arbitrary number of Add/Remove/Update operations as a single | 105 // Performs an arbitrary number of Add/Remove/Update operations as a single |
107 // transaction. This is provided for efficiency reasons: if the caller needs | 106 // transaction. This is provided for efficiency reasons: if the caller needs |
108 // to perform a large number of operations, doing them in a single transaction | 107 // to perform a large number of operations, doing them in a single transaction |
109 // instead of one-per-transaction can be dramatically more efficient. | 108 // instead of one-per-transaction can be dramatically more efficient. |
110 bool PerformOperations(const Operations& operations); | 109 bool PerformOperations(const Operations& operations); |
111 | 110 |
112 // Loads the keywords into the specified vector. It's up to the caller to | 111 // Loads the keywords into the specified vector. It's up to the caller to |
113 // delete the returned objects. | 112 // delete the returned objects. |
114 // Returns true on success. | 113 // Returns true on success. |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
176 std::string* result); | 175 std::string* result); |
177 | 176 |
178 // Migrates table |name| (which should be either "keywords" or | 177 // Migrates table |name| (which should be either "keywords" or |
179 // "keywords_backup") from version 44 to version 45. | 178 // "keywords_backup") from version 44 to version 45. |
180 bool MigrateKeywordsTableForVersion45(const std::string& name); | 179 bool MigrateKeywordsTableForVersion45(const std::string& name); |
181 | 180 |
182 DISALLOW_COPY_AND_ASSIGN(KeywordTable); | 181 DISALLOW_COPY_AND_ASSIGN(KeywordTable); |
183 }; | 182 }; |
184 | 183 |
185 #endif // COMPONENTS_SEARCH_ENGINES_KEYWORD_TABLE_H_ | 184 #endif // COMPONENTS_SEARCH_ENGINES_KEYWORD_TABLE_H_ |
OLD | NEW |