| 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 ThreatDetails class. | 5 // Implementation of the ThreatDetails class. |
| 6 | 6 |
| 7 #include "chrome/browser/safe_browsing/threat_details.h" | 7 #include "chrome/browser/safe_browsing/threat_details.h" |
| 8 | 8 |
| 9 #include <stddef.h> |
| 10 #include <stdint.h> |
| 11 |
| 9 #include "base/bind.h" | 12 #include "base/bind.h" |
| 10 #include "base/lazy_instance.h" | 13 #include "base/lazy_instance.h" |
| 14 #include "base/macros.h" |
| 11 #include "chrome/browser/profiles/profile.h" | 15 #include "chrome/browser/profiles/profile.h" |
| 12 #include "chrome/browser/safe_browsing/threat_details_cache.h" | 16 #include "chrome/browser/safe_browsing/threat_details_cache.h" |
| 13 #include "chrome/browser/safe_browsing/threat_details_history.h" | 17 #include "chrome/browser/safe_browsing/threat_details_history.h" |
| 14 #include "chrome/common/safe_browsing/safebrowsing_messages.h" | 18 #include "chrome/common/safe_browsing/safebrowsing_messages.h" |
| 15 #include "content/public/browser/browser_thread.h" | 19 #include "content/public/browser/browser_thread.h" |
| 16 #include "content/public/browser/navigation_controller.h" | 20 #include "content/public/browser/navigation_controller.h" |
| 17 #include "content/public/browser/navigation_entry.h" | 21 #include "content/public/browser/navigation_entry.h" |
| 18 #include "content/public/browser/render_view_host.h" | 22 #include "content/public/browser/render_view_host.h" |
| 19 #include "content/public/browser/web_contents.h" | 23 #include "content/public/browser/web_contents.h" |
| 20 #include "net/url_request/url_request_context_getter.h" | 24 #include "net/url_request/url_request_context_getter.h" |
| 21 | 25 |
| 22 using content::BrowserThread; | 26 using content::BrowserThread; |
| 23 using content::NavigationEntry; | 27 using content::NavigationEntry; |
| 24 using content::WebContents; | 28 using content::WebContents; |
| 25 | 29 |
| 26 // Keep in sync with KMaxNodes in renderer/safe_browsing/threat_dom_details | 30 // Keep in sync with KMaxNodes in renderer/safe_browsing/threat_dom_details |
| 27 static const uint32 kMaxDomNodes = 500; | 31 static const uint32_t kMaxDomNodes = 500; |
| 28 | 32 |
| 29 namespace safe_browsing { | 33 namespace safe_browsing { |
| 30 | 34 |
| 31 // static | 35 // static |
| 32 ThreatDetailsFactory* ThreatDetails::factory_ = NULL; | 36 ThreatDetailsFactory* ThreatDetails::factory_ = NULL; |
| 33 | 37 |
| 34 namespace { | 38 namespace { |
| 35 | 39 |
| 36 // Helper function that converts SBThreatType to | 40 // Helper function that converts SBThreatType to |
| 37 // ClientSafeBrowsingReportRequest::ReportType. | 41 // ClientSafeBrowsingReportRequest::ReportType. |
| (...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 338 // Send the report, using the SafeBrowsingService. | 342 // Send the report, using the SafeBrowsingService. |
| 339 std::string serialized; | 343 std::string serialized; |
| 340 if (!report_->SerializeToString(&serialized)) { | 344 if (!report_->SerializeToString(&serialized)) { |
| 341 DLOG(ERROR) << "Unable to serialize the threat report."; | 345 DLOG(ERROR) << "Unable to serialize the threat report."; |
| 342 return; | 346 return; |
| 343 } | 347 } |
| 344 ui_manager_->SendSerializedThreatDetails(serialized); | 348 ui_manager_->SendSerializedThreatDetails(serialized); |
| 345 } | 349 } |
| 346 | 350 |
| 347 } // namespace safe_browsing | 351 } // namespace safe_browsing |
| OLD | NEW |