| 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 <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
| (...skipping 660 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 671 // Send ping if there is matching features. | 671 // Send ping if there is matching features. |
| 672 if (feature_extraction_success && request->bad_ip_url_info_size() > 0) { | 672 if (feature_extraction_success && request->bad_ip_url_info_size() > 0) { |
| 673 VLOG(1) << "Start sending client malware request."; | 673 VLOG(1) << "Start sending client malware request."; |
| 674 ClientSideDetectionService::ClientReportMalwareRequestCallback callback; | 674 ClientSideDetectionService::ClientReportMalwareRequestCallback callback; |
| 675 callback = base::Bind(&ClientSideDetectionHost::MaybeShowMalwareWarning, | 675 callback = base::Bind(&ClientSideDetectionHost::MaybeShowMalwareWarning, |
| 676 weak_factory_.GetWeakPtr()); | 676 weak_factory_.GetWeakPtr()); |
| 677 csd_service_->SendClientReportMalwareRequest(request.release(), callback); | 677 csd_service_->SendClientReportMalwareRequest(request.release(), callback); |
| 678 } | 678 } |
| 679 } | 679 } |
| 680 | 680 |
| 681 void ClientSideDetectionHost::UpdateIPUrlMap( | 681 void ClientSideDetectionHost::UpdateIPUrlMap(const std::string& ip, |
| 682 const std::string& ip, | 682 const std::string& url, |
| 683 const std::string& url, | 683 const std::string& method, |
| 684 const std::string& method, | 684 const std::string& referrer, |
| 685 const std::string& referrer, | 685 const ResourceType resource_type) { |
| 686 const ResourceType::Type resource_type) { | |
| 687 if (ip.empty() || url.empty()) | 686 if (ip.empty() || url.empty()) |
| 688 return; | 687 return; |
| 689 | 688 |
| 690 IPUrlMap::iterator it = browse_info_->ips.find(ip); | 689 IPUrlMap::iterator it = browse_info_->ips.find(ip); |
| 691 if (it == browse_info_->ips.end()) { | 690 if (it == browse_info_->ips.end()) { |
| 692 if (browse_info_->ips.size() < kMaxIPsPerBrowse) { | 691 if (browse_info_->ips.size() < kMaxIPsPerBrowse) { |
| 693 std::vector<IPUrlInfo> url_infos; | 692 std::vector<IPUrlInfo> url_infos; |
| 694 url_infos.push_back(IPUrlInfo(url, method, referrer, resource_type)); | 693 url_infos.push_back(IPUrlInfo(url, method, referrer, resource_type)); |
| 695 browse_info_->ips.insert(make_pair(ip, url_infos)); | 694 browse_info_->ips.insert(make_pair(ip, url_infos)); |
| 696 } | 695 } |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 738 ui_manager_->RemoveObserver(this); | 737 ui_manager_->RemoveObserver(this); |
| 739 | 738 |
| 740 ui_manager_ = ui_manager; | 739 ui_manager_ = ui_manager; |
| 741 if (ui_manager) | 740 if (ui_manager) |
| 742 ui_manager_->AddObserver(this); | 741 ui_manager_->AddObserver(this); |
| 743 | 742 |
| 744 database_manager_ = database_manager; | 743 database_manager_ = database_manager; |
| 745 } | 744 } |
| 746 | 745 |
| 747 } // namespace safe_browsing | 746 } // namespace safe_browsing |
| OLD | NEW |