| 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 // Implementation of the MalwareDetails class. | 5 // Implementation of the MalwareDetails class. |
| 6 | 6 |
| 7 #include "chrome/browser/safe_browsing/malware_details.h" | 7 #include "chrome/browser/safe_browsing/malware_details.h" |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/lazy_instance.h" | 10 #include "base/lazy_instance.h" |
| (...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 271 void MalwareDetails::OnRedirectionCollectionReady() { | 271 void MalwareDetails::OnRedirectionCollectionReady() { |
| 272 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 272 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
| 273 const std::vector<safe_browsing::RedirectChain>& redirects = | 273 const std::vector<safe_browsing::RedirectChain>& redirects = |
| 274 redirects_collector_->GetCollectedUrls(); | 274 redirects_collector_->GetCollectedUrls(); |
| 275 | 275 |
| 276 for (size_t i = 0; i < redirects.size(); ++i) | 276 for (size_t i = 0; i < redirects.size(); ++i) |
| 277 AddRedirectUrlList(redirects[i]); | 277 AddRedirectUrlList(redirects[i]); |
| 278 | 278 |
| 279 // Call the cache collector | 279 // Call the cache collector |
| 280 cache_collector_->StartCacheCollection( | 280 cache_collector_->StartCacheCollection( |
| 281 request_context_getter_, | 281 request_context_getter_.get(), |
| 282 &resources_, | 282 &resources_, |
| 283 &cache_result_, | 283 &cache_result_, |
| 284 base::Bind(&MalwareDetails::OnCacheCollectionReady, this)); | 284 base::Bind(&MalwareDetails::OnCacheCollectionReady, this)); |
| 285 } | 285 } |
| 286 | 286 |
| 287 void MalwareDetails::AddRedirectUrlList(const std::vector<GURL>& urls) { | 287 void MalwareDetails::AddRedirectUrlList(const std::vector<GURL>& urls) { |
| 288 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 288 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
| 289 for (size_t i = 0; i < urls.size()-1; ++i) { | 289 for (size_t i = 0; i < urls.size()-1; ++i) { |
| 290 AddUrl(urls[i], urls[i + 1], std::string(), NULL); | 290 AddUrl(urls[i], urls[i + 1], std::string(), NULL); |
| 291 } | 291 } |
| (...skipping 13 matching lines...) Expand all Loading... |
| 305 | 305 |
| 306 // Send the report, using the SafeBrowsingService. | 306 // Send the report, using the SafeBrowsingService. |
| 307 std::string serialized; | 307 std::string serialized; |
| 308 if (!report_->SerializeToString(&serialized)) { | 308 if (!report_->SerializeToString(&serialized)) { |
| 309 DLOG(ERROR) << "Unable to serialize the malware report."; | 309 DLOG(ERROR) << "Unable to serialize the malware report."; |
| 310 return; | 310 return; |
| 311 } | 311 } |
| 312 | 312 |
| 313 ui_manager_->SendSerializedMalwareDetails(serialized); | 313 ui_manager_->SendSerializedMalwareDetails(serialized); |
| 314 } | 314 } |
| OLD | NEW |