• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 #ifndef CHROME_BROWSER_SEARCH_ENGINES_UTIL_H_
6 #define CHROME_BROWSER_SEARCH_ENGINES_UTIL_H_
7 #pragma once
8 
9 // This file contains utility functions for search engine functionality.
10 #include <vector>
11 
12 #include "base/string16.h"
13 
14 class PrefService;
15 class Profile;
16 class TemplateURL;
17 class WDTypedResult;
18 class WebDataService;
19 
20 // Returns the short name of the default search engine, or the empty string if
21 // none is set. |profile| may be NULL.
22 string16 GetDefaultSearchEngineName(Profile* profile);
23 
24 // Processes the results of WebDataService::GetKeywords, combining it with
25 // prepopulated search providers to result in:
26 //  * a set of template_urls (search providers). The caller owns the
27 //    TemplateURL* returned in template_urls.
28 //  * the default search provider (and if *default_search_provider is not NULL,
29 //    it is contained in template_urls).
30 //  * whether there is a new resource keyword version (and the value).
31 //    |*new_resource_keyword_version| is set to 0 if no new value. Otherwise,
32 //    it is the new value.
33 // Only pass in a non-NULL value for service if the WebDataService should be
34 // updated.
35 void GetSearchProvidersUsingKeywordResult(
36     const WDTypedResult& result,
37     WebDataService* service,
38     PrefService* prefs,
39     std::vector<TemplateURL*>* template_urls,
40     const TemplateURL** default_search_provider,
41     int* new_resource_keyword_version);
42 
43 #endif  // CHROME_BROWSER_SEARCH_ENGINES_UTIL_H_
44