Chromium Code Reviews| Index: chrome/browser/safe_browsing/safe_browsing_blocking_page.cc |
| diff --git a/chrome/browser/safe_browsing/safe_browsing_blocking_page.cc b/chrome/browser/safe_browsing/safe_browsing_blocking_page.cc |
| index 032d5eceab5296580fbec821803a52e81f08e190..3725ffec0ce999f21855cb5506aa7e768934f75b 100644 |
| --- a/chrome/browser/safe_browsing/safe_browsing_blocking_page.cc |
| +++ b/chrome/browser/safe_browsing/safe_browsing_blocking_page.cc |
| @@ -119,6 +119,29 @@ SafeBrowsingBlockingPageFactory* SafeBrowsingBlockingPage::factory_ = NULL; |
| static base::LazyInstance<SafeBrowsingBlockingPage::UnsafeResourceMap> |
|
James Hawkins
2013/05/06 18:13:57
nit: All of these non-class statics should be adde
felt
2013/05/06 19:47:52
Done.
|
| g_unsafe_resource_map = LAZY_INSTANCE_INITIALIZER; |
| +namespace { |
| + |
| +// These are the conditions for the summer 2013 Finch experiment. |
| +const char* kMalwareStudyName = "InterstitialMalware310"; |
| +const char* kPhishingStudyName = "InterstitialPhishing564"; |
| +const char* kCond1MalwareControl = "cond1MalwareControl"; |
| +const char* kCond2MalwareNoBrand = "cond2MalwareNoBrand"; |
| +const char* kCond3PhishingControl = "cond3PhishingControl"; |
| +const char* kCond4PhishingNoBrand = "cond4PhishingNoBrand"; |
| +const char* kCond5MalwareOneStep = "cond5MalwareOneStep"; |
| +const char* kCond6PhishingOneStep = "cond6PhishingOneStep"; |
| +const char* kCond7MalwareFearMsg = "cond7MalwareFearMsg"; |
| +const char* kCond8PhishingFearMsg = "cond8PhishingFearMsg"; |
| +const char* kCond9MalwareCollabMsg = "cond9MalwareCollabMsg"; |
| +const char* kCond10PhishingCollabMsg = "cond10PhishingCollabMsg"; |
| +const char* kCond11MalwareQuestion = "cond11MalwareQuestion"; |
| +const char* kCond12PhishingQuestion = "cond12PhishingQuestion"; |
| +const char* kCond13MalwareGoBack = "cond13MalwareGoBack"; |
| +const char* kCond14PhishingGoBack = "cond14PhishingGoBack"; |
| + |
| +} // namespace |
|
James Hawkins
2013/05/06 18:13:57
nit: Two spaces before start of comment.
felt
2013/05/06 19:47:52
Done.
|
| + |
| + |
| // The default SafeBrowsingBlockingPageFactory. Global, made a singleton so we |
| // don't leak it. |
| class SafeBrowsingBlockingPageFactoryImpl |
| @@ -129,7 +152,7 @@ class SafeBrowsingBlockingPageFactoryImpl |
| WebContents* web_contents, |
| const SafeBrowsingBlockingPage::UnsafeResourceList& unsafe_resources) |
| OVERRIDE { |
| - // Only do the trial if the interstitial is for a single malware or |
| + // Only use the V2 page if the interstitial is for a single malware or |
| // phishing resource, the multi-threat interstitial has not been updated to |
| // V2 yet. |
| if (unsafe_resources.size() == 1 && |
| @@ -483,6 +506,9 @@ void SafeBrowsingBlockingPage::RecordUserAction(BlockingPageEvent event) { |
| PHISHING_DONT_PROCEED, |
| PHISHING_FORCED_DONT_PROCEED, |
| PHISHING_PROCEED, |
| + MALWARE_SHOW_ADVANCED, |
| + MULTIPLE_SHOW_ADVANCED, |
| + PHISHING_SHOW_ADVANCED, |
| MAX_ACTION |
| } histogram_action = MAX_ACTION; |
| @@ -540,6 +566,19 @@ void SafeBrowsingBlockingPage::RecordUserAction(BlockingPageEvent event) { |
| } |
| } |
| break; |
| + case SHOW_ADVANCED: |
| + switch (interstitial_type_) { |
| + case TYPE_MALWARE_AND_PHISHING: |
| + histogram_action = MULTIPLE_SHOW_ADVANCED; |
| + break; |
| + case TYPE_MALWARE: |
| + histogram_action = MALWARE_SHOW_ADVANCED; |
| + break; |
| + case TYPE_PHISHING: |
| + histogram_action = PHISHING_SHOW_ADVANCED; |
| + break; |
| + } |
| + break; |
| default: |
| NOTREACHED() << "Unexpected event: " << event; |
| } |
| @@ -619,7 +658,7 @@ void SafeBrowsingBlockingPage::RecordUserReactionTime( |
| // interstitial. |
| if (has_expanded_see_more_section_) |
| return; |
| - |
| + RecordUserAction(SHOW_ADVANCED); |
| UMA_HISTOGRAM_MEDIUM_TIMES("SB2.MalwareInterstitialTimeExpandedSeeMore", |
| dt); |
| has_expanded_see_more_section_ = true; |
| @@ -646,7 +685,7 @@ void SafeBrowsingBlockingPage::RecordUserReactionTime( |
| // interstitial. |
| if (has_expanded_see_more_section_) |
| return; |
| - |
| + RecordUserAction(SHOW_ADVANCED); |
| UMA_HISTOGRAM_MEDIUM_TIMES("SB2.PhishingInterstitialTimeExpandedSeeMore", |
| dt); |
| has_expanded_see_more_section_ = true; |
| @@ -891,6 +930,16 @@ SafeBrowsingBlockingPageV2::SafeBrowsingBlockingPageV2( |
| WebContents* web_contents, |
| const UnsafeResourceList& unsafe_resources) |
| : SafeBrowsingBlockingPage(ui_manager, web_contents, unsafe_resources) { |
| + if (unsafe_resources_[0].threat_type == SB_THREAT_TYPE_URL_MALWARE) { |
| + trialCondition_ = |
| + base::FieldTrialList::FindFullName(kMalwareStudyName); |
| + } else if (unsafe_resources_[0].threat_type == |
| + SB_THREAT_TYPE_URL_PHISHING || |
| + unsafe_resources_[0].threat_type == |
| + SB_THREAT_TYPE_CLIENT_SIDE_PHISHING_URL) { |
| + trialCondition_ = |
| + base::FieldTrialList::FindFullName(kPhishingStudyName); |
| + } |
| } |
| std::string SafeBrowsingBlockingPageV2::GetHTMLContents() { |
| @@ -948,6 +997,35 @@ void SafeBrowsingBlockingPageV2::PopulateStringDictionary( |
| strings->SetString("proceed", |
| l10n_util::GetStringUTF16(IDS_SAFE_BROWSING_MALWARE_V2_PROCEED_LINK)); |
| + // Field trial |
| + strings->SetString("trialType", trialCondition_); |
| + if (trialCondition_ == kCond7MalwareFearMsg) { |
| + strings->SetString("headLine", |
| + l10n_util::GetStringUTF16(IDS_SAFE_BROWSING_MALWARE_FEAR_HEADLINE)); |
| + } else if (trialCondition_ == kCond8PhishingFearMsg) { |
| + strings->SetString("headLine", |
| + l10n_util::GetStringUTF16(IDS_SAFE_BROWSING_PHISHING_FEAR_HEADLINE)); |
| + } else if (trialCondition_ == kCond9MalwareCollabMsg) { |
| + strings->SetString("headLine", |
| + l10n_util::GetStringUTF16(IDS_SAFE_BROWSING_MALWARE_COLLAB_HEADLINE)); |
| + } else if (trialCondition_ == kCond10PhishingCollabMsg) { |
| + strings->SetString("headLine", |
| + l10n_util::GetStringUTF16(IDS_SAFE_BROWSING_PHISHING_COLLAB_HEADLINE)); |
| + } else if (trialCondition_ == kCond11MalwareQuestion) { |
| + strings->SetString("headLine", |
| + l10n_util::GetStringUTF16(IDS_SAFE_BROWSING_MALWARE_QUESTION_HEADLINE)); |
| + } else if (trialCondition_ == kCond12PhishingQuestion) { |
| + strings->SetString("headLine", |
| + l10n_util::GetStringUTF16( |
| + IDS_SAFE_BROWSING_PHISHING_QUESTION_HEADLINE)); |
| + } else if (trialCondition_ == kCond13MalwareGoBack) { |
| + strings->SetString("headLine", |
| + l10n_util::GetStringUTF16(IDS_SAFE_BROWSING_MALWARE_BACK_HEADLINE)); |
| + } else if (trialCondition_ == kCond14PhishingGoBack) { |
| + strings->SetString("headLine", |
| + l10n_util::GetStringUTF16(IDS_SAFE_BROWSING_PHISHING_BACK_HEADLINE)); |
| + } |
| + |
| webui::SetFontAndTextDirection(strings); |
| } |