| 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" | |
| 11 #include "base/metrics/histogram_macros.h" | 10 #include "base/metrics/histogram_macros.h" |
| 12 #include "base/strings/utf_string_conversions.h" | 11 #include "base/strings/utf_string_conversions.h" |
| 13 #include "chrome/browser/extensions/extension_util.h" | 12 #include "chrome/browser/extensions/extension_util.h" |
| 14 #include "chrome/browser/profiles/profile.h" | 13 #include "chrome/browser/profiles/profile.h" |
| 15 #include "chrome/browser/ui/browser_navigator.h" | 14 #include "chrome/browser/ui/browser_navigator.h" |
| 16 #include "chrome/grit/generated_resources.h" | 15 #include "chrome/grit/generated_resources.h" |
| 17 #include "extensions/browser/extension_registry.h" | 16 #include "extensions/browser/extension_registry.h" |
| 18 #include "extensions/browser/image_loader.h" | 17 #include "extensions/browser/image_loader.h" |
| 19 #include "extensions/common/constants.h" | 18 #include "extensions/common/constants.h" |
| 20 #include "extensions/common/extension.h" | 19 #include "extensions/common/extension.h" |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 124 return l10n_util::GetStringFUTF8( | 123 return l10n_util::GetStringFUTF8( |
| 125 IDS_EXTENSION_PROGRAMMATIC_UNINSTALL_PROMPT_HEADING, | 124 IDS_EXTENSION_PROGRAMMATIC_UNINSTALL_PROMPT_HEADING, |
| 126 base::UTF8ToUTF16(triggering_extension_->name()), | 125 base::UTF8ToUTF16(triggering_extension_->name()), |
| 127 base::UTF8ToUTF16(extension_->name())); | 126 base::UTF8ToUTF16(extension_->name())); |
| 128 } | 127 } |
| 129 return l10n_util::GetStringFUTF8(IDS_EXTENSION_UNINSTALL_PROMPT_HEADING, | 128 return l10n_util::GetStringFUTF8(IDS_EXTENSION_UNINSTALL_PROMPT_HEADING, |
| 130 base::UTF8ToUTF16(extension_->name())); | 129 base::UTF8ToUTF16(extension_->name())); |
| 131 } | 130 } |
| 132 | 131 |
| 133 bool ExtensionUninstallDialog::ShouldShowReportAbuseCheckbox() const { | 132 bool ExtensionUninstallDialog::ShouldShowReportAbuseCheckbox() const { |
| 134 return ManifestURL::UpdatesFromGallery(extension_) && | 133 return ManifestURL::UpdatesFromGallery(extension_); |
| 135 base::FieldTrialList::FindFullName("ExtensionUninstall.ReportAbuse") == | |
| 136 "ShowCheckbox"; | |
| 137 } | 134 } |
| 138 | 135 |
| 139 void ExtensionUninstallDialog::OnDialogClosed(CloseAction action) { | 136 void ExtensionUninstallDialog::OnDialogClosed(CloseAction action) { |
| 140 // We don't want to artificially weight any of the options, so only record if | 137 // We don't want to artificially weight any of the options, so only record if |
| 141 // reporting abuse was available. | 138 // reporting abuse was available. |
| 142 if (ShouldShowReportAbuseCheckbox()) { | 139 if (ShouldShowReportAbuseCheckbox()) { |
| 143 UMA_HISTOGRAM_ENUMERATION("Extensions.UninstallDialogAction", | 140 UMA_HISTOGRAM_ENUMERATION("Extensions.UninstallDialogAction", |
| 144 action, | 141 action, |
| 145 CLOSE_ACTION_LAST); | 142 CLOSE_ACTION_LAST); |
| 146 } | 143 } |
| 147 } | 144 } |
| 148 | 145 |
| 149 void ExtensionUninstallDialog::HandleReportAbuse() { | 146 void ExtensionUninstallDialog::HandleReportAbuse() { |
| 150 chrome::NavigateParams params( | 147 chrome::NavigateParams params( |
| 151 profile_, | 148 profile_, |
| 152 extension_urls::GetWebstoreReportAbuseUrl(extension_->id()), | 149 extension_urls::GetWebstoreReportAbuseUrl(extension_->id()), |
| 153 ui::PAGE_TRANSITION_LINK); | 150 ui::PAGE_TRANSITION_LINK); |
| 154 params.disposition = NEW_FOREGROUND_TAB; | 151 params.disposition = NEW_FOREGROUND_TAB; |
| 155 chrome::Navigate(¶ms); | 152 chrome::Navigate(¶ms); |
| 156 } | 153 } |
| 157 | 154 |
| 158 } // namespace extensions | 155 } // namespace extensions |
| OLD | NEW |