OLD | NEW |
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" |
11 #include "base/md5.h" | 11 #include "base/md5.h" |
12 #include "base/string_util.h" | 12 #include "base/string_util.h" |
13 #include "chrome/browser/net/chrome_url_request_context.h" | 13 #include "chrome/browser/net/chrome_url_request_context.h" |
14 #include "chrome/browser/safe_browsing/malware_details_cache.h" | 14 #include "chrome/browser/safe_browsing/malware_details_cache.h" |
15 #include "chrome/browser/safe_browsing/report.pb.h" | 15 #include "chrome/browser/safe_browsing/report.pb.h" |
16 #include "chrome/browser/safe_browsing/safe_browsing_service.h" | 16 #include "chrome/browser/safe_browsing/safe_browsing_service.h" |
17 #include "content/public/browser/browser_thread.h" | 17 #include "content/public/browser/browser_thread.h" |
18 #include "content/public/common/url_fetcher.h" | 18 #include "content/public/common/url_fetcher.h" |
19 #include "net/base/host_port_pair.h" | 19 #include "net/base/host_port_pair.h" |
20 #include "net/base/load_flags.h" | 20 #include "net/base/load_flags.h" |
21 #include "net/http/http_response_headers.h" | 21 #include "net/http/http_response_headers.h" |
22 #include "net/url_request/url_request_context_getter.h" | 22 #include "net/url_request/url_request_context_getter.h" |
23 #include "net/url_request/url_request_status.h" | 23 #include "net/url_request/url_request_status.h" |
24 | 24 |
| 25 using content::BrowserThread; |
25 using safe_browsing::ClientMalwareReportRequest; | 26 using safe_browsing::ClientMalwareReportRequest; |
26 | 27 |
27 // Only send small files for now, a better strategy would use the size | 28 // Only send small files for now, a better strategy would use the size |
28 // of the whole report and the user's bandwidth. | 29 // of the whole report and the user's bandwidth. |
29 static const uint32 kMaxBodySizeBytes = 1024; | 30 static const uint32 kMaxBodySizeBytes = 1024; |
30 | 31 |
31 MalwareDetailsCacheCollector::MalwareDetailsCacheCollector() | 32 MalwareDetailsCacheCollector::MalwareDetailsCacheCollector() |
32 : resources_(NULL), | 33 : resources_(NULL), |
33 result_(NULL), | 34 result_(NULL), |
34 has_started_(false), | 35 has_started_(false), |
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
200 base::Bind(&MalwareDetailsCacheCollector::OpenEntry, this)); | 201 base::Bind(&MalwareDetailsCacheCollector::OpenEntry, this)); |
201 } | 202 } |
202 | 203 |
203 void MalwareDetailsCacheCollector::AllDone(bool success) { | 204 void MalwareDetailsCacheCollector::AllDone(bool success) { |
204 DVLOG(1) << "AllDone"; | 205 DVLOG(1) << "AllDone"; |
205 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 206 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
206 *result_ = success; | 207 *result_ = success; |
207 BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, callback_); | 208 BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, callback_); |
208 callback_.Reset(); | 209 callback_.Reset(); |
209 } | 210 } |
OLD | NEW |