| 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 // |resource_keyword_version| should contain the version number of the current |
| 57 // keyword data, i.e. the version number of the most recent prepopulate data |
| 58 // that has been merged into the current keyword data. On exit, this will be |
| 59 // set as in GetSearchProvidersUsingKeywordResult(). |
| 60 void GetSearchProvidersUsingLoadedEngines( |
| 61 WebDataService* service, |
| 62 Profile* profile, |
| 63 TemplateURLService::TemplateURLVector* template_urls, |
| 64 TemplateURL** default_search_provider, |
| 65 int* resource_keyword_version, |
| 66 std::set<std::string>* removed_keyword_guids); |
| 67 |
| 53 // Due to a bug, the |input_encodings| field of TemplateURLData could have | 68 // Due to a bug, the |input_encodings| field of TemplateURLData could have |
| 54 // contained duplicate entries. This removes those entries and returns whether | 69 // contained duplicate entries. This removes those entries and returns whether |
| 55 // any were found. | 70 // any were found. |
| 56 bool DeDupeEncodings(std::vector<std::string>* encodings); | 71 bool DeDupeEncodings(std::vector<std::string>* encodings); |
| 57 | 72 |
| 58 // Removes (and deletes) TemplateURLs from |template_urls| and |service| if they | 73 // Removes (and deletes) TemplateURLs from |template_urls| and |service| if they |
| 59 // have duplicate prepopulate ids. If |removed_keyword_guids| is not NULL, the | 74 // 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 | 75 // 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 | 76 // helper used by GetSearchProvidersUsingKeywordResult(), but is declared here |
| 62 // so it's accessible by unittests. | 77 // so it's accessible by unittests. |
| 63 void RemoveDuplicatePrepopulateIDs( | 78 void RemoveDuplicatePrepopulateIDs( |
| 64 WebDataService* service, | 79 WebDataService* service, |
| 65 const ScopedVector<TemplateURL>& prepopulated_urls, | 80 const ScopedVector<TemplateURL>& prepopulated_urls, |
| 66 TemplateURL* default_search_provider, | 81 TemplateURL* default_search_provider, |
| 67 TemplateURLService::TemplateURLVector* template_urls, | 82 TemplateURLService::TemplateURLVector* template_urls, |
| 68 std::set<std::string>* removed_keyword_guids); | 83 std::set<std::string>* removed_keyword_guids); |
| 69 | 84 |
| 70 #endif // CHROME_BROWSER_SEARCH_ENGINES_UTIL_H_ | 85 #endif // CHROME_BROWSER_SEARCH_ENGINES_UTIL_H_ |
| OLD | NEW |