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 #include "components/safe_browsing/renderer/threat_dom_details.h" | 5 #include "components/safe_browsing/renderer/threat_dom_details.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <map> | 8 #include <map> |
9 #include <unordered_set> | 9 #include <unordered_set> |
10 | 10 |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
139 const GURL& child_url = GURL(full_url); | 139 const GURL& child_url = GURL(full_url); |
140 if (!child_url.is_empty() && child_url.is_valid()) { | 140 if (!child_url.is_empty() && child_url.is_valid()) { |
141 summary_node->children.push_back(child_url); | 141 summary_node->children.push_back(child_url); |
142 } | 142 } |
143 | 143 |
144 SafeBrowsingHostMsg_ThreatDOMDetails_Node child_node; | 144 SafeBrowsingHostMsg_ThreatDOMDetails_Node child_node; |
145 child_node.url = child_url; | 145 child_node.url = child_url; |
146 child_node.tag_name = element.TagName().Utf8(); | 146 child_node.tag_name = element.TagName().Utf8(); |
147 child_node.parent = summary_node->url; | 147 child_node.parent = summary_node->url; |
148 | 148 |
149 // The body of an iframe will be in a different renderer. Look up the | |
150 // routing_id of that renderer and store it with the iframe node. | |
151 if (child_node.tag_name == "IFRAME" || child_node.tag_name == "FRAME") { | |
dmazzoni
2017/05/01 20:10:07
Checking the tag name seems brittle to me, even th
lpz
2017/05/02 19:36:24
Thanks, done.
| |
152 blink::WebFrame* subwebframe = | |
153 blink::WebFrame::FromFrameOwnerElement(element); | |
154 child_node.other_frame_routing_id = | |
155 content::RenderFrame::GetRoutingIdForWebFrame(subwebframe); | |
156 } | |
157 | |
149 // Populate the element's attributes, but only collect the ones that are | 158 // Populate the element's attributes, but only collect the ones that are |
150 // configured in the finch study. | 159 // configured in the finch study. |
151 const auto& tag_attribute_iter = std::find_if( | 160 const auto& tag_attribute_iter = std::find_if( |
152 tag_and_attributes_list.begin(), tag_and_attributes_list.end(), | 161 tag_and_attributes_list.begin(), tag_and_attributes_list.end(), |
153 TagNameIs(base::ToLowerASCII(child_node.tag_name))); | 162 TagNameIs(base::ToLowerASCII(child_node.tag_name))); |
154 if (tag_attribute_iter != tag_and_attributes_list.end()) { | 163 if (tag_attribute_iter != tag_and_attributes_list.end()) { |
155 const std::vector<std::string> attributes_to_collect = | 164 const std::vector<std::string> attributes_to_collect = |
156 tag_attribute_iter->attributes; | 165 tag_attribute_iter->attributes; |
157 for (const std::string& attribute : attributes_to_collect) { | 166 for (const std::string& attribute : attributes_to_collect) { |
158 blink::WebString attr_webstring = blink::WebString::FromASCII(attribute); | 167 blink::WebString attr_webstring = blink::WebString::FromASCII(attribute); |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
298 } | 307 } |
299 } | 308 } |
300 resources->push_back(details_node); | 309 resources->push_back(details_node); |
301 } | 310 } |
302 | 311 |
303 void ThreatDOMDetails::OnDestruct() { | 312 void ThreatDOMDetails::OnDestruct() { |
304 delete this; | 313 delete this; |
305 } | 314 } |
306 | 315 |
307 } // namespace safe_browsing | 316 } // namespace safe_browsing |
OLD | NEW |