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

Unified Diff: chrome/browser/ui/webui/downloads_dom_handler.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/ui/webui/downloads_dom_handler.cc
diff --git a/chrome/browser/ui/webui/downloads_dom_handler.cc b/chrome/browser/ui/webui/downloads_dom_handler.cc
index d9938b20ff3efc372542ed203fc6d35b00066f37..088c334ff34b1258334ad2380c019b9fcae9eebf 100644
--- a/chrome/browser/ui/webui/downloads_dom_handler.cc
+++ b/chrome/browser/ui/webui/downloads_dom_handler.cc
@@ -13,6 +13,7 @@
#include "base/i18n/rtl.h"
#include "base/i18n/time_formatting.h"
#include "base/memory/singleton.h"
+#include "base/metrics/field_trial.h"
#include "base/metrics/histogram.h"
#include "base/prefs/pref_service.h"
#include "base/strings/string_piece.h"
@@ -167,6 +168,9 @@ DictionaryValue* CreateDownloadItemValue(
file_value->SetBoolean("retry", false); // Overridden below if needed.
file_value->SetBoolean("resume", download_item->CanResume());
+ std::string trialCondition =
Dan Beam 2013/08/09 18:54:05 trial_condition (cpp_vars_like_this, jsVarsLikeThi
felt 2013/08/09 19:13:15 Done here & elsewhere
+ base::FieldTrialList::FindFullName(download_util::kFinchTrialName);
+
switch (download_item->GetState()) {
case content::DownloadItem::IN_PROGRESS:
if (download_item->IsDangerous()) {
@@ -187,6 +191,20 @@ DictionaryValue* CreateDownloadItemValue(
const char* danger_type_value =
GetDangerTypeString(download_item->GetDangerType());
file_value->SetString("danger_type", danger_type_value);
+ if ((trialCondition != "") &&
Dan Beam 2013/08/09 18:54:05 if (!trial_condition.empty()) { std::string finc
felt 2013/08/09 19:13:15 Done, thanks
+ (download_item->GetDangerType() ==
+ content::DOWNLOAD_DANGER_TYPE_DANGEROUS_URL ||
+ download_item->GetDangerType() ==
+ content::DOWNLOAD_DANGER_TYPE_DANGEROUS_CONTENT ||
+ download_item->GetDangerType() ==
+ content::DOWNLOAD_DANGER_TYPE_DANGEROUS_HOST)) {
+ file_value->SetString(
+ "finch_string",
+ download_util::AssembleMalwareFinchString(trialCondition,
+ file_name));
+ } else {
+ file_value->SetString("finch_string", "");
+ }
} else if (download_item->IsPaused()) {
file_value->SetString("state", "PAUSED");
} else {

Powered by Google App Engine
This is Rietveld 408576698