Chromium Code Reviews| Index: chrome/browser/download/download_item_model.cc |
| diff --git a/chrome/browser/download/download_item_model.cc b/chrome/browser/download/download_item_model.cc |
| index b1c89fca2b294f477212fae55762f12646996472..900188b6f68a173c21aaf764449e9731e84ed82f 100644 |
| --- a/chrome/browser/download/download_item_model.cc |
| +++ b/chrome/browser/download/download_item_model.cc |
| @@ -6,12 +6,14 @@ |
| #include "base/i18n/number_formatting.h" |
| #include "base/i18n/rtl.h" |
| +#include "base/metrics/field_trial.h" |
| #include "base/strings/string16.h" |
| #include "base/strings/sys_string_conversions.h" |
| #include "base/strings/utf_string_conversions.h" |
| #include "base/supports_user_data.h" |
| #include "base/time/time.h" |
| #include "chrome/browser/download/download_crx_util.h" |
| +#include "chrome/browser/download/download_util.h" |
| #include "chrome/browser/safe_browsing/download_feedback_service.h" |
| #include "content/public/browser/download_danger_type.h" |
| #include "content/public/browser/download_interrupt_reasons.h" |
| @@ -301,12 +303,18 @@ string16 DownloadItemModel::GetWarningText(const gfx::Font& font, |
| int base_width) const { |
| // Should only be called if IsDangerous(). |
| DCHECK(IsDangerous()); |
| + std::string trial_condition = |
| + base::FieldTrialList::FindFullName(download_util::kFinchTrialName); |
| string16 elided_filename = |
| ui::ElideFilename(download_->GetFileNameToReportUser(), font, base_width); |
| switch (download_->GetDangerType()) { |
| case content::DOWNLOAD_DANGER_TYPE_DANGEROUS_URL: |
|
Dan Beam
2013/08/09 23:24:51
arguably, you'd put |trial_condition| here and bel
felt
2013/08/09 23:48:34
I'd like to do this, but it causes compiler errors
Dan Beam
2013/08/10 00:08:49
case content::DOWNLOAD_DANGER_TYPE_DANGEROUS_URL:
felt
2013/08/10 00:33:00
Done.
|
| - return l10n_util::GetStringUTF16(IDS_PROMPT_MALICIOUS_DOWNLOAD_URL); |
| - |
| + if (trial_condition.empty()) { |
| + return l10n_util::GetStringUTF16(IDS_PROMPT_MALICIOUS_DOWNLOAD_URL); |
| + } else { |
| + return download_util::AssembleMalwareFinchString(trial_condition, |
|
Dan Beam
2013/08/10 00:13:56
nit: also don't use else after an if + return, i.e
felt
2013/08/10 00:33:00
Done
|
| + elided_filename); |
| + } |
| case content::DOWNLOAD_DANGER_TYPE_DANGEROUS_FILE: |
| if (download_crx_util::IsExtensionDownload(*download_)) { |
| return l10n_util::GetStringUTF16( |
| @@ -315,12 +323,15 @@ string16 DownloadItemModel::GetWarningText(const gfx::Font& font, |
| return l10n_util::GetStringFUTF16(IDS_PROMPT_DANGEROUS_DOWNLOAD, |
| elided_filename); |
| } |
| - |
| case content::DOWNLOAD_DANGER_TYPE_DANGEROUS_CONTENT: |
| case content::DOWNLOAD_DANGER_TYPE_DANGEROUS_HOST: |
| - return l10n_util::GetStringFUTF16(IDS_PROMPT_MALICIOUS_DOWNLOAD_CONTENT, |
| - elided_filename); |
| - |
| + if (trial_condition.empty()) { |
| + return l10n_util::GetStringFUTF16(IDS_PROMPT_MALICIOUS_DOWNLOAD_CONTENT, |
| + elided_filename); |
| + } else { |
|
Dan Beam
2013/08/10 00:13:56
and here
felt
2013/08/10 00:33:00
Done.
|
| + return download_util::AssembleMalwareFinchString(trial_condition, |
| + elided_filename); |
| + } |
| case content::DOWNLOAD_DANGER_TYPE_UNCOMMON_CONTENT: |
| return l10n_util::GetStringFUTF16(IDS_PROMPT_UNCOMMON_DOWNLOAD_CONTENT, |
| elided_filename); |