OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "chrome/browser/safe_browsing/srt_field_trial_win.h" | 5 #include "chrome/browser/safe_browsing/srt_field_trial_win.h" |
6 | 6 |
| 7 #include <sstream> |
| 8 |
7 #include "base/metrics/field_trial.h" | 9 #include "base/metrics/field_trial.h" |
8 #include "base/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
9 #include "base/strings/string_util.h" | 11 #include "base/strings/string_util.h" |
| 12 #include "base/strings/stringprintf.h" |
10 #include "components/variations/variations_associated_data.h" | 13 #include "components/variations/variations_associated_data.h" |
11 | 14 |
12 namespace { | 15 namespace { |
13 | 16 |
14 // Field trial strings. | 17 // Field trial strings. |
15 const char kSRTPromptTrial[] = "SRTPromptFieldTrial"; | 18 const char kSRTPromptTrial[] = "SRTPromptFieldTrial"; |
16 const char kSRTCanaryGroup[] = "SRTCanary"; | 19 const char kSRTCanaryGroup[] = "SRTCanary"; |
17 const char kSRTPromptOffGroup[] = "Off"; | 20 const char kSRTPromptOffGroup[] = "Off"; |
18 const char kSRTPromptSeedParam[] = "Seed"; | 21 const char kSRTPromptSeedParam[] = "Seed"; |
19 | 22 |
20 const char kSRTElevationTrial[] = "SRTElevation"; | 23 const char kSRTElevationTrial[] = "SRTElevation"; |
21 const char kSRTElevationAsNeededGroup[] = "AsNeeded"; | 24 const char kSRTElevationAsNeededGroup[] = "AsNeeded"; |
22 | 25 |
23 const char kSRTReporterTrial[] = "srt_reporter"; | 26 const char kSRTReporterTrial[] = "srt_reporter"; |
24 const char kSRTReporterOffGroup[] = "Off"; | 27 const char kSRTReporterOffGroup[] = "Off"; |
25 | 28 |
| 29 const char kSRTStepMetricName[] = "SoftwareReporter.Step"; |
| 30 |
26 // The download links of the Software Removal Tool. | 31 // The download links of the Software Removal Tool. |
27 const char kMainSRTDownloadURL[] = | 32 const char kMainSRTDownloadURL[] = |
28 "https://dl.google.com/dl" | 33 "https://dl.google.com/dl" |
29 "/softwareremovaltool/win/chrome_cleanup_tool.exe?chrome-prompt=1"; | 34 "/softwareremovaltool/win/chrome_cleanup_tool.exe?chrome-prompt=1"; |
30 const char kCanarySRTDownloadURL[] = | 35 const char kCanarySRTDownloadURL[] = |
31 "https://dl.google.com/dl" | 36 "https://dl.google.com/dl" |
32 "/softwareremovaltool/win/c/chrome_cleanup_tool.exe?chrome-prompt=1"; | 37 "/softwareremovaltool/win/c/chrome_cleanup_tool.exe?chrome-prompt=1"; |
33 | 38 |
34 } // namespace | 39 } // namespace |
35 | 40 |
(...skipping 27 matching lines...) Expand all Loading... |
63 std::string GetIncomingSRTSeed() { | 68 std::string GetIncomingSRTSeed() { |
64 return variations::GetVariationParamValue(kSRTPromptTrial, | 69 return variations::GetVariationParamValue(kSRTPromptTrial, |
65 kSRTPromptSeedParam); | 70 kSRTPromptSeedParam); |
66 } | 71 } |
67 | 72 |
68 void RecordSRTPromptHistogram(SRTPromptHistogramValue value) { | 73 void RecordSRTPromptHistogram(SRTPromptHistogramValue value) { |
69 UMA_HISTOGRAM_ENUMERATION("SoftwareReporter.PromptUsage", value, | 74 UMA_HISTOGRAM_ENUMERATION("SoftwareReporter.PromptUsage", value, |
70 SRT_PROMPT_MAX); | 75 SRT_PROMPT_MAX); |
71 } | 76 } |
72 | 77 |
73 void RecordReporterStepHistogram(SwReporterUmaValue value) { | 78 void RecordReporterStepHistogram(SwReporterUmaValue value, |
74 UMA_HISTOGRAM_ENUMERATION("SoftwareReporter.Step", value, SW_REPORTER_MAX); | 79 const std::string& suffix) { |
| 80 if (suffix.empty()) { |
| 81 UMA_HISTOGRAM_ENUMERATION(kSRTStepMetricName, value, SW_REPORTER_MAX); |
| 82 return; |
| 83 } |
| 84 UMA_HISTOGRAM_ENUMERATION( |
| 85 base::StringPrintf("%s_%s", kSRTStepMetricName, suffix).c_str(), |
| 86 value, SW_REPORTER_MAX); |
75 } | 87 } |
76 | 88 |
77 } // namespace safe_browsing | 89 } // namespace safe_browsing |
OLD | NEW |