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..c18e41f2ce369a1b61d2ce979751ff249ce273fb 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"; |
|
mattm
2013/05/02 20:00:11
probably should change these to match the same sty
felt
2013/05/02 22:15:20
Made the first letter lowercase.
On 2013/05/02 20
mattm
2013/05/03 23:25:45
ah, actually I was referring to the char[] vs char
felt
2013/05/03 23:44:49
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("InterstitialMalware"); |
| + } 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("InterstitialPhishing"); |
| + } |
| } |
| 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_BACK_BUTTON)); |
|
mattm
2013/05/02 20:00:11
should be IDS_SAFE_BROWSING_MALWARE_FEAR_HEADLINE?
felt
2013/05/02 22:15:20
Fixed! (And I'll make sure to double check all 21
|
| + } 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); |
| } |