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> |
11 #include <vector> | 11 #include <vector> |
12 | 12 |
13 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
14 #include "base/string16.h" | 14 #include "base/string16.h" |
15 #include "chrome/browser/search_engines/template_url_service.h" | 15 #include "chrome/browser/search_engines/template_url_service.h" |
16 | 16 |
17 class Profile; | 17 class Profile; |
18 class TemplateURL; | 18 class TemplateURL; |
19 class WDTypedResult; | 19 class WDTypedResult; |
20 class WebDataService; | 20 class WebDataService; |
21 | 21 |
22 // Returns the short name of the default search engine, or the empty string if | 22 // Returns the short name of the default search engine, or the empty string if |
23 // none is set. |profile| may be NULL. | 23 // none is set. |profile| may be NULL. |
24 string16 GetDefaultSearchEngineName(Profile* profile); | 24 string16 GetDefaultSearchEngineName(Profile* profile); |
25 | 25 |
| 26 // Modifies |prepopulated_url| so that it contains user-modified fields from |
| 27 // |original_turl|. Both URLs must have the same prepopulate_id. |
| 28 void MergeIntoPrepopulatedEngineData(TemplateURLData* prepopulated_url, |
| 29 const TemplateURL* original_turl); |
| 30 |
26 // Processes the results of WebDataService::GetKeywords, combining it with | 31 // Processes the results of WebDataService::GetKeywords, combining it with |
27 // prepopulated search providers to result in: | 32 // prepopulated search providers to result in: |
28 // * a set of template_urls (search providers). The caller owns the | 33 // * a set of template_urls (search providers). The caller owns the |
29 // TemplateURL* returned in template_urls. | 34 // TemplateURL* returned in template_urls. |
30 // * the default search provider (and if *default_search_provider is not NULL, | 35 // * the default search provider (and if *default_search_provider is not NULL, |
31 // it is contained in template_urls). | 36 // it is contained in template_urls). |
32 // * whether there is a new resource keyword version (and the value). | 37 // * whether there is a new resource keyword version (and the value). |
33 // |*new_resource_keyword_version| is set to 0 if no new value. Otherwise, | 38 // |*new_resource_keyword_version| is set to 0 if no new value. Otherwise, |
34 // it is the new value. | 39 // it is the new value. |
35 // Only pass in a non-NULL value for service if the WebDataService should be | 40 // Only pass in a non-NULL value for service if the WebDataService should be |
(...skipping 20 matching lines...) Expand all Loading... |
56 // helper used by GetSearchProvidersUsingKeywordResult(), but is declared here | 61 // helper used by GetSearchProvidersUsingKeywordResult(), but is declared here |
57 // so it's accessible by unittests. | 62 // so it's accessible by unittests. |
58 void RemoveDuplicatePrepopulateIDs( | 63 void RemoveDuplicatePrepopulateIDs( |
59 WebDataService* service, | 64 WebDataService* service, |
60 const ScopedVector<TemplateURL>& prepopulated_urls, | 65 const ScopedVector<TemplateURL>& prepopulated_urls, |
61 TemplateURL* default_search_provider, | 66 TemplateURL* default_search_provider, |
62 TemplateURLService::TemplateURLVector* template_urls, | 67 TemplateURLService::TemplateURLVector* template_urls, |
63 std::set<std::string>* removed_keyword_guids); | 68 std::set<std::string>* removed_keyword_guids); |
64 | 69 |
65 #endif // CHROME_BROWSER_SEARCH_ENGINES_UTIL_H_ | 70 #endif // CHROME_BROWSER_SEARCH_ENGINES_UTIL_H_ |
OLD | NEW |