OLD | NEW |
---|---|
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 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
113 | 113 |
114 private: | 114 private: |
115 friend struct base::DefaultLazyInstanceTraits< | 115 friend struct base::DefaultLazyInstanceTraits< |
116 SafeBrowsingBlockingPageFactoryImpl>; | 116 SafeBrowsingBlockingPageFactoryImpl>; |
117 | 117 |
118 SafeBrowsingBlockingPageFactoryImpl() { } | 118 SafeBrowsingBlockingPageFactoryImpl() { } |
119 | 119 |
120 DISALLOW_COPY_AND_ASSIGN(SafeBrowsingBlockingPageFactoryImpl); | 120 DISALLOW_COPY_AND_ASSIGN(SafeBrowsingBlockingPageFactoryImpl); |
121 }; | 121 }; |
122 | 122 |
123 // static | |
124 std::unique_ptr<ChromeMetricsHelper> | |
125 SafeBrowsingBlockingPage::CreateMetricsHelper( | |
126 WebContents* web_contents, | |
127 const UnsafeResourceList& unsafe_resources) { | |
128 SBInterstitialReason interstitial_reason = | |
129 SafeBrowsingBlockingPage::GetInterstitialReason(unsafe_resources); | |
felt
2016/09/06 20:33:19
Doesn't this mean that now GetInterstitialReason i
meacer
2016/09/06 20:40:16
Yes, unfortunately that's true since we can't comp
| |
130 GURL request_url(unsafe_resources[0].url); | |
131 security_interstitials::MetricsHelper::ReportDetails reporting_info; | |
132 reporting_info.metric_prefix = SafeBrowsingBlockingPage::GetMetricPrefix( | |
133 unsafe_resources, interstitial_reason); | |
134 reporting_info.extra_suffix = | |
135 SafeBrowsingBlockingPage::GetExtraMetricsSuffix(unsafe_resources); | |
136 reporting_info.rappor_prefix = | |
137 SafeBrowsingBlockingPage::GetRapporPrefix(interstitial_reason); | |
138 reporting_info.deprecated_rappor_prefix = | |
139 SafeBrowsingBlockingPage::GetDeprecatedRapporPrefix(interstitial_reason); | |
140 reporting_info.rappor_report_type = | |
141 rappor::LOW_FREQUENCY_SAFEBROWSING_RAPPOR_TYPE; | |
142 reporting_info.deprecated_rappor_report_type = | |
143 rappor::SAFEBROWSING_RAPPOR_TYPE; | |
144 return std::unique_ptr<ChromeMetricsHelper>(new ChromeMetricsHelper( | |
145 web_contents, request_url, reporting_info, | |
146 SafeBrowsingBlockingPage::GetSamplingEventName(interstitial_reason))); | |
147 } | |
148 | |
123 static base::LazyInstance<SafeBrowsingBlockingPageFactoryImpl> | 149 static base::LazyInstance<SafeBrowsingBlockingPageFactoryImpl> |
124 g_safe_browsing_blocking_page_factory_impl = LAZY_INSTANCE_INITIALIZER; | 150 g_safe_browsing_blocking_page_factory_impl = LAZY_INSTANCE_INITIALIZER; |
125 | 151 |
126 // static | 152 // static |
127 content::InterstitialPageDelegate::TypeID | 153 content::InterstitialPageDelegate::TypeID |
128 SafeBrowsingBlockingPage::kTypeForTesting = | 154 SafeBrowsingBlockingPage::kTypeForTesting = |
129 &SafeBrowsingBlockingPage::kTypeForTesting; | 155 &SafeBrowsingBlockingPage::kTypeForTesting; |
130 | 156 |
131 SafeBrowsingBlockingPage::SafeBrowsingBlockingPage( | 157 // static |
132 SafeBrowsingUIManager* ui_manager, | 158 SafeBrowsingBlockingPage::SBInterstitialReason |
133 WebContents* web_contents, | 159 SafeBrowsingBlockingPage::GetInterstitialReason( |
134 const GURL& main_frame_url, | 160 const SafeBrowsingBlockingPage::UnsafeResourceList& unsafe_resources) { |
135 const UnsafeResourceList& unsafe_resources) | |
136 : SecurityInterstitialPage(web_contents, unsafe_resources[0].url), | |
137 threat_details_proceed_delay_ms_(kThreatDetailsProceedDelayMilliSeconds), | |
138 ui_manager_(ui_manager), | |
139 is_main_frame_load_blocked_(IsMainPageLoadBlocked(unsafe_resources)), | |
140 main_frame_url_(main_frame_url), | |
141 unsafe_resources_(unsafe_resources), | |
142 proceeded_(false) { | |
143 bool malware = false; | 161 bool malware = false; |
144 bool harmful = false; | 162 bool harmful = false; |
145 bool phishing = false; | 163 bool phishing = false; |
146 for (UnsafeResourceList::const_iterator iter = unsafe_resources_.begin(); | 164 for (SafeBrowsingBlockingPage::UnsafeResourceList::const_iterator iter = |
147 iter != unsafe_resources_.end(); ++iter) { | 165 unsafe_resources.begin(); |
148 const UnsafeResource& resource = *iter; | 166 iter != unsafe_resources.end(); ++iter) { |
149 SBThreatType threat_type = resource.threat_type; | 167 const SafeBrowsingUIManager::UnsafeResource& resource = *iter; |
168 safe_browsing::SBThreatType threat_type = resource.threat_type; | |
150 if (threat_type == SB_THREAT_TYPE_URL_MALWARE || | 169 if (threat_type == SB_THREAT_TYPE_URL_MALWARE || |
151 threat_type == SB_THREAT_TYPE_CLIENT_SIDE_MALWARE_URL) { | 170 threat_type == SB_THREAT_TYPE_CLIENT_SIDE_MALWARE_URL) { |
152 malware = true; | 171 malware = true; |
153 } else if (threat_type == SB_THREAT_TYPE_URL_UNWANTED) { | 172 } else if (threat_type == SB_THREAT_TYPE_URL_UNWANTED) { |
154 harmful = true; | 173 harmful = true; |
155 } else { | 174 } else { |
156 DCHECK(threat_type == SB_THREAT_TYPE_URL_PHISHING || | 175 DCHECK(threat_type == SB_THREAT_TYPE_URL_PHISHING || |
157 threat_type == SB_THREAT_TYPE_CLIENT_SIDE_PHISHING_URL); | 176 threat_type == SB_THREAT_TYPE_CLIENT_SIDE_PHISHING_URL); |
158 phishing = true; | 177 phishing = true; |
159 } | 178 } |
160 } | 179 } |
161 DCHECK(phishing || malware || harmful); | 180 DCHECK(phishing || malware || harmful); |
162 if (malware) | 181 if (malware) |
163 interstitial_reason_ = SB_REASON_MALWARE; | 182 return SafeBrowsingBlockingPage::SB_REASON_MALWARE; |
164 else if (harmful) | 183 else if (harmful) |
165 interstitial_reason_ = SB_REASON_HARMFUL; | 184 return SafeBrowsingBlockingPage::SB_REASON_HARMFUL; |
166 else | 185 return SafeBrowsingBlockingPage::SB_REASON_PHISHING; |
167 interstitial_reason_ = SB_REASON_PHISHING; | 186 } |
168 | 187 |
169 // This must be done after calculating |interstitial_reason_| above. | 188 SafeBrowsingBlockingPage::SafeBrowsingBlockingPage( |
170 security_interstitials::MetricsHelper::ReportDetails reporting_info; | 189 SafeBrowsingUIManager* ui_manager, |
171 reporting_info.metric_prefix = GetMetricPrefix(); | 190 WebContents* web_contents, |
172 reporting_info.extra_suffix = GetExtraMetricsSuffix(); | 191 const GURL& main_frame_url, |
173 reporting_info.rappor_prefix = GetRapporPrefix(); | 192 const UnsafeResourceList& unsafe_resources) |
174 reporting_info.deprecated_rappor_prefix = GetDeprecatedRapporPrefix(); | 193 : SecurityInterstitialPage( |
175 reporting_info.rappor_report_type = | 194 web_contents, |
176 rappor::LOW_FREQUENCY_SAFEBROWSING_RAPPOR_TYPE; | 195 unsafe_resources[0].url, |
177 reporting_info.deprecated_rappor_report_type = | 196 CreateMetricsHelper(web_contents, unsafe_resources)), |
178 rappor::SAFEBROWSING_RAPPOR_TYPE; | 197 threat_details_proceed_delay_ms_(kThreatDetailsProceedDelayMilliSeconds), |
179 set_metrics_helper(base::MakeUnique<ChromeMetricsHelper>( | 198 ui_manager_(ui_manager), |
180 web_contents, request_url(), reporting_info, GetSamplingEventName())); | 199 is_main_frame_load_blocked_(IsMainPageLoadBlocked(unsafe_resources)), |
181 metrics_helper()->RecordUserDecision( | 200 main_frame_url_(main_frame_url), |
201 unsafe_resources_(unsafe_resources), | |
202 proceeded_(false), | |
203 interstitial_reason_(GetInterstitialReason(unsafe_resources)) { | |
204 controller()->metrics_helper()->RecordUserDecision( | |
182 security_interstitials::MetricsHelper::SHOW); | 205 security_interstitials::MetricsHelper::SHOW); |
183 metrics_helper()->RecordUserInteraction( | 206 controller()->metrics_helper()->RecordUserInteraction( |
184 security_interstitials::MetricsHelper::TOTAL_VISITS); | 207 security_interstitials::MetricsHelper::TOTAL_VISITS); |
185 if (IsPrefEnabled(prefs::kSafeBrowsingProceedAnywayDisabled)) { | 208 if (IsPrefEnabled(prefs::kSafeBrowsingProceedAnywayDisabled)) { |
186 metrics_helper()->RecordUserDecision( | 209 controller()->metrics_helper()->RecordUserDecision( |
187 security_interstitials::MetricsHelper::PROCEEDING_DISABLED); | 210 security_interstitials::MetricsHelper::PROCEEDING_DISABLED); |
188 } | 211 } |
189 | 212 |
190 if (!is_main_frame_load_blocked_) { | 213 if (!is_main_frame_load_blocked_) { |
191 navigation_entry_index_to_remove_ = | 214 navigation_entry_index_to_remove_ = |
192 web_contents->GetController().GetLastCommittedEntryIndex(); | 215 web_contents->GetController().GetLastCommittedEntryIndex(); |
193 } else { | 216 } else { |
194 navigation_entry_index_to_remove_ = -1; | 217 navigation_entry_index_to_remove_ = -1; |
195 } | 218 } |
196 | 219 |
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
351 Profile* profile = Profile::FromBrowserContext( | 374 Profile* profile = Profile::FromBrowserContext( |
352 web_contents()->GetBrowserContext()); | 375 web_contents()->GetBrowserContext()); |
353 renderer_preferences_util::UpdateFromSystemSettings( | 376 renderer_preferences_util::UpdateFromSystemSettings( |
354 prefs, profile, web_contents()); | 377 prefs, profile, web_contents()); |
355 } | 378 } |
356 | 379 |
357 void SafeBrowsingBlockingPage::OnProceed() { | 380 void SafeBrowsingBlockingPage::OnProceed() { |
358 proceeded_ = true; | 381 proceeded_ = true; |
359 // Send the threat details, if we opted to. | 382 // Send the threat details, if we opted to. |
360 FinishThreatDetails(threat_details_proceed_delay_ms_, true, /* did_proceed */ | 383 FinishThreatDetails(threat_details_proceed_delay_ms_, true, /* did_proceed */ |
361 metrics_helper()->NumVisits()); | 384 controller()->metrics_helper()->NumVisits()); |
362 | 385 |
363 ui_manager_->OnBlockingPageDone(unsafe_resources_, true); | 386 ui_manager_->OnBlockingPageDone(unsafe_resources_, true); |
364 | 387 |
365 // Check to see if some new notifications of unsafe resources have been | 388 // Check to see if some new notifications of unsafe resources have been |
366 // received while we were showing the interstitial. | 389 // received while we were showing the interstitial. |
367 UnsafeResourceMap* unsafe_resource_map = GetUnsafeResourcesMap(); | 390 UnsafeResourceMap* unsafe_resource_map = GetUnsafeResourcesMap(); |
368 UnsafeResourceMap::iterator iter = unsafe_resource_map->find(web_contents()); | 391 UnsafeResourceMap::iterator iter = unsafe_resource_map->find(web_contents()); |
369 SafeBrowsingBlockingPage* blocking_page = NULL; | 392 SafeBrowsingBlockingPage* blocking_page = NULL; |
370 if (iter != unsafe_resource_map->end() && !iter->second.empty()) { | 393 if (iter != unsafe_resource_map->end() && !iter->second.empty()) { |
371 // All queued unsafe resources should be for the same page: | 394 // All queued unsafe resources should be for the same page: |
(...skipping 22 matching lines...) Expand all Loading... | |
394 return is_main_frame_load_blocked_; | 417 return is_main_frame_load_blocked_; |
395 } | 418 } |
396 | 419 |
397 void SafeBrowsingBlockingPage::OnDontProceed() { | 420 void SafeBrowsingBlockingPage::OnDontProceed() { |
398 // We could have already called Proceed(), in which case we must not notify | 421 // We could have already called Proceed(), in which case we must not notify |
399 // the SafeBrowsingUIManager again, as the client has been deleted. | 422 // the SafeBrowsingUIManager again, as the client has been deleted. |
400 if (proceeded_) | 423 if (proceeded_) |
401 return; | 424 return; |
402 | 425 |
403 if (!IsPrefEnabled(prefs::kSafeBrowsingProceedAnywayDisabled)) { | 426 if (!IsPrefEnabled(prefs::kSafeBrowsingProceedAnywayDisabled)) { |
404 metrics_helper()->RecordUserDecision( | 427 controller()->metrics_helper()->RecordUserDecision( |
405 security_interstitials::MetricsHelper::DONT_PROCEED); | 428 security_interstitials::MetricsHelper::DONT_PROCEED); |
406 } | 429 } |
407 | 430 |
408 // Send the malware details, if we opted to. | 431 // Send the malware details, if we opted to. |
409 FinishThreatDetails(0, false /* did_proceed */, | 432 FinishThreatDetails(0, false /* did_proceed */, |
410 metrics_helper()->NumVisits()); // No delay | 433 controller()->metrics_helper()->NumVisits()); // No delay |
411 | 434 |
412 ui_manager_->OnBlockingPageDone(unsafe_resources_, false); | 435 ui_manager_->OnBlockingPageDone(unsafe_resources_, false); |
413 | 436 |
414 // The user does not want to proceed, clear the queued unsafe resources | 437 // The user does not want to proceed, clear the queued unsafe resources |
415 // notifications we received while the interstitial was showing. | 438 // notifications we received while the interstitial was showing. |
416 UnsafeResourceMap* unsafe_resource_map = GetUnsafeResourcesMap(); | 439 UnsafeResourceMap* unsafe_resource_map = GetUnsafeResourcesMap(); |
417 UnsafeResourceMap::iterator iter = unsafe_resource_map->find(web_contents()); | 440 UnsafeResourceMap::iterator iter = unsafe_resource_map->find(web_contents()); |
418 if (iter != unsafe_resource_map->end() && !iter->second.empty()) { | 441 if (iter != unsafe_resource_map->end() && !iter->second.empty()) { |
419 ui_manager_->OnBlockingPageDone(iter->second, false); | 442 ui_manager_->OnBlockingPageDone(iter->second, false); |
420 unsafe_resource_map->erase(iter); | 443 unsafe_resource_map->erase(iter); |
(...skipping 20 matching lines...) Expand all Loading... | |
441 int num_visits) { | 464 int num_visits) { |
442 if (threat_details_.get() == NULL) | 465 if (threat_details_.get() == NULL) |
443 return; // Not all interstitials have threat details (eg., incognito mode). | 466 return; // Not all interstitials have threat details (eg., incognito mode). |
444 | 467 |
445 const bool enabled = | 468 const bool enabled = |
446 IsPrefEnabled(prefs::kSafeBrowsingExtendedReportingEnabled) && | 469 IsPrefEnabled(prefs::kSafeBrowsingExtendedReportingEnabled) && |
447 IsPrefEnabled(prefs::kSafeBrowsingExtendedReportingOptInAllowed); | 470 IsPrefEnabled(prefs::kSafeBrowsingExtendedReportingOptInAllowed); |
448 if (!enabled) | 471 if (!enabled) |
449 return; | 472 return; |
450 | 473 |
451 metrics_helper()->RecordUserInteraction( | 474 controller()->metrics_helper()->RecordUserInteraction( |
452 security_interstitials::MetricsHelper::EXTENDED_REPORTING_IS_ENABLED); | 475 security_interstitials::MetricsHelper::EXTENDED_REPORTING_IS_ENABLED); |
453 // Finish the malware details collection, send it over. | 476 // Finish the malware details collection, send it over. |
454 BrowserThread::PostDelayedTask( | 477 BrowserThread::PostDelayedTask( |
455 BrowserThread::IO, FROM_HERE, | 478 BrowserThread::IO, FROM_HERE, |
456 base::Bind(&ThreatDetails::FinishCollection, threat_details_.get(), | 479 base::Bind(&ThreatDetails::FinishCollection, threat_details_.get(), |
457 did_proceed, num_visits), | 480 did_proceed, num_visits), |
458 base::TimeDelta::FromMilliseconds(delay_ms)); | 481 base::TimeDelta::FromMilliseconds(delay_ms)); |
459 } | 482 } |
460 | 483 |
461 // static | 484 // static |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
516 | 539 |
517 // static | 540 // static |
518 bool SafeBrowsingBlockingPage::IsMainPageLoadBlocked( | 541 bool SafeBrowsingBlockingPage::IsMainPageLoadBlocked( |
519 const UnsafeResourceList& unsafe_resources) { | 542 const UnsafeResourceList& unsafe_resources) { |
520 // If there is more than one unsafe resource, the main page load must not be | 543 // If there is more than one unsafe resource, the main page load must not be |
521 // blocked. Otherwise, check if the one resource is. | 544 // blocked. Otherwise, check if the one resource is. |
522 return unsafe_resources.size() == 1 && | 545 return unsafe_resources.size() == 1 && |
523 unsafe_resources[0].IsMainPageLoadBlocked(); | 546 unsafe_resources[0].IsMainPageLoadBlocked(); |
524 } | 547 } |
525 | 548 |
526 std::string SafeBrowsingBlockingPage::GetMetricPrefix() const { | 549 // static |
527 bool primary_subresource = unsafe_resources_[0].is_subresource; | 550 std::string SafeBrowsingBlockingPage::GetMetricPrefix( |
528 switch (interstitial_reason_) { | 551 const UnsafeResourceList& unsafe_resources, |
552 SBInterstitialReason interstitial_reason) { | |
553 bool primary_subresource = unsafe_resources[0].is_subresource; | |
554 switch (interstitial_reason) { | |
529 case SB_REASON_MALWARE: | 555 case SB_REASON_MALWARE: |
530 return primary_subresource ? "malware_subresource" : "malware"; | 556 return primary_subresource ? "malware_subresource" : "malware"; |
531 case SB_REASON_HARMFUL: | 557 case SB_REASON_HARMFUL: |
532 return primary_subresource ? "harmful_subresource" : "harmful"; | 558 return primary_subresource ? "harmful_subresource" : "harmful"; |
533 case SB_REASON_PHISHING: | 559 case SB_REASON_PHISHING: |
534 ThreatPatternType threat_pattern_type = | 560 ThreatPatternType threat_pattern_type = |
535 unsafe_resources_[0].threat_metadata.threat_pattern_type; | 561 unsafe_resources[0].threat_metadata.threat_pattern_type; |
536 if (threat_pattern_type == ThreatPatternType::PHISHING || | 562 if (threat_pattern_type == ThreatPatternType::PHISHING || |
537 threat_pattern_type == ThreatPatternType::NONE) | 563 threat_pattern_type == ThreatPatternType::NONE) |
538 return primary_subresource ? "phishing_subresource" : "phishing"; | 564 return primary_subresource ? "phishing_subresource" : "phishing"; |
539 else if (threat_pattern_type == ThreatPatternType::SOCIAL_ENGINEERING_ADS) | 565 else if (threat_pattern_type == ThreatPatternType::SOCIAL_ENGINEERING_ADS) |
540 return primary_subresource ? "social_engineering_ads_subresource" | 566 return primary_subresource ? "social_engineering_ads_subresource" |
541 : "social_engineering_ads"; | 567 : "social_engineering_ads"; |
542 else if (threat_pattern_type == | 568 else if (threat_pattern_type == |
543 ThreatPatternType::SOCIAL_ENGINEERING_LANDING) | 569 ThreatPatternType::SOCIAL_ENGINEERING_LANDING) |
544 return primary_subresource ? "social_engineering_landing_subresource" | 570 return primary_subresource ? "social_engineering_landing_subresource" |
545 : "social_engineering_landing"; | 571 : "social_engineering_landing"; |
546 } | 572 } |
547 NOTREACHED(); | 573 NOTREACHED(); |
548 return "unkown_metric_prefix"; | 574 return "unkown_metric_prefix"; |
549 } | 575 } |
550 | 576 |
551 // We populate a parallel set of metrics to differentiate some threat sources. | 577 // We populate a parallel set of metrics to differentiate some threat sources. |
552 std::string SafeBrowsingBlockingPage::GetExtraMetricsSuffix() const { | 578 // static |
553 switch (unsafe_resources_[0].threat_source) { | 579 std::string SafeBrowsingBlockingPage::GetExtraMetricsSuffix( |
580 const UnsafeResourceList& unsafe_resources) { | |
581 switch (unsafe_resources[0].threat_source) { | |
554 case safe_browsing::ThreatSource::DATA_SAVER: | 582 case safe_browsing::ThreatSource::DATA_SAVER: |
555 return "from_data_saver"; | 583 return "from_data_saver"; |
556 case safe_browsing::ThreatSource::REMOTE: | 584 case safe_browsing::ThreatSource::REMOTE: |
557 case safe_browsing::ThreatSource::LOCAL_PVER3: | 585 case safe_browsing::ThreatSource::LOCAL_PVER3: |
558 // REMOTE and LOCAL_PVER3 can be distinguished in the logs | 586 // REMOTE and LOCAL_PVER3 can be distinguished in the logs |
559 // by platform type: Remote is mobile, local_pver3 is desktop. | 587 // by platform type: Remote is mobile, local_pver3 is desktop. |
560 return "from_device"; | 588 return "from_device"; |
561 case safe_browsing::ThreatSource::LOCAL_PVER4: | 589 case safe_browsing::ThreatSource::LOCAL_PVER4: |
562 return "from_device_v4"; | 590 return "from_device_v4"; |
563 case safe_browsing::ThreatSource::CLIENT_SIDE_DETECTION: | 591 case safe_browsing::ThreatSource::CLIENT_SIDE_DETECTION: |
564 return "from_client_side_detection"; | 592 return "from_client_side_detection"; |
565 case safe_browsing::ThreatSource::UNKNOWN: | 593 case safe_browsing::ThreatSource::UNKNOWN: |
566 break; | 594 break; |
567 } | 595 } |
568 NOTREACHED(); | 596 NOTREACHED(); |
569 return std::string(); | 597 return std::string(); |
570 } | 598 } |
571 | 599 |
572 std::string SafeBrowsingBlockingPage::GetRapporPrefix() const { | 600 // static |
573 switch (interstitial_reason_) { | 601 std::string SafeBrowsingBlockingPage::GetRapporPrefix( |
602 SBInterstitialReason interstitial_reason) { | |
603 switch (interstitial_reason) { | |
574 case SB_REASON_MALWARE: | 604 case SB_REASON_MALWARE: |
575 return "malware2"; | 605 return "malware2"; |
576 case SB_REASON_HARMFUL: | 606 case SB_REASON_HARMFUL: |
577 return "harmful2"; | 607 return "harmful2"; |
578 case SB_REASON_PHISHING: | 608 case SB_REASON_PHISHING: |
579 return "phishing2"; | 609 return "phishing2"; |
580 } | 610 } |
581 NOTREACHED(); | 611 NOTREACHED(); |
582 return std::string(); | 612 return std::string(); |
583 } | 613 } |
584 | 614 |
585 std::string SafeBrowsingBlockingPage::GetDeprecatedRapporPrefix() const { | 615 // static |
586 switch (interstitial_reason_) { | 616 std::string SafeBrowsingBlockingPage::GetDeprecatedRapporPrefix( |
617 SBInterstitialReason interstitial_reason) { | |
618 switch (interstitial_reason) { | |
587 case SB_REASON_MALWARE: | 619 case SB_REASON_MALWARE: |
588 return "malware"; | 620 return "malware"; |
589 case SB_REASON_HARMFUL: | 621 case SB_REASON_HARMFUL: |
590 return "harmful"; | 622 return "harmful"; |
591 case SB_REASON_PHISHING: | 623 case SB_REASON_PHISHING: |
592 return "phishing"; | 624 return "phishing"; |
593 } | 625 } |
594 NOTREACHED(); | 626 NOTREACHED(); |
595 return std::string(); | 627 return std::string(); |
596 } | 628 } |
597 | 629 |
598 std::string SafeBrowsingBlockingPage::GetSamplingEventName() const { | 630 // static |
599 switch (interstitial_reason_) { | 631 std::string SafeBrowsingBlockingPage::GetSamplingEventName( |
632 SBInterstitialReason interstitial_reason) { | |
633 switch (interstitial_reason) { | |
600 case SB_REASON_MALWARE: | 634 case SB_REASON_MALWARE: |
601 return kEventNameMalware; | 635 return kEventNameMalware; |
602 case SB_REASON_HARMFUL: | 636 case SB_REASON_HARMFUL: |
603 return kEventNameHarmful; | 637 return kEventNameHarmful; |
604 case SB_REASON_PHISHING: | 638 case SB_REASON_PHISHING: |
605 return kEventNamePhishing; | 639 return kEventNamePhishing; |
606 default: | 640 default: |
607 return kEventNameOther; | 641 return kEventNameOther; |
608 } | 642 } |
609 } | 643 } |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
728 l10n_util::GetStringFUTF16(IDS_PHISHING_V4_EXPLANATION_PARAGRAPH, | 762 l10n_util::GetStringFUTF16(IDS_PHISHING_V4_EXPLANATION_PARAGRAPH, |
729 GetFormattedHostName())); | 763 GetFormattedHostName())); |
730 load_time_data->SetString( | 764 load_time_data->SetString( |
731 "finalParagraph", | 765 "finalParagraph", |
732 l10n_util::GetStringUTF16(IDS_PHISHING_V4_PROCEED_AND_REPORT_PARAGRAPH)); | 766 l10n_util::GetStringUTF16(IDS_PHISHING_V4_PROCEED_AND_REPORT_PARAGRAPH)); |
733 | 767 |
734 PopulateExtendedReportingOption(load_time_data); | 768 PopulateExtendedReportingOption(load_time_data); |
735 } | 769 } |
736 | 770 |
737 } // namespace safe_browsing | 771 } // namespace safe_browsing |
OLD | NEW |