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