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

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

Issue 2731913003: Remove FillDOMInThreatDetails finch feature. (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 21 matching lines...) Expand all
32 using content::WebContents; 32 using content::WebContents;
33 33
34 // Keep in sync with KMaxNodes in renderer/safe_browsing/threat_dom_details 34 // Keep in sync with KMaxNodes in renderer/safe_browsing/threat_dom_details
35 static const uint32_t kMaxDomNodes = 500; 35 static const uint32_t kMaxDomNodes = 500;
36 36
37 namespace safe_browsing { 37 namespace safe_browsing {
38 38
39 // static 39 // static
40 ThreatDetailsFactory* ThreatDetails::factory_ = NULL; 40 ThreatDetailsFactory* ThreatDetails::factory_ = NULL;
41 41
42 const base::Feature kFillDOMInThreatDetails{"FillDOMInThreatDetails",
43 base::FEATURE_DISABLED_BY_DEFAULT};
44
45 namespace { 42 namespace {
46 43
47 typedef std::unordered_set<std::string> StringSet; 44 typedef std::unordered_set<std::string> StringSet;
48 // A set of HTTPS headers that are allowed to be collected. Contains both 45 // A set of HTTPS headers that are allowed to be collected. Contains both
49 // request and response headers. All entries in this list should be lower-case 46 // request and response headers. All entries in this list should be lower-case
50 // to support case-insensitive comparison. 47 // to support case-insensitive comparison.
51 struct WhitelistedHttpsHeadersTraits 48 struct WhitelistedHttpsHeadersTraits
52 : base::internal::DestructorAtExitLazyInstanceTraits<StringSet> { 49 : base::internal::DestructorAtExitLazyInstanceTraits<StringSet> {
53 static StringSet* New(void* instance) { 50 static StringSet* New(void* instance) {
54 StringSet* headers = 51 StringSet* headers =
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after
279 } 276 }
280 277
281 void ThreatDetails::AddDomElement( 278 void ThreatDetails::AddDomElement(
282 const int frame_tree_node_id, 279 const int frame_tree_node_id,
283 const std::string& frame_url, 280 const std::string& frame_url,
284 const int element_node_id, 281 const int element_node_id,
285 const std::string& tagname, 282 const std::string& tagname,
286 const int parent_element_node_id, 283 const int parent_element_node_id,
287 const std::vector<AttributeNameValue>& attributes, 284 const std::vector<AttributeNameValue>& attributes,
288 const ClientSafeBrowsingReportRequest::Resource* resource) { 285 const ClientSafeBrowsingReportRequest::Resource* resource) {
289 if (!base::FeatureList::IsEnabled(kFillDOMInThreatDetails)) {
290 return;
291 }
292
293 // Create the element. It should not exist already since this function should 286 // Create the element. It should not exist already since this function should
294 // only be called once for each element. 287 // only be called once for each element.
295 const std::string element_key = 288 const std::string element_key =
296 GetElementKey(frame_tree_node_id, element_node_id); 289 GetElementKey(frame_tree_node_id, element_node_id);
297 HTMLElement* cur_element = FindOrCreateElement(element_key); 290 HTMLElement* cur_element = FindOrCreateElement(element_key);
298 291
299 // Set some basic metadata about the element. 292 // Set some basic metadata about the element.
300 const std::string tag_name_upper = base::ToUpperASCII(tagname); 293 const std::string tag_name_upper = base::ToUpperASCII(tagname);
301 if (!tag_name_upper.empty()) { 294 if (!tag_name_upper.empty()) {
302 cur_element->set_tag(tag_name_upper); 295 cur_element->set_tag(tag_name_upper);
(...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after
589 // Send the report, using the SafeBrowsingService. 582 // Send the report, using the SafeBrowsingService.
590 std::string serialized; 583 std::string serialized;
591 if (!report_->SerializeToString(&serialized)) { 584 if (!report_->SerializeToString(&serialized)) {
592 DLOG(ERROR) << "Unable to serialize the threat report."; 585 DLOG(ERROR) << "Unable to serialize the threat report.";
593 return; 586 return;
594 } 587 }
595 ui_manager_->SendSerializedThreatDetails(serialized); 588 ui_manager_->SendSerializedThreatDetails(serialized);
596 } 589 }
597 590
598 } // namespace safe_browsing 591 } // namespace safe_browsing
OLDNEW
« no previous file with comments | « chrome/browser/safe_browsing/threat_details.h ('k') | chrome/browser/safe_browsing/threat_details_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698