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 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
149 ClientMalwareReportRequest::HTTPResponse* pb_response = | 149 ClientMalwareReportRequest::HTTPResponse* pb_response = |
150 pb_resource->mutable_response(); | 150 pb_resource->mutable_response(); |
151 pb_response->mutable_firstline()->set_code(headers->response_code()); | 151 pb_response->mutable_firstline()->set_code(headers->response_code()); |
152 void* iter = NULL; | 152 void* iter = NULL; |
153 std::string name, value; | 153 std::string name, value; |
154 while (headers->EnumerateHeaderLines(&iter, &name, &value)) { | 154 while (headers->EnumerateHeaderLines(&iter, &name, &value)) { |
155 ClientMalwareReportRequest::HTTPHeader* pb_header = | 155 ClientMalwareReportRequest::HTTPHeader* pb_header = |
156 pb_response->add_headers(); | 156 pb_response->add_headers(); |
157 pb_header->set_name(name); | 157 pb_header->set_name(name); |
158 // Strip any Set-Cookie headers. | 158 // Strip any Set-Cookie headers. |
159 if (base::LowerCaseEqualsASCII(name, "set-cookie")) { | 159 if (LowerCaseEqualsASCII(name, "set-cookie")) { |
160 pb_header->set_value(""); | 160 pb_header->set_value(""); |
161 } else { | 161 } else { |
162 pb_header->set_value(value); | 162 pb_header->set_value(value); |
163 } | 163 } |
164 } | 164 } |
165 | 165 |
166 if (!source->WasFetchedViaProxy()) { | 166 if (!source->WasFetchedViaProxy()) { |
167 pb_response->set_remote_ip(source->GetSocketAddress().ToString()); | 167 pb_response->set_remote_ip(source->GetSocketAddress().ToString()); |
168 } | 168 } |
169 } | 169 } |
(...skipping 27 matching lines...) Expand all Loading... |
197 base::Bind(&MalwareDetailsCacheCollector::OpenEntry, this)); | 197 base::Bind(&MalwareDetailsCacheCollector::OpenEntry, this)); |
198 } | 198 } |
199 | 199 |
200 void MalwareDetailsCacheCollector::AllDone(bool success) { | 200 void MalwareDetailsCacheCollector::AllDone(bool success) { |
201 DVLOG(1) << "AllDone"; | 201 DVLOG(1) << "AllDone"; |
202 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 202 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
203 *result_ = success; | 203 *result_ = success; |
204 BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, callback_); | 204 BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, callback_); |
205 callback_.Reset(); | 205 callback_.Reset(); |
206 } | 206 } |
OLD | NEW |