1 // Copyright 2013 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.
5 #include "build/build_config.h"
6 #include "chrome/browser/importer/importer_uma.h"
12 // The enum used to register importer use.
13 enum ImporterTypeMetrics
{
14 IMPORTER_METRICS_UNKNOWN
= 0,
16 IMPORTER_METRICS_IE
= 1,
18 IMPORTER_METRICS_FIREFOX2
= 2, // obsolete
19 IMPORTER_METRICS_FIREFOX3
= 3,
20 #if defined(OS_MACOSX)
21 IMPORTER_METRICS_SAFARI
= 4,
23 IMPORTER_METRICS_GOOGLE_TOOLBAR5
= 5, // obsolete
24 IMPORTER_METRICS_BOOKMARKS_FILE
= 6,
26 // Insert new values here. Never remove any existing values, as this enum is
27 // used to bucket a UMA histogram, and removing values breaks that.
33 void LogImporterUseToMetrics(const std::string
& metric_postfix
,
35 ImporterTypeMetrics metrics_type
= IMPORTER_METRICS_UNKNOWN
;
38 metrics_type
= IMPORTER_METRICS_UNKNOWN
;
42 metrics_type
= IMPORTER_METRICS_IE
;
46 metrics_type
= IMPORTER_METRICS_FIREFOX3
;
48 #if defined(OS_MACOSX)
50 metrics_type
= IMPORTER_METRICS_SAFARI
;
53 case TYPE_BOOKMARKS_FILE
:
54 metrics_type
= IMPORTER_METRICS_BOOKMARKS_FILE
;
58 // Note: This leaks memory, which is the expected behavior as the factory
59 // creates and owns the histogram.
60 base::HistogramBase
* histogram
=
61 base::LinearHistogram::FactoryGet(
62 "Import.ImporterType." + metric_postfix
,
64 IMPORTER_METRICS_SIZE
,
65 IMPORTER_METRICS_SIZE
+ 1,
66 base::HistogramBase::kUmaTargetedHistogramFlag
);
67 histogram
->Add(metrics_type
);
70 } // namespace importer