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> | 9 #include <stddef.h> |
10 #include <stdint.h> | 10 #include <stdint.h> |
(...skipping 436 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
447 new SafeBrowsingMsg_GetThreatDOMDetails(MSG_ROUTING_NONE)); | 447 new SafeBrowsingMsg_GetThreatDOMDetails(MSG_ROUTING_NONE)); |
448 } | 448 } |
449 } | 449 } |
450 | 450 |
451 // When the renderer is done, this is called. | 451 // When the renderer is done, this is called. |
452 void ThreatDetails::OnReceivedThreatDOMDetails( | 452 void ThreatDetails::OnReceivedThreatDOMDetails( |
453 content::RenderFrameHost* sender, | 453 content::RenderFrameHost* sender, |
454 const std::vector<SafeBrowsingHostMsg_ThreatDOMDetails_Node>& params) { | 454 const std::vector<SafeBrowsingHostMsg_ThreatDOMDetails_Node>& params) { |
455 // Schedule this in IO thread, so it doesn't conflict with future users | 455 // Schedule this in IO thread, so it doesn't conflict with future users |
456 // of our data structures (eg GetSerializedReport). | 456 // of our data structures (eg GetSerializedReport). |
457 BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, | 457 BrowserThread::PostTask( |
458 base::Bind(&ThreatDetails::AddDOMDetails, this, | 458 BrowserThread::IO, FROM_HERE, |
459 sender->GetFrameTreeNodeId(), | 459 base::BindOnce(&ThreatDetails::AddDOMDetails, this, |
460 sender->GetLastCommittedURL(), params)); | 460 sender->GetFrameTreeNodeId(), |
| 461 sender->GetLastCommittedURL(), params)); |
461 } | 462 } |
462 | 463 |
463 void ThreatDetails::AddDOMDetails( | 464 void ThreatDetails::AddDOMDetails( |
464 const int frame_tree_node_id, | 465 const int frame_tree_node_id, |
465 const GURL& frame_last_committed_url, | 466 const GURL& frame_last_committed_url, |
466 const std::vector<SafeBrowsingHostMsg_ThreatDOMDetails_Node>& params) { | 467 const std::vector<SafeBrowsingHostMsg_ThreatDOMDetails_Node>& params) { |
467 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 468 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
468 DVLOG(1) << "Nodes from the DOM: " << params.size(); | 469 DVLOG(1) << "Nodes from the DOM: " << params.size(); |
469 | 470 |
470 // If we have already started getting redirects from history service, | 471 // If we have already started getting redirects from history service, |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
592 // Send the report, using the SafeBrowsingService. | 593 // Send the report, using the SafeBrowsingService. |
593 std::string serialized; | 594 std::string serialized; |
594 if (!report_->SerializeToString(&serialized)) { | 595 if (!report_->SerializeToString(&serialized)) { |
595 DLOG(ERROR) << "Unable to serialize the threat report."; | 596 DLOG(ERROR) << "Unable to serialize the threat report."; |
596 return; | 597 return; |
597 } | 598 } |
598 ui_manager_->SendSerializedThreatDetails(serialized); | 599 ui_manager_->SendSerializedThreatDetails(serialized); |
599 } | 600 } |
600 | 601 |
601 } // namespace safe_browsing | 602 } // namespace safe_browsing |
OLD | NEW |