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 #pragma once | 7 #pragma once |
8 | 8 |
9 // This file contains utility functions for search engine functionality. | 9 // This file contains utility functions for search engine functionality. |
10 #include <set> | 10 #include <set> |
(...skipping 28 matching lines...) Expand all Loading... |
39 // added to it. | 39 // added to it. |
40 void GetSearchProvidersUsingKeywordResult( | 40 void GetSearchProvidersUsingKeywordResult( |
41 const WDTypedResult& result, | 41 const WDTypedResult& result, |
42 WebDataService* service, | 42 WebDataService* service, |
43 Profile* profile, | 43 Profile* profile, |
44 TemplateURLService::TemplateURLVector* template_urls, | 44 TemplateURLService::TemplateURLVector* template_urls, |
45 TemplateURL** default_search_provider, | 45 TemplateURL** default_search_provider, |
46 int* new_resource_keyword_version, | 46 int* new_resource_keyword_version, |
47 std::set<std::string>* removed_keyword_guids); | 47 std::set<std::string>* removed_keyword_guids); |
48 | 48 |
| 49 // Due to a bug, the |input_encodings| field of TemplateURLData could have |
| 50 // contained duplicate entries. This removes those entries and returns whether |
| 51 // any were found. |
| 52 bool DeDupeEncodings(std::vector<std::string>* encodings); |
| 53 |
49 // Returns true if the default search provider setting has been changed or | 54 // Returns true if the default search provider setting has been changed or |
50 // corrupted. Returns the backup setting in |backup_default_search_provider|. | 55 // corrupted. Returns the backup setting in |backup_default_search_provider|. |
51 // |*backup_default_search_provider| can be NULL if the original setting is | 56 // |*backup_default_search_provider| can be NULL if the original setting is |
52 // lost. | 57 // lost. |
53 bool DidDefaultSearchProviderChange( | 58 bool DidDefaultSearchProviderChange( |
54 const WDTypedResult& result, | 59 const WDTypedResult& result, |
55 Profile* profile, | 60 Profile* profile, |
56 scoped_ptr<TemplateURL>* backup_default_search_provider); | 61 scoped_ptr<TemplateURL>* backup_default_search_provider); |
57 | 62 |
58 // Removes (and deletes) TemplateURLs from |template_urls| and |service| if they | 63 // Removes (and deletes) TemplateURLs from |template_urls| and |service| if they |
59 // have duplicate prepopulate ids. If |removed_keyword_guids| is not NULL, the | 64 // 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 | 65 // 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 | 66 // helper used by GetSearchProvidersUsingKeywordResult(), but is declared here |
62 // so it's accessible by unittests. | 67 // so it's accessible by unittests. |
63 void RemoveDuplicatePrepopulateIDs( | 68 void RemoveDuplicatePrepopulateIDs( |
64 WebDataService* service, | 69 WebDataService* service, |
65 const ScopedVector<TemplateURL>& prepopulated_urls, | 70 const ScopedVector<TemplateURL>& prepopulated_urls, |
66 TemplateURL* default_search_provider, | 71 TemplateURL* default_search_provider, |
67 TemplateURLService::TemplateURLVector* template_urls, | 72 TemplateURLService::TemplateURLVector* template_urls, |
68 std::set<std::string>* removed_keyword_guids); | 73 std::set<std::string>* removed_keyword_guids); |
69 | 74 |
70 #endif // CHROME_BROWSER_SEARCH_ENGINES_UTIL_H_ | 75 #endif // CHROME_BROWSER_SEARCH_ENGINES_UTIL_H_ |
OLD | NEW |