Chromium Code Reviews| 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 // Like GetSearchProvidersUsingKeywordResult(), but allows the caller to pass in | |
| 54 // engines in |template_urls| instead of getting them via processing a web data | |
| 55 // service request. | |
| 56 // |*new_resource_keyword_version| should contain current version of | |
| 57 // |*template_urls|. | |
|
Peter Kasting
2013/05/29 04:04:41
Nit: How about we name it |resource_keyword_versio
vasilii
2013/05/29 08:30:18
Done.
| |
| 58 void GetSearchProvidersUsingLoadedEngines( | |
| 59 WebDataService* service, | |
| 60 Profile* profile, | |
| 61 TemplateURLService::TemplateURLVector* template_urls, | |
| 62 TemplateURL** default_search_provider, | |
| 63 int* new_resource_keyword_version, | |
| 64 std::set<std::string>* removed_keyword_guids); | |
| 65 | |
| 53 // Due to a bug, the |input_encodings| field of TemplateURLData could have | 66 // Due to a bug, the |input_encodings| field of TemplateURLData could have |
| 54 // contained duplicate entries. This removes those entries and returns whether | 67 // contained duplicate entries. This removes those entries and returns whether |
| 55 // any were found. | 68 // any were found. |
| 56 bool DeDupeEncodings(std::vector<std::string>* encodings); | 69 bool DeDupeEncodings(std::vector<std::string>* encodings); |
| 57 | 70 |
| 58 // Removes (and deletes) TemplateURLs from |template_urls| and |service| if they | 71 // Removes (and deletes) TemplateURLs from |template_urls| and |service| if they |
| 59 // have duplicate prepopulate ids. If |removed_keyword_guids| is not NULL, the | 72 // 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 | 73 // 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 | 74 // helper used by GetSearchProvidersUsingKeywordResult(), but is declared here |
| 62 // so it's accessible by unittests. | 75 // so it's accessible by unittests. |
| 63 void RemoveDuplicatePrepopulateIDs( | 76 void RemoveDuplicatePrepopulateIDs( |
| 64 WebDataService* service, | 77 WebDataService* service, |
| 65 const ScopedVector<TemplateURL>& prepopulated_urls, | 78 const ScopedVector<TemplateURL>& prepopulated_urls, |
| 66 TemplateURL* default_search_provider, | 79 TemplateURL* default_search_provider, |
| 67 TemplateURLService::TemplateURLVector* template_urls, | 80 TemplateURLService::TemplateURLVector* template_urls, |
| 68 std::set<std::string>* removed_keyword_guids); | 81 std::set<std::string>* removed_keyword_guids); |
| 69 | 82 |
| 70 #endif // CHROME_BROWSER_SEARCH_ENGINES_UTIL_H_ | 83 #endif // CHROME_BROWSER_SEARCH_ENGINES_UTIL_H_ |
| OLD | NEW |