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

Unified Diff: chrome/browser/download/download_util.cc

Issue 22640018: Set up Finch trial for malware download warnings (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/download/download_util.cc
diff --git a/chrome/browser/download/download_util.cc b/chrome/browser/download/download_util.cc
index 8010f97301aaa887eaec16263d701d85170f2102..9c678133d4eb1595a3042d8f0d5ad0c096dc5593 100644
--- a/chrome/browser/download/download_util.cc
+++ b/chrome/browser/download/download_util.cc
@@ -269,4 +269,73 @@ void RecordDownloadSource(ChromeDownloadSource source) {
"Download.SourcesChrome", source, CHROME_DOWNLOAD_SOURCE_LAST_ENTRY);
}
+string16 AssembleMalwareFinchString(const std::string& trialCondition,
+ const string16& elided_filename) {
+ // Sanity check to make sure we have a filename.
+ string16 filename;
+ if (elided_filename == string16()) {
asanka 2013/08/09 18:50:17 Nit: elided_filename.empty()
felt 2013/08/09 19:13:15 Done.
+ filename = ASCIIToUTF16("This file");
+ } else {
+ filename = elided_filename;
+ }
+ // Set the message text according to the condition.
+ string16 message_text;
+ if (trialCondition == kCondition1Control) {
+ message_text = ASCIIToUTF16("This file appears malicious.");
+ } else if (trialCondition == kCondition2Control) {
+ message_text = ReplaceStringPlaceholders(
+ ASCIIToUTF16("$1 appears malicious."),
+ filename,
+ NULL);
+ } else if (trialCondition == kCondition3Malicious) {
+ message_text = ReplaceStringPlaceholders(
+ ASCIIToUTF16("$1 is malicious."),
+ filename,
+ NULL);
+ } else if (trialCondition == kCondition4Unsafe) {
+ message_text = ReplaceStringPlaceholders(
+ ASCIIToUTF16("$1 is unsafe."),
+ filename,
+ NULL);
+ } else if (trialCondition == kCondition5Dangerous) {
+ message_text = ReplaceStringPlaceholders(
+ ASCIIToUTF16("$1 is dangerous."),
+ filename,
+ NULL);
+ } else if (trialCondition == kCondition6Harmful) {
+ message_text = ReplaceStringPlaceholders(
+ ASCIIToUTF16("$1 is harmful."),
+ filename,
+ NULL);
+ } else if (trialCondition == kCondition7DiscardSecond) {
+ message_text = ReplaceStringPlaceholders(
+ ASCIIToUTF16("$1 is malicious. Discard this file to stay safe."),
+ filename,
+ NULL);
+ } else if (trialCondition == kCondition8DiscardFirst) {
+ message_text = ReplaceStringPlaceholders(
+ ASCIIToUTF16("Discard this file to stay safe. $1 is malicious."),
+ filename,
+ NULL);
+ } else if (trialCondition == kCondition9SafeDiscard) {
+ message_text = ReplaceStringPlaceholders(
+ ASCIIToUTF16("$1 is malicious. To stay safe, discard it."),
+ filename,
+ NULL);
+ } else if (trialCondition == kCondition10SafeDontRun) {
+ message_text = ReplaceStringPlaceholders(
+ ASCIIToUTF16("$1 is malicious. To stay safe, don't run it."),
+ filename,
+ NULL);
+ } else {
+ // We use the second control as a default for other conditions that don't
+ // change the warning string.
+ message_text = ReplaceStringPlaceholders(
+ ASCIIToUTF16("$1 appears malicious."),
+ filename,
+ NULL);
+ }
+ return message_text;
+}
+
} // namespace download_util

Powered by Google App Engine
This is Rietveld 408576698