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 (LowerCaseEqualsASCII(name, "set-cookie")) { | 159 if (base::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 25 matching lines...) Expand all 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 |