| 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 478 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 489 if (frame_url.is_empty()) { | 489 if (frame_url.is_empty()) { |
| 490 ambiguous_dom_ = true; | 490 ambiguous_dom_ = true; |
| 491 } | 491 } |
| 492 | 492 |
| 493 // Add the urls from the DOM to |resources_|. The renderer could be sending | 493 // Add the urls from the DOM to |resources_|. The renderer could be sending |
| 494 // bogus messages, so limit the number of nodes we accept. | 494 // bogus messages, so limit the number of nodes we accept. |
| 495 // Also update |elements_| with the DOM structure. | 495 // Also update |elements_| with the DOM structure. |
| 496 for (size_t i = 0; i < params.size() && i < kMaxDomNodes; ++i) { | 496 for (size_t i = 0; i < params.size() && i < kMaxDomNodes; ++i) { |
| 497 SafeBrowsingHostMsg_ThreatDOMDetails_Node node = params[i]; | 497 SafeBrowsingHostMsg_ThreatDOMDetails_Node node = params[i]; |
| 498 DVLOG(1) << node.url << ", " << node.tag_name << ", " << node.parent; | 498 DVLOG(1) << node.url << ", " << node.tag_name << ", " << node.parent; |
| 499 ClientSafeBrowsingReportRequest::Resource* resource = | 499 ClientSafeBrowsingReportRequest::Resource* resource = nullptr; |
| 500 AddUrl(node.url, node.parent, node.tag_name, &(node.children)); | 500 if (!node.url.is_empty()) { |
| 501 resource = AddUrl(node.url, node.parent, node.tag_name, &(node.children)); |
| 502 } |
| 501 if (!node.tag_name.empty()) { | 503 if (!node.tag_name.empty()) { |
| 502 AddDomElement(frame_tree_node_id, frame_url.spec(), node.node_id, | 504 AddDomElement(frame_tree_node_id, frame_url.spec(), node.node_id, |
| 503 node.tag_name, node.parent_node_id, resource); | 505 node.tag_name, node.parent_node_id, resource); |
| 504 } | 506 } |
| 505 } | 507 } |
| 506 } | 508 } |
| 507 | 509 |
| 508 // Called from the SB Service on the IO thread, after the user has | 510 // Called from the SB Service on the IO thread, after the user has |
| 509 // closed the tab, or clicked proceed or goback. Since the user needs | 511 // closed the tab, or clicked proceed or goback. Since the user needs |
| 510 // to take an action, we expect this to be called after | 512 // to take an action, we expect this to be called after |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 581 // Send the report, using the SafeBrowsingService. | 583 // Send the report, using the SafeBrowsingService. |
| 582 std::string serialized; | 584 std::string serialized; |
| 583 if (!report_->SerializeToString(&serialized)) { | 585 if (!report_->SerializeToString(&serialized)) { |
| 584 DLOG(ERROR) << "Unable to serialize the threat report."; | 586 DLOG(ERROR) << "Unable to serialize the threat report."; |
| 585 return; | 587 return; |
| 586 } | 588 } |
| 587 ui_manager_->SendSerializedThreatDetails(serialized); | 589 ui_manager_->SendSerializedThreatDetails(serialized); |
| 588 } | 590 } |
| 589 | 591 |
| 590 } // namespace safe_browsing | 592 } // namespace safe_browsing |
| OLD | NEW |