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/callback.h" | 9 #include "base/callback.h" |
10 #include "base/lazy_instance.h" | 10 #include "base/lazy_instance.h" |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
67 factory_ = g_malware_details_factory_impl.Pointer(); | 67 factory_ = g_malware_details_factory_impl.Pointer(); |
68 return factory_->CreateMalwareDetails(sb_service, tab_contents, resource); | 68 return factory_->CreateMalwareDetails(sb_service, tab_contents, resource); |
69 } | 69 } |
70 | 70 |
71 // Create a MalwareDetails for the given tab. Runs in the UI thread. | 71 // Create a MalwareDetails for the given tab. Runs in the UI thread. |
72 MalwareDetails::MalwareDetails( | 72 MalwareDetails::MalwareDetails( |
73 SafeBrowsingService* sb_service, | 73 SafeBrowsingService* sb_service, |
74 TabContents* tab_contents, | 74 TabContents* tab_contents, |
75 const SafeBrowsingService::UnsafeResource& resource) | 75 const SafeBrowsingService::UnsafeResource& resource) |
76 : TabContentsObserver(tab_contents), | 76 : TabContentsObserver(tab_contents), |
77 request_context_getter_(tab_contents->profile()->GetRequestContext()), | 77 request_context_getter_(tab_contents->context()->GetRequestContext()), |
78 sb_service_(sb_service), | 78 sb_service_(sb_service), |
79 resource_(resource), | 79 resource_(resource), |
80 cache_collector_(new MalwareDetailsCacheCollector), | 80 cache_collector_(new MalwareDetailsCacheCollector), |
81 redirects_collector_( | 81 redirects_collector_(new MalwareDetailsRedirectsCollector( |
82 new MalwareDetailsRedirectsCollector(tab_contents->profile())) { | 82 static_cast<Profile*>(tab_contents->context()))) { |
83 StartCollection(); | 83 StartCollection(); |
84 } | 84 } |
85 | 85 |
86 MalwareDetails::~MalwareDetails() { | 86 MalwareDetails::~MalwareDetails() { |
87 } | 87 } |
88 | 88 |
89 bool MalwareDetails::OnMessageReceived(const IPC::Message& message) { | 89 bool MalwareDetails::OnMessageReceived(const IPC::Message& message) { |
90 bool handled = true; | 90 bool handled = true; |
91 IPC_BEGIN_MESSAGE_MAP(MalwareDetails, message) | 91 IPC_BEGIN_MESSAGE_MAP(MalwareDetails, message) |
92 IPC_MESSAGE_HANDLER(SafeBrowsingHostMsg_MalwareDOMDetails, | 92 IPC_MESSAGE_HANDLER(SafeBrowsingHostMsg_MalwareDOMDetails, |
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
301 | 301 |
302 // Send the report, using the SafeBrowsingService. | 302 // Send the report, using the SafeBrowsingService. |
303 std::string serialized; | 303 std::string serialized; |
304 if (!report_->SerializeToString(&serialized)) { | 304 if (!report_->SerializeToString(&serialized)) { |
305 DLOG(ERROR) << "Unable to serialize the malware report."; | 305 DLOG(ERROR) << "Unable to serialize the malware report."; |
306 return; | 306 return; |
307 } | 307 } |
308 | 308 |
309 sb_service_->SendSerializedMalwareDetails(serialized); | 309 sb_service_->SendSerializedMalwareDetails(serialized); |
310 } | 310 } |
OLD | NEW |