| 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 ThreatDetails class. | 5 // Implementation of the ThreatDetails class. |
| 6 | 6 |
| 7 #include "chrome/browser/safe_browsing/threat_details.h" | 7 #include "chrome/browser/safe_browsing/threat_details.h" |
| 8 | 8 |
| 9 #include <stdint.h> | 9 #include <stdint.h> |
| 10 | 10 |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 82 } | 82 } |
| 83 | 83 |
| 84 current_fetch_ = net::URLFetcher::Create(GURL(resources_it_->first), | 84 current_fetch_ = net::URLFetcher::Create(GURL(resources_it_->first), |
| 85 net::URLFetcher::GET, this); | 85 net::URLFetcher::GET, this); |
| 86 data_use_measurement::DataUseUserData::AttachToFetcher( | 86 data_use_measurement::DataUseUserData::AttachToFetcher( |
| 87 current_fetch_.get(), | 87 current_fetch_.get(), |
| 88 data_use_measurement::DataUseUserData::SAFE_BROWSING); | 88 data_use_measurement::DataUseUserData::SAFE_BROWSING); |
| 89 current_fetch_->SetRequestContext(request_context_getter_.get()); | 89 current_fetch_->SetRequestContext(request_context_getter_.get()); |
| 90 // Only from cache, and don't save cookies. | 90 // Only from cache, and don't save cookies. |
| 91 current_fetch_->SetLoadFlags(net::LOAD_ONLY_FROM_CACHE | | 91 current_fetch_->SetLoadFlags(net::LOAD_ONLY_FROM_CACHE | |
| 92 net::LOAD_SKIP_CACHE_VALIDATION | |
| 92 net::LOAD_DO_NOT_SAVE_COOKIES); | 93 net::LOAD_DO_NOT_SAVE_COOKIES); |
| 93 current_fetch_->SetAutomaticallyRetryOn5xx(false); // No retries. | 94 current_fetch_->SetAutomaticallyRetryOn5xx(false); // No retries. |
| 94 current_fetch_->Start(); // OnURLFetchComplete will be called when done. | 95 current_fetch_->Start(); // OnURLFetchComplete will be called when done. |
| 95 } | 96 } |
| 96 | 97 |
| 97 ClientSafeBrowsingReportRequest::Resource* | 98 ClientSafeBrowsingReportRequest::Resource* |
| 98 ThreatDetailsCacheCollector::GetResource(const GURL& url) { | 99 ThreatDetailsCacheCollector::GetResource(const GURL& url) { |
| 99 ResourceMap::iterator it = resources_->find(url.spec()); | 100 ResourceMap::iterator it = resources_->find(url.spec()); |
| 100 if (it != resources_->end()) { | 101 if (it != resources_->end()) { |
| 101 return it->second.get(); | 102 return it->second.get(); |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 203 | 204 |
| 204 void ThreatDetailsCacheCollector::AllDone(bool success) { | 205 void ThreatDetailsCacheCollector::AllDone(bool success) { |
| 205 DVLOG(1) << "AllDone"; | 206 DVLOG(1) << "AllDone"; |
| 206 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 207 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| 207 *result_ = success; | 208 *result_ = success; |
| 208 BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, callback_); | 209 BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, callback_); |
| 209 callback_.Reset(); | 210 callback_.Reset(); |
| 210 } | 211 } |
| 211 | 212 |
| 212 } // namespace safe_browsing | 213 } // namespace safe_browsing |
| OLD | NEW |