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_SEARCH_ENGINES_UTIL_H_ | 5 #ifndef CHROME_BROWSER_SEARCH_ENGINES_UTIL_H_ |
6 #define CHROME_BROWSER_SEARCH_ENGINES_UTIL_H_ | 6 #define CHROME_BROWSER_SEARCH_ENGINES_UTIL_H_ |
7 | 7 |
8 // This file contains utility functions for search engine functionality. | 8 // This file contains utility functions for search engine functionality. |
9 #include <set> | 9 #include <set> |
10 #include <string> | 10 #include <string> |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
43 // added to it. | 43 // added to it. |
44 void GetSearchProvidersUsingKeywordResult( | 44 void GetSearchProvidersUsingKeywordResult( |
45 const WDTypedResult& result, | 45 const WDTypedResult& result, |
46 WebDataService* service, | 46 WebDataService* service, |
47 Profile* profile, | 47 Profile* profile, |
48 TemplateURLService::TemplateURLVector* template_urls, | 48 TemplateURLService::TemplateURLVector* template_urls, |
49 TemplateURL** default_search_provider, | 49 TemplateURL** default_search_provider, |
50 int* new_resource_keyword_version, | 50 int* new_resource_keyword_version, |
51 std::set<std::string>* removed_keyword_guids); | 51 std::set<std::string>* removed_keyword_guids); |
52 | 52 |
53 // Processes the |*template_urls|, combining it with | |
54 // prepopulated search providers to result in: | |
55 // * a set of template_urls (search providers). The caller owns the | |
56 // TemplateURL* returned in template_urls. | |
57 // * the default search provider (and if *default_search_provider is not NULL, | |
58 // it is contained in template_urls). | |
59 // * whether there is a new resource keyword version (and the value). | |
60 // |*new_resource_keyword_version| is set to 0 if no new value. Otherwise, | |
61 // it is the new value. | |
62 // Only pass in a non-NULL value for service if the WebDataService should be | |
63 // updated. If |removed_keyword_guids| is not NULL, any TemplateURLs removed | |
64 // from the keyword table in the WebDataService will have their Sync GUIDs | |
65 // added to it. | |
66 // |*new_resource_keyword_version| should contain current version of | |
67 // |*template_urls|. | |
Peter Kasting
2013/05/22 21:22:57
This comment is confusing. How about just this:
vasilii
2013/05/23 17:03:42
Done.
| |
68 void GetSearchProvidersUsingLoadedEngines( | |
69 WebDataService* service, | |
70 Profile* profile, | |
71 TemplateURLService::TemplateURLVector* template_urls, | |
72 TemplateURL** default_search_provider, | |
73 int* new_resource_keyword_version, | |
74 std::set<std::string>* removed_keyword_guids); | |
75 | |
53 // Due to a bug, the |input_encodings| field of TemplateURLData could have | 76 // Due to a bug, the |input_encodings| field of TemplateURLData could have |
54 // contained duplicate entries. This removes those entries and returns whether | 77 // contained duplicate entries. This removes those entries and returns whether |
55 // any were found. | 78 // any were found. |
56 bool DeDupeEncodings(std::vector<std::string>* encodings); | 79 bool DeDupeEncodings(std::vector<std::string>* encodings); |
57 | 80 |
58 // Removes (and deletes) TemplateURLs from |template_urls| and |service| if they | 81 // Removes (and deletes) TemplateURLs from |template_urls| and |service| if they |
59 // have duplicate prepopulate ids. If |removed_keyword_guids| is not NULL, the | 82 // have duplicate prepopulate ids. If |removed_keyword_guids| is not NULL, the |
60 // Sync GUID of each item removed from the DB will be added to it. This is a | 83 // Sync GUID of each item removed from the DB will be added to it. This is a |
61 // helper used by GetSearchProvidersUsingKeywordResult(), but is declared here | 84 // helper used by GetSearchProvidersUsingKeywordResult(), but is declared here |
62 // so it's accessible by unittests. | 85 // so it's accessible by unittests. |
63 void RemoveDuplicatePrepopulateIDs( | 86 void RemoveDuplicatePrepopulateIDs( |
64 WebDataService* service, | 87 WebDataService* service, |
65 const ScopedVector<TemplateURL>& prepopulated_urls, | 88 const ScopedVector<TemplateURL>& prepopulated_urls, |
66 TemplateURL* default_search_provider, | 89 TemplateURL* default_search_provider, |
67 TemplateURLService::TemplateURLVector* template_urls, | 90 TemplateURLService::TemplateURLVector* template_urls, |
68 std::set<std::string>* removed_keyword_guids); | 91 std::set<std::string>* removed_keyword_guids); |
69 | 92 |
70 #endif // CHROME_BROWSER_SEARCH_ENGINES_UTIL_H_ | 93 #endif // CHROME_BROWSER_SEARCH_ENGINES_UTIL_H_ |
OLD | NEW |