Chromium Code Reviews| 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/strings/utf_string_conversions.h" | 11 #include "base/strings/utf_string_conversions.h" |
| 11 #include "chrome/browser/extensions/extension_util.h" | 12 #include "chrome/browser/extensions/extension_util.h" |
| 12 #include "chrome/browser/profiles/profile.h" | 13 #include "chrome/browser/profiles/profile.h" |
| 13 #include "chrome/browser/ui/browser_navigator.h" | 14 #include "chrome/browser/ui/browser_navigator.h" |
| 14 #include "chrome/grit/generated_resources.h" | 15 #include "chrome/grit/generated_resources.h" |
| 15 #include "extensions/browser/extension_registry.h" | 16 #include "extensions/browser/extension_registry.h" |
| 16 #include "extensions/browser/image_loader.h" | 17 #include "extensions/browser/image_loader.h" |
| 17 #include "extensions/common/constants.h" | 18 #include "extensions/common/constants.h" |
| 18 #include "extensions/common/extension.h" | 19 #include "extensions/common/extension.h" |
| 19 #include "extensions/common/extension_icon_set.h" | 20 #include "extensions/common/extension_icon_set.h" |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 121 return l10n_util::GetStringFUTF8( | 122 return l10n_util::GetStringFUTF8( |
| 122 IDS_EXTENSION_PROGRAMMATIC_UNINSTALL_PROMPT_HEADING, | 123 IDS_EXTENSION_PROGRAMMATIC_UNINSTALL_PROMPT_HEADING, |
| 123 base::UTF8ToUTF16(triggering_extension_->name()), | 124 base::UTF8ToUTF16(triggering_extension_->name()), |
| 124 base::UTF8ToUTF16(extension_->name())); | 125 base::UTF8ToUTF16(extension_->name())); |
| 125 } | 126 } |
| 126 return l10n_util::GetStringFUTF8(IDS_EXTENSION_UNINSTALL_PROMPT_HEADING, | 127 return l10n_util::GetStringFUTF8(IDS_EXTENSION_UNINSTALL_PROMPT_HEADING, |
| 127 base::UTF8ToUTF16(extension_->name())); | 128 base::UTF8ToUTF16(extension_->name())); |
| 128 } | 129 } |
| 129 | 130 |
| 130 bool ExtensionUninstallDialog::ShouldShowReportAbuseCheckbox() const { | 131 bool ExtensionUninstallDialog::ShouldShowReportAbuseCheckbox() const { |
| 131 // TODO(devlin): Add a field trial for reporting abuse on uninstallation. | 132 static const char kExperimentName[] = "ExtensionUninstall.ReportAbuse"; |
| 132 // See crbug.com/441377. | 133 static const char kControlGroupName[] = "Control"; |
| 133 return false; | 134 static const char kShowCheckboxGroup[] = "ShowCheckbox"; |
| 135 // TODO(devlin): Turn on this field trial. See crbug.com/441377. | |
| 136 scoped_refptr<base::FieldTrial> trial( | |
| 137 base::FieldTrialList::FactoryGetFieldTrial( | |
| 138 kExperimentName, | |
| 139 100, // Total probability. | |
| 140 kControlGroupName, | |
|
Finnur
2015/03/23 11:08:55
It is unusual to see a control group named here. U
Devlin
2015/03/23 15:43:23
I figured that the default would be the control (s
| |
| 141 2015, 7, 31, // End date. | |
| 142 base::FieldTrial::ONE_TIME_RANDOMIZED, | |
| 143 nullptr)); | |
| 144 int experiment_group = trial->AppendGroup(kShowCheckboxGroup, 0); | |
|
Finnur
2015/03/23 11:08:55
Don't you want this to be > 0 and remove the TODO?
Devlin
2015/03/23 15:43:23
Not quite yet - we're still waiting on UI feedback
| |
| 145 return base::FieldTrialList::FindValue(kExperimentName) == experiment_group; | |
| 134 } | 146 } |
| 135 | 147 |
| 136 void ExtensionUninstallDialog::HandleReportAbuse() { | 148 void ExtensionUninstallDialog::HandleReportAbuse() { |
| 137 chrome::NavigateParams params( | 149 chrome::NavigateParams params( |
| 138 profile_, | 150 profile_, |
| 139 extension_urls::GetWebstoreReportAbuseUrl(extension_->id()), | 151 extension_urls::GetWebstoreReportAbuseUrl(extension_->id()), |
| 140 ui::PAGE_TRANSITION_LINK); | 152 ui::PAGE_TRANSITION_LINK); |
| 141 params.disposition = NEW_FOREGROUND_TAB; | 153 params.disposition = NEW_FOREGROUND_TAB; |
| 142 chrome::Navigate(¶ms); | 154 chrome::Navigate(¶ms); |
| 143 } | 155 } |
| 144 | 156 |
| 145 } // namespace extensions | 157 } // namespace extensions |
| OLD | NEW |