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

Side by Side Diff: chrome/browser/safe_browsing/safe_browsing_blocking_page.cc

Issue 872813003: Add Rappor metrics for Safe Browsing and SSL interstitials. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 11 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 // 4 //
5 // Implementation of the SafeBrowsingBlockingPage class. 5 // Implementation of the SafeBrowsingBlockingPage class.
6 6
7 #include "chrome/browser/safe_browsing/safe_browsing_blocking_page.h" 7 #include "chrome/browser/safe_browsing/safe_browsing_blocking_page.h"
8 8
9 #include <string> 9 #include <string>
10 10
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
169 DCHECK(phishing || malware || harmful); 169 DCHECK(phishing || malware || harmful);
170 if (malware) 170 if (malware)
171 interstitial_reason_ = SB_REASON_MALWARE; 171 interstitial_reason_ = SB_REASON_MALWARE;
172 else if (harmful) 172 else if (harmful)
173 interstitial_reason_ = SB_REASON_HARMFUL; 173 interstitial_reason_ = SB_REASON_HARMFUL;
174 else 174 else
175 interstitial_reason_ = SB_REASON_PHISHING; 175 interstitial_reason_ = SB_REASON_PHISHING;
176 176
177 // This must be done after calculating |interstitial_reason_| above. 177 // This must be done after calculating |interstitial_reason_| above.
178 uma_helper_.reset(new SecurityInterstitialUmaHelper( 178 uma_helper_.reset(new SecurityInterstitialUmaHelper(
179 web_contents, request_url(), 179 web_contents, request_url(), GetUmaHistogramPrefix(),
180 GetHistogramPrefix(), GetSamplingEventName())); 180 GetRapporMetricPrefix(), GetSamplingEventName()));
181 uma_helper_->RecordUserDecision(SecurityInterstitialUmaHelper::SHOW); 181 uma_helper_->RecordUserDecision(SecurityInterstitialUmaHelper::SHOW);
182 uma_helper_->RecordUserInteraction( 182 uma_helper_->RecordUserInteraction(
183 SecurityInterstitialUmaHelper::TOTAL_VISITS); 183 SecurityInterstitialUmaHelper::TOTAL_VISITS);
184 if (IsPrefEnabled(prefs::kSafeBrowsingProceedAnywayDisabled)) { 184 if (IsPrefEnabled(prefs::kSafeBrowsingProceedAnywayDisabled)) {
185 uma_helper_->RecordUserDecision( 185 uma_helper_->RecordUserDecision(
186 SecurityInterstitialUmaHelper::PROCEEDING_DISABLED); 186 SecurityInterstitialUmaHelper::PROCEEDING_DISABLED);
187 } 187 }
188 188
189 if (!is_main_frame_load_blocked_) { 189 if (!is_main_frame_load_blocked_) {
190 navigation_entry_index_to_remove_ = 190 navigation_entry_index_to_remove_ =
(...skipping 357 matching lines...) Expand 10 before | Expand all | Expand 10 after
548 // load, since they happen after the page is finished loading. 548 // load, since they happen after the page is finished loading.
549 if (unsafe_resources[0].threat_type == 549 if (unsafe_resources[0].threat_type ==
550 SB_THREAT_TYPE_CLIENT_SIDE_PHISHING_URL) { 550 SB_THREAT_TYPE_CLIENT_SIDE_PHISHING_URL) {
551 return false; 551 return false;
552 } 552 }
553 553
554 // Otherwise, check the threat type. 554 // Otherwise, check the threat type.
555 return unsafe_resources.size() == 1 && !unsafe_resources[0].is_subresource; 555 return unsafe_resources.size() == 1 && !unsafe_resources[0].is_subresource;
556 } 556 }
557 557
558 std::string SafeBrowsingBlockingPage::GetHistogramPrefix() const { 558 std::string SafeBrowsingBlockingPage::GetUmaHistogramPrefix() const {
559 switch (interstitial_reason_) { 559 switch (interstitial_reason_) {
560 case SB_REASON_MALWARE: 560 case SB_REASON_MALWARE:
561 return "malware"; 561 return "malware";
562 case SB_REASON_HARMFUL: 562 case SB_REASON_HARMFUL:
563 return "harmful"; 563 return "harmful";
564 case SB_REASON_PHISHING: 564 case SB_REASON_PHISHING:
565 return "phishing"; 565 return "phishing";
566 } 566 }
567 NOTREACHED(); 567 NOTREACHED();
568 return std::string(); 568 return std::string();
569 } 569 }
570 570
571 std::string SafeBrowsingBlockingPage::GetRapporMetricPrefix() const {
572 switch (interstitial_reason_) {
573 case SB_REASON_MALWARE:
574 return "Malware";
575 case SB_REASON_HARMFUL:
576 return "Harmful";
577 case SB_REASON_PHISHING:
578 return "Phishing";
579 }
580 NOTREACHED();
581 return std::string();
582 }
583
571 std::string SafeBrowsingBlockingPage::GetSamplingEventName() const { 584 std::string SafeBrowsingBlockingPage::GetSamplingEventName() const {
572 switch (interstitial_reason_) { 585 switch (interstitial_reason_) {
573 case SB_REASON_MALWARE: 586 case SB_REASON_MALWARE:
574 return kEventNameMalware; 587 return kEventNameMalware;
575 case SB_REASON_HARMFUL: 588 case SB_REASON_HARMFUL:
576 return kEventNameHarmful; 589 return kEventNameHarmful;
577 case SB_REASON_PHISHING: 590 case SB_REASON_PHISHING:
578 return kEventNamePhishing; 591 return kEventNamePhishing;
579 default: 592 default:
580 return kEventNameOther; 593 return kEventNameOther;
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
699 load_time_data->SetString( 712 load_time_data->SetString(
700 "explanationParagraph", 713 "explanationParagraph",
701 l10n_util::GetStringFUTF16(IDS_PHISHING_V3_EXPLANATION_PARAGRAPH, 714 l10n_util::GetStringFUTF16(IDS_PHISHING_V3_EXPLANATION_PARAGRAPH,
702 GetFormattedHostName())); 715 GetFormattedHostName()));
703 load_time_data->SetString( 716 load_time_data->SetString(
704 "finalParagraph", 717 "finalParagraph",
705 l10n_util::GetStringUTF16(IDS_PHISHING_V3_PROCEED_PARAGRAPH)); 718 l10n_util::GetStringUTF16(IDS_PHISHING_V3_PROCEED_PARAGRAPH));
706 719
707 PopulateExtendedReportingOption(load_time_data); 720 PopulateExtendedReportingOption(load_time_data);
708 } 721 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698