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

Side by Side Diff: chrome/browser/download/download_danger_prompt.cc

Issue 22640018: Set up Finch trial for malware download warnings (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: string16 to base string 16 Created 7 years, 4 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 | Annotate | Revision Log
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/download/download_danger_prompt.h" 5 #include "chrome/browser/download/download_danger_prompt.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/metrics/field_trial.h"
8 #include "chrome/browser/chrome_notification_types.h" 9 #include "chrome/browser/chrome_notification_types.h"
9 #include "chrome/browser/download/chrome_download_manager_delegate.h" 10 #include "chrome/browser/download/chrome_download_manager_delegate.h"
11 #include "chrome/browser/download/download_util.h"
10 #include "chrome/browser/ui/tab_modal_confirm_dialog.h" 12 #include "chrome/browser/ui/tab_modal_confirm_dialog.h"
11 #include "chrome/browser/ui/tab_modal_confirm_dialog_delegate.h" 13 #include "chrome/browser/ui/tab_modal_confirm_dialog_delegate.h"
12 #include "content/public/browser/download_danger_type.h" 14 #include "content/public/browser/download_danger_type.h"
13 #include "content/public/browser/download_item.h" 15 #include "content/public/browser/download_item.h"
14 #include "grit/chromium_strings.h" 16 #include "grit/chromium_strings.h"
15 #include "grit/generated_resources.h" 17 #include "grit/generated_resources.h"
16 #include "ui/base/l10n/l10n_util.h" 18 #include "ui/base/l10n/l10n_util.h"
17 19
18 namespace { 20 namespace {
19 21
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 } 97 }
96 98
97 string16 DownloadDangerPromptImpl::GetTitle() { 99 string16 DownloadDangerPromptImpl::GetTitle() {
98 return l10n_util::GetStringUTF16(IDS_CONFIRM_KEEP_DANGEROUS_DOWNLOAD_TITLE); 100 return l10n_util::GetStringUTF16(IDS_CONFIRM_KEEP_DANGEROUS_DOWNLOAD_TITLE);
99 } 101 }
100 102
101 string16 DownloadDangerPromptImpl::GetMessage() { 103 string16 DownloadDangerPromptImpl::GetMessage() {
102 if (!show_context_) 104 if (!show_context_)
103 return l10n_util::GetStringUTF16( 105 return l10n_util::GetStringUTF16(
104 IDS_PROMPT_CONFIRM_KEEP_DANGEROUS_DOWNLOAD); 106 IDS_PROMPT_CONFIRM_KEEP_DANGEROUS_DOWNLOAD);
107 std::string trial_condition =
108 base::FieldTrialList::FindFullName(download_util::kFinchTrialName);
105 switch (download_->GetDangerType()) { 109 switch (download_->GetDangerType()) {
106 case content::DOWNLOAD_DANGER_TYPE_DANGEROUS_FILE: 110 case content::DOWNLOAD_DANGER_TYPE_DANGEROUS_FILE:
107 return l10n_util::GetStringFUTF16( 111 return l10n_util::GetStringFUTF16(
108 IDS_PROMPT_DANGEROUS_DOWNLOAD, 112 IDS_PROMPT_DANGEROUS_DOWNLOAD,
109 download_->GetFileNameToReportUser().LossyDisplayName()); 113 download_->GetFileNameToReportUser().LossyDisplayName());
110 case content::DOWNLOAD_DANGER_TYPE_DANGEROUS_URL: // Fall through 114 case content::DOWNLOAD_DANGER_TYPE_DANGEROUS_URL: // Fall through
111 case content::DOWNLOAD_DANGER_TYPE_DANGEROUS_CONTENT: 115 case content::DOWNLOAD_DANGER_TYPE_DANGEROUS_CONTENT:
112 case content::DOWNLOAD_DANGER_TYPE_DANGEROUS_HOST: 116 case content::DOWNLOAD_DANGER_TYPE_DANGEROUS_HOST:
Dan Beam 2013/08/09 23:24:51 nit: lower |trial_condition| to here
felt 2013/08/09 23:48:34 I don't think I can do this because of compiler er
113 return l10n_util::GetStringFUTF16( 117 if (trial_condition.empty()) {
114 IDS_PROMPT_MALICIOUS_DOWNLOAD_CONTENT, 118 return l10n_util::GetStringFUTF16(
115 download_->GetFileNameToReportUser().LossyDisplayName()); 119 IDS_PROMPT_MALICIOUS_DOWNLOAD_CONTENT,
120 download_->GetFileNameToReportUser().LossyDisplayName());
121 } else {
Dan Beam 2013/08/10 00:13:56 and here
felt 2013/08/10 00:33:00 Done.
122 return download_util::AssembleMalwareFinchString(
123 trial_condition,
124 download_->GetFileNameToReportUser().LossyDisplayName());
125 }
116 case content::DOWNLOAD_DANGER_TYPE_UNCOMMON_CONTENT: 126 case content::DOWNLOAD_DANGER_TYPE_UNCOMMON_CONTENT:
117 return l10n_util::GetStringFUTF16( 127 return l10n_util::GetStringFUTF16(
118 IDS_PROMPT_UNCOMMON_DOWNLOAD_CONTENT, 128 IDS_PROMPT_UNCOMMON_DOWNLOAD_CONTENT,
119 download_->GetFileNameToReportUser().LossyDisplayName()); 129 download_->GetFileNameToReportUser().LossyDisplayName());
120 case content::DOWNLOAD_DANGER_TYPE_POTENTIALLY_UNWANTED: 130 case content::DOWNLOAD_DANGER_TYPE_POTENTIALLY_UNWANTED:
121 return l10n_util::GetStringFUTF16( 131 return l10n_util::GetStringFUTF16(
122 IDS_PROMPT_DOWNLOAD_CHANGES_SEARCH_SETTINGS, 132 IDS_PROMPT_DOWNLOAD_CHANGES_SEARCH_SETTINGS,
123 download_->GetFileNameToReportUser().LossyDisplayName()); 133 download_->GetFileNameToReportUser().LossyDisplayName());
124 case content::DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS: 134 case content::DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS:
125 case content::DOWNLOAD_DANGER_TYPE_MAYBE_DANGEROUS_CONTENT: 135 case content::DOWNLOAD_DANGER_TYPE_MAYBE_DANGEROUS_CONTENT:
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
169 content::DownloadItem* item, 179 content::DownloadItem* item,
170 content::WebContents* web_contents, 180 content::WebContents* web_contents,
171 bool show_context, 181 bool show_context,
172 const OnDone& done) { 182 const OnDone& done) {
173 DownloadDangerPromptImpl* prompt = new DownloadDangerPromptImpl( 183 DownloadDangerPromptImpl* prompt = new DownloadDangerPromptImpl(
174 item, web_contents, show_context, done); 184 item, web_contents, show_context, done);
175 // |prompt| will be deleted when the dialog is done. 185 // |prompt| will be deleted when the dialog is done.
176 TabModalConfirmDialog::Create(prompt, web_contents); 186 TabModalConfirmDialog::Create(prompt, web_contents);
177 return prompt; 187 return prompt;
178 } 188 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/download/download_item_model.cc » ('j') | chrome/browser/download/download_item_model.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698