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

Side by Side Diff: components/safe_browsing/browser/threat_details.cc

Issue 2905343002: Show interstitial on a password on focus ping with PHISHING verdict. (Closed)
Patch Set: nit Created 3 years, 6 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
« no previous file with comments | « components/safe_browsing/base_ping_manager.cc ('k') | components/safe_browsing/csd.proto » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 ThreatDetails class. 5 // Implementation of the ThreatDetails class.
6 6
7 #include "components/safe_browsing/browser/threat_details.h" 7 #include "components/safe_browsing/browser/threat_details.h"
8 8
9 #include <stddef.h> 9 #include <stddef.h>
10 #include <stdint.h> 10 #include <stdint.h>
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 case SB_THREAT_TYPE_URL_PHISHING: 69 case SB_THREAT_TYPE_URL_PHISHING:
70 return ClientSafeBrowsingReportRequest::URL_PHISHING; 70 return ClientSafeBrowsingReportRequest::URL_PHISHING;
71 case SB_THREAT_TYPE_URL_MALWARE: 71 case SB_THREAT_TYPE_URL_MALWARE:
72 return ClientSafeBrowsingReportRequest::URL_MALWARE; 72 return ClientSafeBrowsingReportRequest::URL_MALWARE;
73 case SB_THREAT_TYPE_URL_UNWANTED: 73 case SB_THREAT_TYPE_URL_UNWANTED:
74 return ClientSafeBrowsingReportRequest::URL_UNWANTED; 74 return ClientSafeBrowsingReportRequest::URL_UNWANTED;
75 case SB_THREAT_TYPE_CLIENT_SIDE_PHISHING_URL: 75 case SB_THREAT_TYPE_CLIENT_SIDE_PHISHING_URL:
76 return ClientSafeBrowsingReportRequest::CLIENT_SIDE_PHISHING_URL; 76 return ClientSafeBrowsingReportRequest::CLIENT_SIDE_PHISHING_URL;
77 case SB_THREAT_TYPE_CLIENT_SIDE_MALWARE_URL: 77 case SB_THREAT_TYPE_CLIENT_SIDE_MALWARE_URL:
78 return ClientSafeBrowsingReportRequest::CLIENT_SIDE_MALWARE_URL; 78 return ClientSafeBrowsingReportRequest::CLIENT_SIDE_MALWARE_URL;
79 case SB_THREAT_TYPE_PASSWORD_PROTECTION_PHISHING_URL:
80 return ClientSafeBrowsingReportRequest::PASSWORD_PROTECTION_PHISHING_URL;
79 default: // Gated by SafeBrowsingBlockingPage::ShouldReportThreatDetails. 81 default: // Gated by SafeBrowsingBlockingPage::ShouldReportThreatDetails.
80 NOTREACHED() << "We should not send report for threat type " 82 NOTREACHED() << "We should not send report for threat type "
81 << threat_type; 83 << threat_type;
82 return ClientSafeBrowsingReportRequest::UNKNOWN; 84 return ClientSafeBrowsingReportRequest::UNKNOWN;
83 } 85 }
84 } 86 }
85 87
86 // Clears the specified HTTPS resource of any sensitive data, only retaining 88 // Clears the specified HTTPS resource of any sensitive data, only retaining
87 // data that is whitelisted for collection. 89 // data that is whitelisted for collection.
88 void ClearHttpsResource(ClientSafeBrowsingReportRequest::Resource* resource) { 90 void ClearHttpsResource(ClientSafeBrowsingReportRequest::Resource* resource) {
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after
352 354
353 void ThreatDetails::StartCollection() { 355 void ThreatDetails::StartCollection() {
354 DVLOG(1) << "Starting to compute threat details."; 356 DVLOG(1) << "Starting to compute threat details.";
355 report_.reset(new ClientSafeBrowsingReportRequest()); 357 report_.reset(new ClientSafeBrowsingReportRequest());
356 358
357 if (IsReportableUrl(resource_.url)) { 359 if (IsReportableUrl(resource_.url)) {
358 report_->set_url(resource_.url.spec()); 360 report_->set_url(resource_.url.spec());
359 report_->set_type(GetReportTypeFromSBThreatType(resource_.threat_type)); 361 report_->set_type(GetReportTypeFromSBThreatType(resource_.threat_type));
360 } 362 }
361 363
364 if (resource_.threat_type == SB_THREAT_TYPE_PASSWORD_PROTECTION_PHISHING_URL)
365 report_->set_token(resource_.token);
366
362 GURL referrer_url; 367 GURL referrer_url;
363 NavigationEntry* nav_entry = resource_.GetNavigationEntryForResource(); 368 NavigationEntry* nav_entry = resource_.GetNavigationEntryForResource();
364 if (nav_entry) { 369 if (nav_entry) {
365 GURL page_url = nav_entry->GetURL(); 370 GURL page_url = nav_entry->GetURL();
366 if (IsReportableUrl(page_url)) 371 if (IsReportableUrl(page_url))
367 report_->set_page_url(page_url.spec()); 372 report_->set_page_url(page_url.spec());
368 373
369 referrer_url = nav_entry->GetReferrer().url; 374 referrer_url = nav_entry->GetReferrer().url;
370 if (IsReportableUrl(referrer_url)) 375 if (IsReportableUrl(referrer_url))
371 report_->set_referrer_url(referrer_url.spec()); 376 report_->set_referrer_url(referrer_url.spec());
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after
581 // Send the report, using the SafeBrowsingService. 586 // Send the report, using the SafeBrowsingService.
582 std::string serialized; 587 std::string serialized;
583 if (!report_->SerializeToString(&serialized)) { 588 if (!report_->SerializeToString(&serialized)) {
584 DLOG(ERROR) << "Unable to serialize the threat report."; 589 DLOG(ERROR) << "Unable to serialize the threat report.";
585 return; 590 return;
586 } 591 }
587 ui_manager_->SendSerializedThreatDetails(serialized); 592 ui_manager_->SendSerializedThreatDetails(serialized);
588 } 593 }
589 594
590 } // namespace safe_browsing 595 } // namespace safe_browsing
OLDNEW
« no previous file with comments | « components/safe_browsing/base_ping_manager.cc ('k') | components/safe_browsing/csd.proto » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698