| 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 "chrome/browser/net/chrome_url_request_context.h" | 11 #include "chrome/browser/net/chrome_url_request_context.h" |
| 12 #include "chrome/browser/profiles/profile.h" | 12 #include "chrome/browser/profiles/profile.h" |
| 13 #include "chrome/browser/safe_browsing/malware_details_cache.h" | 13 #include "chrome/browser/safe_browsing/malware_details_cache.h" |
| 14 #include "chrome/browser/safe_browsing/malware_details_history.h" | 14 #include "chrome/browser/safe_browsing/malware_details_history.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 "chrome/common/safe_browsing/safebrowsing_messages.h" | 17 #include "chrome/common/safe_browsing/safebrowsing_messages.h" |
| 18 #include "content/browser/renderer_host/render_view_host.h" | 18 #include "content/browser/renderer_host/render_view_host.h" |
| 19 #include "content/browser/tab_contents/navigation_entry.h" | 19 #include "content/browser/tab_contents/navigation_entry.h" |
| 20 #include "content/browser/tab_contents/tab_contents.h" | 20 #include "content/browser/tab_contents/tab_contents.h" |
| 21 #include "content/public/browser/browser_thread.h" | 21 #include "content/public/browser/browser_thread.h" |
| 22 #include "net/base/io_buffer.h" | 22 #include "net/base/io_buffer.h" |
| 23 #include "net/disk_cache/disk_cache.h" | 23 #include "net/disk_cache/disk_cache.h" |
| 24 #include "net/url_request/url_request_context_getter.h" | 24 #include "net/url_request/url_request_context_getter.h" |
| 25 | 25 |
| 26 using content::BrowserThread; |
| 26 using safe_browsing::ClientMalwareReportRequest; | 27 using safe_browsing::ClientMalwareReportRequest; |
| 27 | 28 |
| 28 // Keep in sync with KMaxNodes in renderer/safe_browsing/malware_dom_details | 29 // Keep in sync with KMaxNodes in renderer/safe_browsing/malware_dom_details |
| 29 static const uint32 kMaxDomNodes = 500; | 30 static const uint32 kMaxDomNodes = 500; |
| 30 | 31 |
| 31 // static | 32 // static |
| 32 MalwareDetailsFactory* MalwareDetails::factory_ = NULL; | 33 MalwareDetailsFactory* MalwareDetails::factory_ = NULL; |
| 33 | 34 |
| 34 // The default MalwareDetailsFactory. Global, made a singleton so we | 35 // The default MalwareDetailsFactory. Global, made a singleton so we |
| 35 // don't leak it. | 36 // don't leak it. |
| (...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 301 | 302 |
| 302 // Send the report, using the SafeBrowsingService. | 303 // Send the report, using the SafeBrowsingService. |
| 303 std::string serialized; | 304 std::string serialized; |
| 304 if (!report_->SerializeToString(&serialized)) { | 305 if (!report_->SerializeToString(&serialized)) { |
| 305 DLOG(ERROR) << "Unable to serialize the malware report."; | 306 DLOG(ERROR) << "Unable to serialize the malware report."; |
| 306 return; | 307 return; |
| 307 } | 308 } |
| 308 | 309 |
| 309 sb_service_->SendSerializedMalwareDetails(serialized); | 310 sb_service_->SendSerializedMalwareDetails(serialized); |
| 310 } | 311 } |
| OLD | NEW |