| 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/browser_feature_extractor.h" | 5 #include "chrome/browser/safe_browsing/browser_feature_extractor.h" |
| 6 | 6 |
| 7 #include <map> | 7 #include <map> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 255 FROM_HERE, | 255 FROM_HERE, |
| 256 base::Bind(&BrowserFeatureExtractor::StartExtractFeatures, | 256 base::Bind(&BrowserFeatureExtractor::StartExtractFeatures, |
| 257 weak_factory_.GetWeakPtr(), request, callback)); | 257 weak_factory_.GetWeakPtr(), request, callback)); |
| 258 } | 258 } |
| 259 | 259 |
| 260 void BrowserFeatureExtractor::ExtractMalwareFeatures( | 260 void BrowserFeatureExtractor::ExtractMalwareFeatures( |
| 261 BrowseInfo* info, | 261 BrowseInfo* info, |
| 262 ClientMalwareRequest* request, | 262 ClientMalwareRequest* request, |
| 263 const MalwareDoneCallback& callback) { | 263 const MalwareDoneCallback& callback) { |
| 264 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 264 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 265 DCHECK_EQ(0U, request->url().find("http:")); | |
| 266 DCHECK(!callback.is_null()); | 265 DCHECK(!callback.is_null()); |
| 267 | 266 |
| 268 // Grab the IPs because they might go away before we're done | 267 // Grab the IPs because they might go away before we're done |
| 269 // checking them against the IP blacklist on the IO thread. | 268 // checking them against the IP blacklist on the IO thread. |
| 270 scoped_ptr<IPUrlMap> ips(new IPUrlMap); | 269 scoped_ptr<IPUrlMap> ips(new IPUrlMap); |
| 271 ips->swap(info->ips); | 270 ips->swap(info->ips); |
| 272 | 271 |
| 273 IPUrlMap* ips_ptr = ips.get(); | 272 IPUrlMap* ips_ptr = ips.get(); |
| 274 | 273 |
| 275 // The API doesn't take a scoped_ptr because the API gets mocked and we | 274 // The API doesn't take a scoped_ptr because the API gets mocked and we |
| (...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 533 // Limit the number of matched bad IPs in one request to control | 532 // Limit the number of matched bad IPs in one request to control |
| 534 // the request's size | 533 // the request's size |
| 535 if (matched_bad_ips >= kMaxMalwareIPPerRequest) { | 534 if (matched_bad_ips >= kMaxMalwareIPPerRequest) { |
| 536 break; | 535 break; |
| 537 } | 536 } |
| 538 } | 537 } |
| 539 callback.Run(true, request.Pass()); | 538 callback.Run(true, request.Pass()); |
| 540 } | 539 } |
| 541 | 540 |
| 542 } // namespace safe_browsing | 541 } // namespace safe_browsing |
| OLD | NEW |