Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(269)

Side by Side Diff: chrome/browser/importer/importer_uma.cc

Issue 1465853002: Implement support for importing favorites from Edge on Windows 10. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added missing include files Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 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 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 #include "build/build_config.h" 5 #include "build/build_config.h"
6 #include "chrome/browser/importer/importer_uma.h" 6 #include "chrome/browser/importer/importer_uma.h"
7 7
8 namespace importer { 8 namespace importer {
9 9
10 namespace { 10 namespace {
11 11
12 // The enum used to register importer use. 12 // The enum used to register importer use.
13 enum ImporterTypeMetrics { 13 enum ImporterTypeMetrics {
14 IMPORTER_METRICS_UNKNOWN = 0, 14 IMPORTER_METRICS_UNKNOWN = 0,
15 #if defined(OS_WIN) 15 #if defined(OS_WIN)
16 IMPORTER_METRICS_IE = 1, 16 IMPORTER_METRICS_IE = 1,
17 #endif 17 #endif
18 IMPORTER_METRICS_FIREFOX2 = 2, // obsolete 18 IMPORTER_METRICS_FIREFOX2 = 2, // obsolete
19 IMPORTER_METRICS_FIREFOX3 = 3, 19 IMPORTER_METRICS_FIREFOX3 = 3,
20 #if defined(OS_MACOSX) 20 #if defined(OS_MACOSX)
21 IMPORTER_METRICS_SAFARI = 4, 21 IMPORTER_METRICS_SAFARI = 4,
22 #endif 22 #endif
23 IMPORTER_METRICS_GOOGLE_TOOLBAR5 = 5, // obsolete 23 IMPORTER_METRICS_GOOGLE_TOOLBAR5 = 5, // obsolete
24 IMPORTER_METRICS_BOOKMARKS_FILE = 6, 24 IMPORTER_METRICS_BOOKMARKS_FILE = 6,
25 #if defined(OS_WIN)
26 IMPORTER_METRICS_EDGE = 7,
27 #endif
25 28
26 // Insert new values here. Never remove any existing values, as this enum is 29 // 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. 30 // used to bucket a UMA histogram, and removing values breaks that.
28 IMPORTER_METRICS_SIZE 31 IMPORTER_METRICS_SIZE
29 }; 32 };
30 33
31 } // namespace 34 } // namespace
32 35
33 void LogImporterUseToMetrics(const std::string& metric_postfix, 36 void LogImporterUseToMetrics(const std::string& metric_postfix,
34 ImporterType type) { 37 ImporterType type) {
35 ImporterTypeMetrics metrics_type = IMPORTER_METRICS_UNKNOWN; 38 ImporterTypeMetrics metrics_type = IMPORTER_METRICS_UNKNOWN;
36 switch (type) { 39 switch (type) {
37 case TYPE_UNKNOWN: 40 case TYPE_UNKNOWN:
38 metrics_type = IMPORTER_METRICS_UNKNOWN; 41 metrics_type = IMPORTER_METRICS_UNKNOWN;
39 break; 42 break;
40 #if defined(OS_WIN) 43 #if defined(OS_WIN)
41 case TYPE_IE: 44 case TYPE_IE:
42 metrics_type = IMPORTER_METRICS_IE; 45 metrics_type = IMPORTER_METRICS_IE;
43 break; 46 break;
47 case TYPE_EDGE:
48 metrics_type = IMPORTER_METRICS_EDGE;
49 break;
44 #endif 50 #endif
45 case TYPE_FIREFOX: 51 case TYPE_FIREFOX:
46 metrics_type = IMPORTER_METRICS_FIREFOX3; 52 metrics_type = IMPORTER_METRICS_FIREFOX3;
47 break; 53 break;
48 #if defined(OS_MACOSX) 54 #if defined(OS_MACOSX)
49 case TYPE_SAFARI: 55 case TYPE_SAFARI:
50 metrics_type = IMPORTER_METRICS_SAFARI; 56 metrics_type = IMPORTER_METRICS_SAFARI;
51 break; 57 break;
52 #endif 58 #endif
53 case TYPE_BOOKMARKS_FILE: 59 case TYPE_BOOKMARKS_FILE:
54 metrics_type = IMPORTER_METRICS_BOOKMARKS_FILE; 60 metrics_type = IMPORTER_METRICS_BOOKMARKS_FILE;
55 break; 61 break;
56 } 62 }
57 63
58 // Note: This leaks memory, which is the expected behavior as the factory 64 // Note: This leaks memory, which is the expected behavior as the factory
59 // creates and owns the histogram. 65 // creates and owns the histogram.
60 base::HistogramBase* histogram = 66 base::HistogramBase* histogram =
61 base::LinearHistogram::FactoryGet( 67 base::LinearHistogram::FactoryGet(
62 "Import.ImporterType." + metric_postfix, 68 "Import.ImporterType." + metric_postfix,
63 1, 69 1,
64 IMPORTER_METRICS_SIZE, 70 IMPORTER_METRICS_SIZE,
65 IMPORTER_METRICS_SIZE + 1, 71 IMPORTER_METRICS_SIZE + 1,
66 base::HistogramBase::kUmaTargetedHistogramFlag); 72 base::HistogramBase::kUmaTargetedHistogramFlag);
67 histogram->Add(metrics_type); 73 histogram->Add(metrics_type);
68 } 74 }
69 75
70 } // namespace importer 76 } // namespace importer
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698