Chromium Code Reviews| Index: chrome/browser/safe_browsing/client_side_detection_host.cc |
| diff --git a/chrome/browser/safe_browsing/client_side_detection_host.cc b/chrome/browser/safe_browsing/client_side_detection_host.cc |
| index 1f67d5c38363d005c062809c59e2860fe47ff831..e2f3c4f09828f4ced44f7554f675e7c29b0e65a3 100644 |
| --- a/chrome/browser/safe_browsing/client_side_detection_host.cc |
| +++ b/chrome/browser/safe_browsing/client_side_detection_host.cc |
| @@ -44,7 +44,7 @@ using content::WebContents; |
| namespace safe_browsing { |
| -const int ClientSideDetectionHost::kMaxHostsPerIP = 20; |
| +const int ClientSideDetectionHost::kMaxUrlsPerIP = 20; |
| const int ClientSideDetectionHost::kMaxIPsPerBrowse = 200; |
| namespace { |
| @@ -493,20 +493,20 @@ void ClientSideDetectionHost::MalwareFeatureExtractionDone( |
| } |
| } |
| -void ClientSideDetectionHost::UpdateIPHostMap(const std::string& ip, |
| - const std::string& host) { |
| - if (ip.empty() || host.empty()) |
| +void ClientSideDetectionHost::UpdateIPUrlMap(const std::string& ip, |
| + const std::string& url) { |
| + if (ip.empty() || url.empty()) |
| return; |
| - IPHostMap::iterator it = browse_info_->ips.find(ip); |
| + IPUrlMap::iterator it = browse_info_->ips.find(ip); |
| if (it == browse_info_->ips.end()) { |
| if (int(browse_info_->ips.size()) < kMaxIPsPerBrowse) { |
| - std::set<std::string> hosts; |
| - hosts.insert(host); |
| - browse_info_->ips.insert(make_pair(ip, hosts)); |
| + std::set<std::string> urls; |
| + urls.insert(url); |
| + browse_info_->ips.insert(make_pair(ip, urls)); |
| } |
| - } else if (int(it->second.size()) < kMaxHostsPerIP) { |
| - it->second.insert(host); |
| + } else if (int(it->second.size()) < kMaxUrlsPerIP) { |
| + it->second.insert(url); |
| } |
| } |
| @@ -520,8 +520,8 @@ void ClientSideDetectionHost::Observe( |
| details).ptr(); |
| if (req && browse_info_.get() && malware_report_enabled_ && |
| !MalwareKillSwitchIsOn()) { |
|
mattm
2013/07/31 01:21:41
I'm not sure if the url is guaranteed to be valid
kewang
2013/07/31 20:40:32
Done.
|
| - UpdateIPHostMap(req->socket_address.host() /* ip */, |
| - req->url.host() /* url host */); |
| + UpdateIPUrlMap(req->socket_address.host() /* ip */, |
| + req->url.spec() /* url */); |
| } |
| } |