| 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 #include "chrome/browser/safe_browsing/client_side_detection_host.h" | 5 #include "chrome/browser/safe_browsing/client_side_detection_host.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 #include <utility> | 8 #include <utility> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 547 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 558 UMA_HISTOGRAM_BOOLEAN( | 558 UMA_HISTOGRAM_BOOLEAN( |
| 559 "SBClientPhishing.ServerDeterminesPhishing", | 559 "SBClientPhishing.ServerDeterminesPhishing", |
| 560 is_phishing); | 560 is_phishing); |
| 561 if (is_phishing) { | 561 if (is_phishing) { |
| 562 DCHECK(web_contents()); | 562 DCHECK(web_contents()); |
| 563 if (ui_manager_.get()) { | 563 if (ui_manager_.get()) { |
| 564 security_interstitials::UnsafeResource resource; | 564 security_interstitials::UnsafeResource resource; |
| 565 resource.url = phishing_url; | 565 resource.url = phishing_url; |
| 566 resource.original_url = phishing_url; | 566 resource.original_url = phishing_url; |
| 567 resource.is_subresource = false; | 567 resource.is_subresource = false; |
| 568 resource.threat_type = SB_THREAT_TYPE_CLIENT_SIDE_PHISHING_URL; | 568 resource.threat_type = SB_THREAT_TYPE_URL_CLIENT_SIDE_PHISHING; |
| 569 resource.threat_source = | 569 resource.threat_source = |
| 570 safe_browsing::ThreatSource::CLIENT_SIDE_DETECTION; | 570 safe_browsing::ThreatSource::CLIENT_SIDE_DETECTION; |
| 571 resource.web_contents_getter = safe_browsing::SafeBrowsingUIManager:: | 571 resource.web_contents_getter = safe_browsing::SafeBrowsingUIManager:: |
| 572 UnsafeResource::GetWebContentsGetter( | 572 UnsafeResource::GetWebContentsGetter( |
| 573 web_contents()->GetRenderProcessHost()->GetID(), | 573 web_contents()->GetRenderProcessHost()->GetID(), |
| 574 web_contents()->GetMainFrame()->GetRoutingID()); | 574 web_contents()->GetMainFrame()->GetRoutingID()); |
| 575 if (!ui_manager_->IsWhitelisted(resource)) { | 575 if (!ui_manager_->IsWhitelisted(resource)) { |
| 576 // We need to stop any pending navigations, otherwise the interstital | 576 // We need to stop any pending navigations, otherwise the interstital |
| 577 // might not get created properly. | 577 // might not get created properly. |
| 578 web_contents()->GetController().DiscardNonCommittedEntries(); | 578 web_contents()->GetController().DiscardNonCommittedEntries(); |
| (...skipping 15 matching lines...) Expand all Loading... |
| 594 UMA_HISTOGRAM_BOOLEAN( | 594 UMA_HISTOGRAM_BOOLEAN( |
| 595 "SBClientMalware.ServerDeterminesMalware", | 595 "SBClientMalware.ServerDeterminesMalware", |
| 596 is_malware); | 596 is_malware); |
| 597 if (is_malware && malware_url.is_valid() && original_url.is_valid()) { | 597 if (is_malware && malware_url.is_valid() && original_url.is_valid()) { |
| 598 DCHECK(web_contents()); | 598 DCHECK(web_contents()); |
| 599 if (ui_manager_.get()) { | 599 if (ui_manager_.get()) { |
| 600 security_interstitials::UnsafeResource resource; | 600 security_interstitials::UnsafeResource resource; |
| 601 resource.url = malware_url; | 601 resource.url = malware_url; |
| 602 resource.original_url = original_url; | 602 resource.original_url = original_url; |
| 603 resource.is_subresource = (malware_url.host() != original_url.host()); | 603 resource.is_subresource = (malware_url.host() != original_url.host()); |
| 604 resource.threat_type = SB_THREAT_TYPE_CLIENT_SIDE_MALWARE_URL; | 604 resource.threat_type = SB_THREAT_TYPE_URL_CLIENT_SIDE_MALWARE; |
| 605 resource.threat_source = | 605 resource.threat_source = |
| 606 safe_browsing::ThreatSource::CLIENT_SIDE_DETECTION; | 606 safe_browsing::ThreatSource::CLIENT_SIDE_DETECTION; |
| 607 resource.web_contents_getter = safe_browsing::SafeBrowsingUIManager:: | 607 resource.web_contents_getter = safe_browsing::SafeBrowsingUIManager:: |
| 608 UnsafeResource::GetWebContentsGetter( | 608 UnsafeResource::GetWebContentsGetter( |
| 609 web_contents()->GetRenderProcessHost()->GetID(), | 609 web_contents()->GetRenderProcessHost()->GetID(), |
| 610 web_contents()->GetMainFrame()->GetRoutingID()); | 610 web_contents()->GetMainFrame()->GetRoutingID()); |
| 611 | 611 |
| 612 if (!ui_manager_->IsWhitelisted(resource)) { | 612 if (!ui_manager_->IsWhitelisted(resource)) { |
| 613 // We need to stop any pending navigations, otherwise the interstital | 613 // We need to stop any pending navigations, otherwise the interstital |
| 614 // might not get created properly. | 614 // might not get created properly. |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 721 ui_manager_->RemoveObserver(this); | 721 ui_manager_->RemoveObserver(this); |
| 722 | 722 |
| 723 ui_manager_ = ui_manager; | 723 ui_manager_ = ui_manager; |
| 724 if (ui_manager) | 724 if (ui_manager) |
| 725 ui_manager_->AddObserver(this); | 725 ui_manager_->AddObserver(this); |
| 726 | 726 |
| 727 database_manager_ = database_manager; | 727 database_manager_ = database_manager; |
| 728 } | 728 } |
| 729 | 729 |
| 730 } // namespace safe_browsing | 730 } // namespace safe_browsing |
| OLD | NEW |