Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(13)

Side by Side Diff: chrome/browser/safe_browsing/malware_details_cache.cc

Issue 10386063: Move URLFetcherDelegate to net/ and split URLFetcher between net/ and content/ (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: sync to head, fix win component build Created 8 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 ClientMalwareReportRequest::Resource* MalwareDetailsCacheCollector::GetResource( 95 ClientMalwareReportRequest::Resource* MalwareDetailsCacheCollector::GetResource(
96 const GURL& url) { 96 const GURL& url) {
97 safe_browsing::ResourceMap::iterator it = resources_->find(url.spec()); 97 safe_browsing::ResourceMap::iterator it = resources_->find(url.spec());
98 if (it != resources_->end()) { 98 if (it != resources_->end()) {
99 return it->second.get(); 99 return it->second.get();
100 } 100 }
101 return NULL; 101 return NULL;
102 } 102 }
103 103
104 void MalwareDetailsCacheCollector::OnURLFetchComplete( 104 void MalwareDetailsCacheCollector::OnURLFetchComplete(
105 const content::URLFetcher* source) { 105 const net::URLFetcher* source) {
106 DVLOG(1) << "OnUrlFetchComplete"; 106 DVLOG(1) << "OnUrlFetchComplete";
107 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 107 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
108 DCHECK(current_fetch_.get()); 108 DCHECK(current_fetch_.get());
109 if (source->GetStatus().status() != net::URLRequestStatus::SUCCESS && 109 if (source->GetStatus().status() != net::URLRequestStatus::SUCCESS &&
110 source->GetStatus().error() == net::ERR_CACHE_MISS) { 110 source->GetStatus().error() == net::ERR_CACHE_MISS) {
111 // Cache miss, skip this resource. 111 // Cache miss, skip this resource.
112 DVLOG(1) << "Cache miss for url: " << source->GetURL(); 112 DVLOG(1) << "Cache miss for url: " << source->GetURL();
113 AdvanceEntry(); 113 AdvanceEntry();
114 return; 114 return;
115 } 115 }
(...skipping 18 matching lines...) Expand all
134 134
135 ReadResponse(resource, source); 135 ReadResponse(resource, source);
136 std::string data; 136 std::string data;
137 source->GetResponseAsString(&data); 137 source->GetResponseAsString(&data);
138 ReadData(resource, data); 138 ReadData(resource, data);
139 AdvanceEntry(); 139 AdvanceEntry();
140 } 140 }
141 141
142 void MalwareDetailsCacheCollector::ReadResponse( 142 void MalwareDetailsCacheCollector::ReadResponse(
143 ClientMalwareReportRequest::Resource* pb_resource, 143 ClientMalwareReportRequest::Resource* pb_resource,
144 const content::URLFetcher* source) { 144 const net::URLFetcher* source) {
145 DVLOG(1) << "ReadResponse"; 145 DVLOG(1) << "ReadResponse";
146 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 146 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
147 net::HttpResponseHeaders* headers = source->GetResponseHeaders(); 147 net::HttpResponseHeaders* headers = source->GetResponseHeaders();
148 if (!headers) { 148 if (!headers) {
149 DVLOG(1) << "Missing response headers."; 149 DVLOG(1) << "Missing response headers.";
150 return; 150 return;
151 } 151 }
152 152
153 ClientMalwareReportRequest::HTTPResponse* pb_response = 153 ClientMalwareReportRequest::HTTPResponse* pb_response =
154 pb_resource->mutable_response(); 154 pb_resource->mutable_response();
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
201 base::Bind(&MalwareDetailsCacheCollector::OpenEntry, this)); 201 base::Bind(&MalwareDetailsCacheCollector::OpenEntry, this));
202 } 202 }
203 203
204 void MalwareDetailsCacheCollector::AllDone(bool success) { 204 void MalwareDetailsCacheCollector::AllDone(bool success) {
205 DVLOG(1) << "AllDone"; 205 DVLOG(1) << "AllDone";
206 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 206 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
207 *result_ = success; 207 *result_ = success;
208 BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, callback_); 208 BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, callback_);
209 callback_.Reset(); 209 callback_.Reset();
210 } 210 }
OLDNEW
« no previous file with comments | « chrome/browser/safe_browsing/malware_details_cache.h ('k') | chrome/browser/safe_browsing/protocol_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698