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

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

Issue 8416020: Handle additional feedback from http://codereview.chromium.org/8395038/. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 1 month 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 } 101 }
102 102
103 void MalwareDetailsCacheCollector::OnURLFetchComplete( 103 void MalwareDetailsCacheCollector::OnURLFetchComplete(
104 const content::URLFetcher* source) { 104 const content::URLFetcher* source) {
105 DVLOG(1) << "OnUrlFetchComplete"; 105 DVLOG(1) << "OnUrlFetchComplete";
106 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 106 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
107 DCHECK(current_fetch_.get()); 107 DCHECK(current_fetch_.get());
108 if (source->GetStatus().status() != net::URLRequestStatus::SUCCESS && 108 if (source->GetStatus().status() != net::URLRequestStatus::SUCCESS &&
109 source->GetStatus().error() == net::ERR_CACHE_MISS) { 109 source->GetStatus().error() == net::ERR_CACHE_MISS) {
110 // Cache miss, skip this resource. 110 // Cache miss, skip this resource.
111 DVLOG(1) << "Cache miss for url: " << source->GetUrl(); 111 DVLOG(1) << "Cache miss for url: " << source->GetURL();
112 AdvanceEntry(); 112 AdvanceEntry();
113 return; 113 return;
114 } 114 }
115 115
116 if (source->GetStatus().status() != net::URLRequestStatus::SUCCESS) { 116 if (source->GetStatus().status() != net::URLRequestStatus::SUCCESS) {
117 // Some other error occurred, e.g. the request could have been cancelled. 117 // Some other error occurred, e.g. the request could have been cancelled.
118 DVLOG(1) << "Unsuccessful fetch: " << source->GetUrl(); 118 DVLOG(1) << "Unsuccessful fetch: " << source->GetURL();
119 AdvanceEntry(); 119 AdvanceEntry();
120 return; 120 return;
121 } 121 }
122 122
123 // Set the response headers and body to the right resource, which 123 // Set the response headers and body to the right resource, which
124 // might not be the same as the one we asked for. 124 // might not be the same as the one we asked for.
125 // For redirects, resources_it_->first != url.spec(). 125 // For redirects, resources_it_->first != url.spec().
126 ClientMalwareReportRequest::Resource* resource = 126 ClientMalwareReportRequest::Resource* resource =
127 GetResource(source->GetUrl()); 127 GetResource(source->GetURL());
128 if (!resource) { 128 if (!resource) {
129 DVLOG(1) << "Cannot find resource for url:" << source->GetUrl(); 129 DVLOG(1) << "Cannot find resource for url:" << source->GetURL();
130 AdvanceEntry(); 130 AdvanceEntry();
131 return; 131 return;
132 } 132 }
133 133
134 ReadResponse(resource, source); 134 ReadResponse(resource, source);
135 std::string data; 135 std::string data;
136 source->GetResponseAsString(&data); 136 source->GetResponseAsString(&data);
137 ReadData(resource, data); 137 ReadData(resource, data);
138 AdvanceEntry(); 138 AdvanceEntry();
139 } 139 }
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
200 base::Bind(&MalwareDetailsCacheCollector::OpenEntry, this)); 200 base::Bind(&MalwareDetailsCacheCollector::OpenEntry, this));
201 } 201 }
202 202
203 void MalwareDetailsCacheCollector::AllDone(bool success) { 203 void MalwareDetailsCacheCollector::AllDone(bool success) {
204 DVLOG(1) << "AllDone"; 204 DVLOG(1) << "AllDone";
205 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 205 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
206 *result_ = success; 206 *result_ = success;
207 BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, callback_); 207 BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, callback_);
208 callback_.Reset(); 208 callback_.Reset();
209 } 209 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698