OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 <vector> | 10 #include <vector> |
11 | 11 |
12 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
13 #include "base/string16.h" | 13 #include "base/string16.h" |
14 | 14 |
15 class PrefService; | |
16 class Profile; | 15 class Profile; |
17 class TemplateURL; | 16 class TemplateURL; |
18 class WDTypedResult; | 17 class WDTypedResult; |
19 class WebDataService; | 18 class WebDataService; |
20 | 19 |
21 // Returns the short name of the default search engine, or the empty string if | 20 // Returns the short name of the default search engine, or the empty string if |
22 // none is set. |profile| may be NULL. | 21 // none is set. |profile| may be NULL. |
23 string16 GetDefaultSearchEngineName(Profile* profile); | 22 string16 GetDefaultSearchEngineName(Profile* profile); |
24 | 23 |
25 // Processes the results of WebDataService::GetKeywords, combining it with | 24 // Processes the results of WebDataService::GetKeywords, combining it with |
26 // prepopulated search providers to result in: | 25 // prepopulated search providers to result in: |
27 // * a set of template_urls (search providers). The caller owns the | 26 // * a set of template_urls (search providers). The caller owns the |
28 // TemplateURL* returned in template_urls. | 27 // TemplateURL* returned in template_urls. |
29 // * the default search provider (and if *default_search_provider is not NULL, | 28 // * the default search provider (and if *default_search_provider is not NULL, |
30 // it is contained in template_urls). | 29 // it is contained in template_urls). |
31 // * whether there is a new resource keyword version (and the value). | 30 // * whether there is a new resource keyword version (and the value). |
32 // |*new_resource_keyword_version| is set to 0 if no new value. Otherwise, | 31 // |*new_resource_keyword_version| is set to 0 if no new value. Otherwise, |
33 // it is the new value. | 32 // it is the new value. |
34 // Only pass in a non-NULL value for service if the WebDataService should be | 33 // Only pass in a non-NULL value for service if the WebDataService should be |
35 // updated. | 34 // updated. |
36 void GetSearchProvidersUsingKeywordResult( | 35 void GetSearchProvidersUsingKeywordResult( |
37 const WDTypedResult& result, | 36 const WDTypedResult& result, |
38 WebDataService* service, | 37 WebDataService* service, |
39 PrefService* prefs, | 38 Profile* profile, |
40 std::vector<TemplateURL*>* template_urls, | 39 std::vector<TemplateURL*>* template_urls, |
41 const TemplateURL** default_search_provider, | 40 const TemplateURL** default_search_provider, |
42 int* new_resource_keyword_version); | 41 int* new_resource_keyword_version); |
43 | 42 |
44 // Returns true if the default search provider setting has been changed or | 43 // Returns true if the default search provider setting has been changed or |
45 // corrupted. Returns the backup setting in |backup_default_search_provider|. | 44 // corrupted. Returns the backup setting in |backup_default_search_provider|. |
46 // |*backup_default_search_provider| can be NULL if the original setting is | 45 // |*backup_default_search_provider| can be NULL if the original setting is |
47 // lost. | 46 // lost. |
48 bool DidDefaultSearchProviderChange( | 47 bool DidDefaultSearchProviderChange( |
49 const WDTypedResult& result, | 48 const WDTypedResult& result, |
| 49 Profile* profile, |
50 scoped_ptr<TemplateURL>* backup_default_search_provider); | 50 scoped_ptr<TemplateURL>* backup_default_search_provider); |
51 | 51 |
52 #endif // CHROME_BROWSER_SEARCH_ENGINES_UTIL_H_ | 52 #endif // CHROME_BROWSER_SEARCH_ENGINES_UTIL_H_ |
OLD | NEW |