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..f68c9574dd9568814e328c1e8c4ff046b03bd14c 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> |
| 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 |
| + |
| + |
| // 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 && |
| @@ -378,6 +401,8 @@ void SafeBrowsingBlockingPage::CommandReceived(const std::string& cmd) { |
| } |
| if (command == kExpandedSeeMore) { |
| + if (!has_expanded_see_more_section_) // Toggled in RecordUserReactionTime. |
| + RecordUserAction(SHOW_ADVANCED); |
|
mattm
2013/05/03 23:25:45
Is this ever triggered? RecordUserReactionTime is
felt
2013/05/03 23:44:49
You're right. I moved the call.
On 2013/05/03 23:
|
| // User expanded the "see more info" section of the page. We don't actually |
| // do any action based on this, it's just so that RecordUserReactionTime can |
| // track it. |
| @@ -483,6 +508,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 +568,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; |
| } |
| @@ -891,6 +932,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 +999,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); |
| } |