blob: b4b416cf6bc8d4ac121f678edc55a3ea6ab15912 (
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.
#include "chrome/browser/protector/histograms.h"
#include "base/memory/scoped_ptr.h"
#include "chrome/browser/search_engines/search_engine_type.h"
#include "chrome/browser/search_engines/template_url.h"
#include "chrome/browser/search_engines/template_url_prepopulate_data.h"
namespace protector {
const char kProtectorHistogramDefaultSearchProvider[] =
"Protector.DefaultSearchProvider";
const char kProtectorBackupInvalidCounter[] =
"Protector.BackupInvalidCounter";
const char kProtectorValueChangedCounter[] = "Protector.ValueChangedCounter";
const char kProtectorValueValidCounter[] = "Protector.ValueValidCounter";
const char kProtectorHistogramNewSearchProvider[] =
"Protector.SearchProvider.New";
const char kProtectorHistogramSearchProviderApplied[] =
"Protector.SearchProvider.Applied";
const char kProtectorHistogramSearchProviderDiscarded[] =
"Protector.SearchProvider.Discarded";
const char kProtectorHistogramSearchProviderFallback[] =
"Protector.SearchProvider.Fallback";
const char kProtectorHistogramSearchProviderMissing[] =
"Protector.SearchProvider.Missing";
const char kProtectorHistogramSearchProviderRestored[] =
"Protector.SearchProvider.Restored";
const char kProtectorHistogramSearchProviderTimeout[] =
"Protector.SearchProvider.Timeout";
const int kProtectorMaxSearchProviderID = SEARCH_ENGINE_MAX;
int GetSearchProviderHistogramID(const TemplateURL* t_url) {
if (t_url && t_url->url()) {
scoped_ptr<TemplateURL> prepopulated_url(
TemplateURLPrepopulateData::FindPrepopulatedEngine(
t_url->url()->url()));
if (prepopulated_url.get())
return static_cast<int>(prepopulated_url->search_engine_type());
}
// If |t_url| is NULL or not among the prepopulated providers, return
// SEARCH_ENGINE_OTHER as well.
return SEARCH_ENGINE_OTHER;
}
} // namespace protector
|