| OLD | NEW |
| 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 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 122 return l10n_util::GetStringFUTF8( | 122 return l10n_util::GetStringFUTF8( |
| 123 IDS_EXTENSION_PROGRAMMATIC_UNINSTALL_PROMPT_HEADING, | 123 IDS_EXTENSION_PROGRAMMATIC_UNINSTALL_PROMPT_HEADING, |
| 124 base::UTF8ToUTF16(triggering_extension_->name()), | 124 base::UTF8ToUTF16(triggering_extension_->name()), |
| 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 return base::FieldTrialList::FindFullName("ExtensionUninstall.ReportAbuse") == |
| 133 static const char kDefaultGroupName[] = "Default"; | 133 "ShowCheckbox"; |
| 134 static const char kShowCheckboxGroup[] = "ShowCheckbox"; | |
| 135 | |
| 136 // Important: Only initialize the trial once. | |
| 137 if (!base::FieldTrialList::Find(kExperimentName)) { | |
| 138 // TODO(devlin): Turn on this field trial. See crbug.com/441377. | |
| 139 scoped_refptr<base::FieldTrial> trial( | |
| 140 base::FieldTrialList::FactoryGetFieldTrial( | |
| 141 kExperimentName, | |
| 142 100, // Total probability. | |
| 143 kDefaultGroupName, | |
| 144 2015, 7, 31, // End date. | |
| 145 base::FieldTrial::ONE_TIME_RANDOMIZED, | |
| 146 nullptr)); | |
| 147 trial->AppendGroup(kShowCheckboxGroup, 0); | |
| 148 } | |
| 149 | |
| 150 return base::FieldTrialList::FindFullName(kExperimentName) == | |
| 151 kShowCheckboxGroup; | |
| 152 } | 134 } |
| 153 | 135 |
| 154 void ExtensionUninstallDialog::HandleReportAbuse() { | 136 void ExtensionUninstallDialog::HandleReportAbuse() { |
| 155 chrome::NavigateParams params( | 137 chrome::NavigateParams params( |
| 156 profile_, | 138 profile_, |
| 157 extension_urls::GetWebstoreReportAbuseUrl(extension_->id()), | 139 extension_urls::GetWebstoreReportAbuseUrl(extension_->id()), |
| 158 ui::PAGE_TRANSITION_LINK); | 140 ui::PAGE_TRANSITION_LINK); |
| 159 params.disposition = NEW_FOREGROUND_TAB; | 141 params.disposition = NEW_FOREGROUND_TAB; |
| 160 chrome::Navigate(¶ms); | 142 chrome::Navigate(¶ms); |
| 161 } | 143 } |
| 162 | 144 |
| 163 } // namespace extensions | 145 } // namespace extensions |
| OLD | NEW |