| 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 17 matching lines...) Expand all Loading... |
| 28 // Keep in sync with KMaxNodes in renderer/safe_browsing/malware_dom_details | 28 // Keep in sync with KMaxNodes in renderer/safe_browsing/malware_dom_details |
| 29 static const uint32 kMaxDomNodes = 500; | 29 static const uint32 kMaxDomNodes = 500; |
| 30 | 30 |
| 31 // static | 31 // static |
| 32 MalwareDetailsFactory* MalwareDetails::factory_ = NULL; | 32 MalwareDetailsFactory* MalwareDetails::factory_ = NULL; |
| 33 | 33 |
| 34 // The default MalwareDetailsFactory. Global, made a singleton so we | 34 // The default MalwareDetailsFactory. Global, made a singleton so we |
| 35 // don't leak it. | 35 // don't leak it. |
| 36 class MalwareDetailsFactoryImpl : public MalwareDetailsFactory { | 36 class MalwareDetailsFactoryImpl : public MalwareDetailsFactory { |
| 37 public: | 37 public: |
| 38 virtual MalwareDetails* CreateMalwareDetails( | 38 MalwareDetails* CreateMalwareDetails( |
| 39 SafeBrowsingUIManager* ui_manager, | 39 SafeBrowsingUIManager* ui_manager, |
| 40 WebContents* web_contents, | 40 WebContents* web_contents, |
| 41 const SafeBrowsingUIManager::UnsafeResource& unsafe_resource) override { | 41 const SafeBrowsingUIManager::UnsafeResource& unsafe_resource) override { |
| 42 return new MalwareDetails(ui_manager, web_contents, unsafe_resource); | 42 return new MalwareDetails(ui_manager, web_contents, unsafe_resource); |
| 43 } | 43 } |
| 44 | 44 |
| 45 private: | 45 private: |
| 46 friend struct base::DefaultLazyInstanceTraits<MalwareDetailsFactoryImpl>; | 46 friend struct base::DefaultLazyInstanceTraits<MalwareDetailsFactoryImpl>; |
| 47 | 47 |
| 48 MalwareDetailsFactoryImpl() {} | 48 MalwareDetailsFactoryImpl() {} |
| (...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 295 | 295 |
| 296 // Send the report, using the SafeBrowsingService. | 296 // Send the report, using the SafeBrowsingService. |
| 297 std::string serialized; | 297 std::string serialized; |
| 298 if (!report_->SerializeToString(&serialized)) { | 298 if (!report_->SerializeToString(&serialized)) { |
| 299 DLOG(ERROR) << "Unable to serialize the malware report."; | 299 DLOG(ERROR) << "Unable to serialize the malware report."; |
| 300 return; | 300 return; |
| 301 } | 301 } |
| 302 | 302 |
| 303 ui_manager_->SendSerializedMalwareDetails(serialized); | 303 ui_manager_->SendSerializedMalwareDetails(serialized); |
| 304 } | 304 } |
| OLD | NEW |