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/strings/string16.h" | 14 #include "base/strings/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 // Returns a GURL that searches for |terms| using the default search engine of |
| 27 // |profile|. |
| 28 GURL GetDefaultSearchURLForSearchTerms(Profile* profile, const string16& terms); |
| 29 |
26 // Modifies |prepopulated_url| so that it contains user-modified fields from | 30 // Modifies |prepopulated_url| so that it contains user-modified fields from |
27 // |original_turl|. Both URLs must have the same prepopulate_id. | 31 // |original_turl|. Both URLs must have the same prepopulate_id. |
28 void MergeIntoPrepopulatedEngineData(TemplateURLData* prepopulated_url, | 32 void MergeIntoPrepopulatedEngineData(TemplateURLData* prepopulated_url, |
29 const TemplateURL* original_turl); | 33 const TemplateURL* original_turl); |
30 | 34 |
31 // Processes the results of WebDataService::GetKeywords, combining it with | 35 // Processes the results of WebDataService::GetKeywords, combining it with |
32 // prepopulated search providers to result in: | 36 // prepopulated search providers to result in: |
33 // * a set of template_urls (search providers). The caller owns the | 37 // * a set of template_urls (search providers). The caller owns the |
34 // TemplateURL* returned in template_urls. | 38 // TemplateURL* returned in template_urls. |
35 // * the default search provider (and if *default_search_provider is not NULL, | 39 // * the default search provider (and if *default_search_provider is not NULL, |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 // helper used by GetSearchProvidersUsingKeywordResult(), but is declared here | 80 // helper used by GetSearchProvidersUsingKeywordResult(), but is declared here |
77 // so it's accessible by unittests. | 81 // so it's accessible by unittests. |
78 void RemoveDuplicatePrepopulateIDs( | 82 void RemoveDuplicatePrepopulateIDs( |
79 WebDataService* service, | 83 WebDataService* service, |
80 const ScopedVector<TemplateURL>& prepopulated_urls, | 84 const ScopedVector<TemplateURL>& prepopulated_urls, |
81 TemplateURL* default_search_provider, | 85 TemplateURL* default_search_provider, |
82 TemplateURLService::TemplateURLVector* template_urls, | 86 TemplateURLService::TemplateURLVector* template_urls, |
83 std::set<std::string>* removed_keyword_guids); | 87 std::set<std::string>* removed_keyword_guids); |
84 | 88 |
85 #endif // CHROME_BROWSER_SEARCH_ENGINES_UTIL_H_ | 89 #endif // CHROME_BROWSER_SEARCH_ENGINES_UTIL_H_ |
OLD | NEW |