| 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" |
| (...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 207 } | 207 } |
| 208 | 208 |
| 209 // Add the referrer url. | 209 // Add the referrer url. |
| 210 if (nav_entry && !referrer_url.is_empty()) { | 210 if (nav_entry && !referrer_url.is_empty()) { |
| 211 AddUrl(referrer_url, GURL(), "", NULL); | 211 AddUrl(referrer_url, GURL(), "", NULL); |
| 212 } | 212 } |
| 213 | 213 |
| 214 // Get URLs of frames, scripts etc from the DOM. | 214 // Get URLs of frames, scripts etc from the DOM. |
| 215 // OnReceivedMalwareDOMDetails will be called when the renderer replies. | 215 // OnReceivedMalwareDOMDetails will be called when the renderer replies. |
| 216 RenderViewHost* view = web_contents()->GetRenderViewHost(); | 216 RenderViewHost* view = web_contents()->GetRenderViewHost(); |
| 217 view->Send(new SafeBrowsingMsg_GetMalwareDOMDetails(view->routing_id())); | 217 view->Send(new SafeBrowsingMsg_GetMalwareDOMDetails(view->GetRoutingID())); |
| 218 } | 218 } |
| 219 | 219 |
| 220 // When the renderer is done, this is called. | 220 // When the renderer is done, this is called. |
| 221 void MalwareDetails::OnReceivedMalwareDOMDetails( | 221 void MalwareDetails::OnReceivedMalwareDOMDetails( |
| 222 const std::vector<SafeBrowsingHostMsg_MalwareDOMDetails_Node>& params) { | 222 const std::vector<SafeBrowsingHostMsg_MalwareDOMDetails_Node>& params) { |
| 223 // Schedule this in IO thread, so it doesn't conflict with future users | 223 // Schedule this in IO thread, so it doesn't conflict with future users |
| 224 // of our data structures (eg GetSerializedReport). | 224 // of our data structures (eg GetSerializedReport). |
| 225 BrowserThread::PostTask( | 225 BrowserThread::PostTask( |
| 226 BrowserThread::IO, FROM_HERE, | 226 BrowserThread::IO, FROM_HERE, |
| 227 base::Bind(&MalwareDetails::AddDOMDetails, this, params)); | 227 base::Bind(&MalwareDetails::AddDOMDetails, this, params)); |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 306 | 306 |
| 307 // Send the report, using the SafeBrowsingService. | 307 // Send the report, using the SafeBrowsingService. |
| 308 std::string serialized; | 308 std::string serialized; |
| 309 if (!report_->SerializeToString(&serialized)) { | 309 if (!report_->SerializeToString(&serialized)) { |
| 310 DLOG(ERROR) << "Unable to serialize the malware report."; | 310 DLOG(ERROR) << "Unable to serialize the malware report."; |
| 311 return; | 311 return; |
| 312 } | 312 } |
| 313 | 313 |
| 314 sb_service_->SendSerializedMalwareDetails(serialized); | 314 sb_service_->SendSerializedMalwareDetails(serialized); |
| 315 } | 315 } |
| OLD | NEW |