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

Side by Side Diff: chrome/browser/safe_browsing/chrome_cleaner/srt_field_trial_win.cc

Issue 2949633002: Do not tie cleanup tool download to SRTPromptFieldTrial field trial (Closed)
Patch Set: Use newer API Created 3 years, 6 months 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
« no previous file with comments | « no previous file | chrome/browser/safe_browsing/chrome_cleaner/srt_field_trial_win_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/chrome_cleaner/srt_field_trial_win.h" 5 #include "chrome/browser/safe_browsing/chrome_cleaner/srt_field_trial_win.h"
6 6
7 #include "base/metrics/field_trial.h" 7 #include "base/metrics/field_trial.h"
8 #include "base/metrics/field_trial_params.h"
8 #include "base/metrics/histogram_macros.h" 9 #include "base/metrics/histogram_macros.h"
9 #include "base/strings/string_util.h" 10 #include "base/strings/string_util.h"
10 #include "base/win/windows_version.h" 11 #include "base/win/windows_version.h"
11 #include "components/variations/variations_associated_data.h" 12 #include "components/variations/variations_associated_data.h"
12 #include "url/origin.h" 13 #include "url/origin.h"
13 14
14 namespace { 15 namespace {
15 16
16 // Field trial strings. 17 // Field trial strings.
17 const char kSRTPromptTrial[] = "SRTPromptFieldTrial"; 18 const char kSRTPromptTrial[] = "SRTPromptFieldTrial";
(...skipping 18 matching lines...) Expand all
36 "https://dl.google.com/dl" 37 "https://dl.google.com/dl"
37 "/softwareremovaltool/win/c/chrome_cleanup_tool.exe?chrome-prompt=1"; 38 "/softwareremovaltool/win/c/chrome_cleanup_tool.exe?chrome-prompt=1";
38 39
39 } // namespace 40 } // namespace
40 41
41 namespace safe_browsing { 42 namespace safe_browsing {
42 43
43 const base::Feature kInBrowserCleanerUIFeature{ 44 const base::Feature kInBrowserCleanerUIFeature{
44 "InBrowserCleanerUI", base::FEATURE_DISABLED_BY_DEFAULT}; 45 "InBrowserCleanerUI", base::FEATURE_DISABLED_BY_DEFAULT};
45 46
47 const base::Feature kCleanerDownloadFeature{"DownloadCleanupToolByBitness",
48 base::FEATURE_DISABLED_BY_DEFAULT};
49
46 bool IsInSRTPromptFieldTrialGroups() { 50 bool IsInSRTPromptFieldTrialGroups() {
47 return !base::StartsWith(base::FieldTrialList::FindFullName(kSRTPromptTrial), 51 return !base::StartsWith(base::FieldTrialList::FindFullName(kSRTPromptTrial),
48 kSRTPromptOffGroup, base::CompareCase::SENSITIVE); 52 kSRTPromptOffGroup, base::CompareCase::SENSITIVE);
49 } 53 }
50 54
51 bool SRTPromptNeedsElevationIcon() { 55 bool SRTPromptNeedsElevationIcon() {
52 return !base::StartsWith( 56 return !base::StartsWith(
53 base::FieldTrialList::FindFullName(kSRTElevationTrial), 57 base::FieldTrialList::FindFullName(kSRTElevationTrial),
54 kSRTElevationAsNeededGroup, base::CompareCase::SENSITIVE); 58 kSRTElevationAsNeededGroup, base::CompareCase::SENSITIVE);
55 } 59 }
56 60
57 bool IsSwReporterEnabled() { 61 bool IsSwReporterEnabled() {
58 return !base::StartsWith( 62 return !base::StartsWith(
59 base::FieldTrialList::FindFullName(kSRTReporterTrial), 63 base::FieldTrialList::FindFullName(kSRTReporterTrial),
60 kSRTReporterOffGroup, base::CompareCase::SENSITIVE); 64 kSRTReporterOffGroup, base::CompareCase::SENSITIVE);
61 } 65 }
62 66
63 GURL GetLegacyDownloadURL() { 67 GURL GetLegacyDownloadURL() {
64 if (base::StartsWith(base::FieldTrialList::FindFullName(kSRTPromptTrial), 68 if (base::StartsWith(base::FieldTrialList::FindFullName(kSRTPromptTrial),
65 kSRTCanaryGroup, base::CompareCase::SENSITIVE)) { 69 kSRTCanaryGroup, base::CompareCase::SENSITIVE)) {
66 return GURL(kCanarySRTDownloadURL); 70 return GURL(kCanarySRTDownloadURL);
67 } 71 }
68 return GURL(kMainSRTDownloadURL); 72 return GURL(kMainSRTDownloadURL);
69 } 73 }
70 74
71 GURL GetSRTDownloadURL() { 75 GURL GetSRTDownloadURL() {
72 constexpr char kDownloadGroupParam[] = "download_group"; 76 constexpr char kDownloadGroupParam[] = "download_group";
73 const std::string download_group = 77 const std::string download_group = base::GetFieldTrialParamValueByFeature(
74 variations::GetVariationParamValue(kSRTPromptTrial, kDownloadGroupParam); 78 kCleanerDownloadFeature, kDownloadGroupParam);
75 if (download_group.empty()) 79 if (download_group.empty())
76 return GetLegacyDownloadURL(); 80 return GetLegacyDownloadURL();
77 81
78 std::string architecture = base::win::OSInfo::GetInstance()->architecture() == 82 std::string architecture = base::win::OSInfo::GetInstance()->architecture() ==
79 base::win::OSInfo::X86_ARCHITECTURE 83 base::win::OSInfo::X86_ARCHITECTURE
80 ? "x86" 84 ? "x86"
81 : "x64"; 85 : "x64";
82 86
83 // Construct download URL using the following pattern: 87 // Construct download URL using the following pattern:
84 // https://dl.google.com/.../win/{arch}/{group}/chrome_cleanup_tool.exe 88 // https://dl.google.com/.../win/{arch}/{group}/chrome_cleanup_tool.exe
(...skipping 16 matching lines...) Expand all
101 return variations::GetVariationParamValue(kSRTPromptTrial, 105 return variations::GetVariationParamValue(kSRTPromptTrial,
102 kSRTPromptSeedParam); 106 kSRTPromptSeedParam);
103 } 107 }
104 108
105 void RecordSRTPromptHistogram(SRTPromptHistogramValue value) { 109 void RecordSRTPromptHistogram(SRTPromptHistogramValue value) {
106 UMA_HISTOGRAM_ENUMERATION("SoftwareReporter.PromptUsage", value, 110 UMA_HISTOGRAM_ENUMERATION("SoftwareReporter.PromptUsage", value,
107 SRT_PROMPT_MAX); 111 SRT_PROMPT_MAX);
108 } 112 }
109 113
110 } // namespace safe_browsing 114 } // namespace safe_browsing
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/safe_browsing/chrome_cleaner/srt_field_trial_win_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698