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