Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(273)

Side by Side Diff: chrome/browser/safe_browsing/threat_details.cc

Issue 2713233002: Update ThreatDOMDetails to be able to collect non-resource HTML Elements based on their attributes. (Closed)
Patch Set: Sync Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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 }
503 // Check for a tag_name to avoid adding the summary node to the DOM.
501 if (!node.tag_name.empty()) { 504 if (!node.tag_name.empty()) {
502 AddDomElement(frame_tree_node_id, frame_url.spec(), node.node_id, 505 AddDomElement(frame_tree_node_id, frame_url.spec(), node.node_id,
503 node.tag_name, node.parent_node_id, resource); 506 node.tag_name, node.parent_node_id, resource);
504 } 507 }
505 } 508 }
506 } 509 }
507 510
508 // Called from the SB Service on the IO thread, after the user has 511 // 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 512 // closed the tab, or clicked proceed or goback. Since the user needs
510 // to take an action, we expect this to be called after 513 // to take an action, we expect this to be called after
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
581 // Send the report, using the SafeBrowsingService. 584 // Send the report, using the SafeBrowsingService.
582 std::string serialized; 585 std::string serialized;
583 if (!report_->SerializeToString(&serialized)) { 586 if (!report_->SerializeToString(&serialized)) {
584 DLOG(ERROR) << "Unable to serialize the threat report."; 587 DLOG(ERROR) << "Unable to serialize the threat report.";
585 return; 588 return;
586 } 589 }
587 ui_manager_->SendSerializedThreatDetails(serialized); 590 ui_manager_->SendSerializedThreatDetails(serialized);
588 } 591 }
589 592
590 } // namespace safe_browsing 593 } // namespace safe_browsing
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698