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..540f7476284bc9662c61683acc61efe890039948 100644 |
| --- a/chrome/browser/safe_browsing/safe_browsing_blocking_page.cc |
| +++ b/chrome/browser/safe_browsing/safe_browsing_blocking_page.cc |
| @@ -113,6 +113,22 @@ static const char* const kExpandedSeeMore = "expandedSeeMore"; |
| // RecordUserReactionTime. |
| static const char* const kNavigatedAwayMetaCommand = "closed"; |
| +// These are the conditions for the summer 2013 Finch experiment. |
| +static const char kCond1MalwareControl[] = "cond1MalwareControl"; |
|
James Hawkins
2013/05/03 18:31:55
Get rid of all these statics by wrapping this whol
felt
2013/05/03 18:43:25
Done.
|
| +static const char kCond2MalwareNoBrand[] = "cond2MalwareNoBrand"; |
| +static const char kCond3PhishingControl[] = "cond3PhishingControl"; |
| +static const char kCond4PhishingNoBrand[] = "cond4PhishingNoBrand"; |
| +static const char kCond5MalwareOneStep[] = "cond5MalwareOneStep"; |
| +static const char kCond6PhishingOneStep[] = "cond6PhishingOneStep"; |
| +static const char kCond7MalwareFearMsg[] = "cond7MalwareFearMsg"; |
| +static const char kCond8PhishingFearMsg[] = "cond8PhishingFearMsg"; |
| +static const char kCond9MalwareCollabMsg[] = "cond9MalwareCollabMsg"; |
| +static const char kCond10PhishingCollabMsg[] = "cond10PhishingCollabMsg"; |
| +static const char kCond11MalwareQuestion[] = "cond11MalwareQuestion"; |
| +static const char kCond12PhishingQuestion[] = "cond12PhishingQuestion"; |
| +static const char kCond13MalwareGoBack[] = "cond13MalwareGoBack"; |
| +static const char kCond14PhishingGoBack[] = "cond14PhishingGoBack"; |
| + |
| // static |
| SafeBrowsingBlockingPageFactory* SafeBrowsingBlockingPage::factory_ = NULL; |
| @@ -129,7 +145,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 +394,8 @@ void SafeBrowsingBlockingPage::CommandReceived(const std::string& cmd) { |
| } |
| if (command == kExpandedSeeMore) { |
| + if (!has_expanded_see_more_section_) // Toggled in RecordUserReactionTime. |
| + RecordUserAction(SHOW_ADVANCED); |
| // 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 +501,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 +561,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 +925,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("InterstitialMalware310"); |
| + } 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("InterstitialPhishing564"); |
| + } |
| } |
| std::string SafeBrowsingBlockingPageV2::GetHTMLContents() { |
| @@ -948,6 +992,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); |
| } |