| 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 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 71 AllDone(true); | 71 AllDone(true); |
| 72 return; | 72 return; |
| 73 } | 73 } |
| 74 | 74 |
| 75 if (!request_context_getter_.get()) { | 75 if (!request_context_getter_.get()) { |
| 76 DVLOG(1) << "Missing request context getter"; | 76 DVLOG(1) << "Missing request context getter"; |
| 77 AllDone(false); | 77 AllDone(false); |
| 78 return; | 78 return; |
| 79 } | 79 } |
| 80 | 80 |
| 81 current_fetch_.reset(net::URLFetcher::Create( | 81 current_fetch_ = net::URLFetcher::Create(GURL(resources_it_->first), |
| 82 GURL(resources_it_->first), net::URLFetcher::GET, this)); | 82 net::URLFetcher::GET, this); |
| 83 current_fetch_->SetRequestContext(request_context_getter_.get()); | 83 current_fetch_->SetRequestContext(request_context_getter_.get()); |
| 84 // Only from cache, and don't save cookies. | 84 // Only from cache, and don't save cookies. |
| 85 current_fetch_->SetLoadFlags(net::LOAD_ONLY_FROM_CACHE | | 85 current_fetch_->SetLoadFlags(net::LOAD_ONLY_FROM_CACHE | |
| 86 net::LOAD_DO_NOT_SAVE_COOKIES); | 86 net::LOAD_DO_NOT_SAVE_COOKIES); |
| 87 current_fetch_->SetAutomaticallyRetryOn5xx(false); // No retries. | 87 current_fetch_->SetAutomaticallyRetryOn5xx(false); // No retries. |
| 88 current_fetch_->Start(); // OnURLFetchComplete will be called when done. | 88 current_fetch_->Start(); // OnURLFetchComplete will be called when done. |
| 89 } | 89 } |
| 90 | 90 |
| 91 ClientMalwareReportRequest::Resource* MalwareDetailsCacheCollector::GetResource( | 91 ClientMalwareReportRequest::Resource* MalwareDetailsCacheCollector::GetResource( |
| 92 const GURL& url) { | 92 const GURL& url) { |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 195 base::Bind(&MalwareDetailsCacheCollector::OpenEntry, this)); | 195 base::Bind(&MalwareDetailsCacheCollector::OpenEntry, this)); |
| 196 } | 196 } |
| 197 | 197 |
| 198 void MalwareDetailsCacheCollector::AllDone(bool success) { | 198 void MalwareDetailsCacheCollector::AllDone(bool success) { |
| 199 DVLOG(1) << "AllDone"; | 199 DVLOG(1) << "AllDone"; |
| 200 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 200 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| 201 *result_ = success; | 201 *result_ = success; |
| 202 BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, callback_); | 202 BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, callback_); |
| 203 callback_.Reset(); | 203 callback_.Reset(); |
| 204 } | 204 } |
| OLD | NEW |