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

Side by Side Diff: chrome/browser/extensions/extension_uninstall_dialog.cc

Issue 1023673011: [Extensions] Fix report abuse field trial crash (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 9 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 | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/extensions/extension_uninstall_dialog.h" 5 #include "chrome/browser/extensions/extension_uninstall_dialog.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/message_loop/message_loop.h" 9 #include "base/message_loop/message_loop.h"
10 #include "base/metrics/field_trial.h" 10 #include "base/metrics/field_trial.h"
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 base::UTF8ToUTF16(extension_->name())); 125 base::UTF8ToUTF16(extension_->name()));
126 } 126 }
127 return l10n_util::GetStringFUTF8(IDS_EXTENSION_UNINSTALL_PROMPT_HEADING, 127 return l10n_util::GetStringFUTF8(IDS_EXTENSION_UNINSTALL_PROMPT_HEADING,
128 base::UTF8ToUTF16(extension_->name())); 128 base::UTF8ToUTF16(extension_->name()));
129 } 129 }
130 130
131 bool ExtensionUninstallDialog::ShouldShowReportAbuseCheckbox() const { 131 bool ExtensionUninstallDialog::ShouldShowReportAbuseCheckbox() const {
132 static const char kExperimentName[] = "ExtensionUninstall.ReportAbuse"; 132 static const char kExperimentName[] = "ExtensionUninstall.ReportAbuse";
133 static const char kDefaultGroupName[] = "Default"; 133 static const char kDefaultGroupName[] = "Default";
134 static const char kShowCheckboxGroup[] = "ShowCheckbox"; 134 static const char kShowCheckboxGroup[] = "ShowCheckbox";
135 // TODO(devlin): Turn on this field trial. See crbug.com/441377. 135
136 scoped_refptr<base::FieldTrial> trial( 136 // Important: Only initialize the trial once.
137 base::FieldTrialList::FactoryGetFieldTrial( 137 if (!base::FieldTrialList::Find(kExperimentName)) {
138 kExperimentName, 138 // TODO(devlin): Turn on this field trial. See crbug.com/441377.
Alexei Svitkine (slow) 2015/03/31 20:50:53 The client-side API to create a field trial, like
139 100, // Total probability. 139 scoped_refptr<base::FieldTrial> trial(
140 kDefaultGroupName, 140 base::FieldTrialList::FactoryGetFieldTrial(
141 2015, 7, 31, // End date. 141 kExperimentName,
142 base::FieldTrial::ONE_TIME_RANDOMIZED, 142 100, // Total probability.
143 nullptr)); 143 kDefaultGroupName,
144 int experiment_group = trial->AppendGroup(kShowCheckboxGroup, 0); 144 2015, 7, 31, // End date.
145 return base::FieldTrialList::FindValue(kExperimentName) == experiment_group; 145 base::FieldTrial::ONE_TIME_RANDOMIZED,
146 nullptr));
147 trial->AppendGroup(kShowCheckboxGroup, 0);
148 }
149
150 return base::FieldTrialList::FindFullName(kExperimentName) ==
151 kShowCheckboxGroup;
146 } 152 }
147 153
148 void ExtensionUninstallDialog::HandleReportAbuse() { 154 void ExtensionUninstallDialog::HandleReportAbuse() {
149 chrome::NavigateParams params( 155 chrome::NavigateParams params(
150 profile_, 156 profile_,
151 extension_urls::GetWebstoreReportAbuseUrl(extension_->id()), 157 extension_urls::GetWebstoreReportAbuseUrl(extension_->id()),
152 ui::PAGE_TRANSITION_LINK); 158 ui::PAGE_TRANSITION_LINK);
153 params.disposition = NEW_FOREGROUND_TAB; 159 params.disposition = NEW_FOREGROUND_TAB;
154 chrome::Navigate(&params); 160 chrome::Navigate(&params);
155 } 161 }
156 162
157 } // namespace extensions 163 } // namespace extensions
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698