#include "components/safe_browsing/content/renderer/threat_dom_details.h"
#include <map>
#include <string>
#include <unordered_set>
#include "base/compiler_specific.h"
#include "base/functional/bind.h"
#include "base/metrics/field_trial_params.h"
#include "base/metrics/histogram_macros.h"
#include "base/ranges/algorithm.h"
#include "base/strings/string_split.h"
#include "components/safe_browsing/core/common/features.h"
#include "content/public/renderer/render_frame.h"
#include "third_party/blink/public/platform/web_string.h"
#include "third_party/blink/public/web/web_document.h"
#include "third_party/blink/public/web/web_element.h"
#include "third_party/blink/public/web/web_element_collection.h"
#include "third_party/blink/public/web/web_frame.h"
#include "third_party/blink/public/web/web_local_frame.h"
namespace safe_browsing {
ElementToNodeMap;
const char kTagAndAttributeParamName[] = …;
namespace {
void GetDefaultTagAndAttributeList(
std::vector<TagAndAttributesItem>* tag_and_attributes_list) { … }
void ParseTagAndAttributeParams(
std::vector<TagAndAttributesItem>* tag_and_attributes_list) { … }
mojom::ThreatDOMDetailsNode* GetNodeForElement(
const blink::WebNode& element,
const safe_browsing::ElementToNodeMap& element_to_node_map,
std::vector<mojom::ThreatDOMDetailsNodePtr>* resources) { … }
std::string TruncateAttributeString(const std::string& input) { … }
void HandleElement(
const blink::WebElement& element,
const std::vector<TagAndAttributesItem>& tag_and_attributes_list,
mojom::ThreatDOMDetailsNode* summary_node,
std::vector<mojom::ThreatDOMDetailsNodePtr>* resources,
safe_browsing::ElementToNodeMap* element_to_node_map) { … }
bool ShouldHandleElement(
const blink::WebElement& element,
const std::vector<TagAndAttributesItem>& tag_and_attributes_list) { … }
}
TagAndAttributesItem::TagAndAttributesItem() { … }
TagAndAttributesItem::TagAndAttributesItem(
const std::string& tag_name_param,
const std::vector<std::string>& attributes_param)
: … { … }
TagAndAttributesItem::TagAndAttributesItem(const TagAndAttributesItem& item)
: … { … }
TagAndAttributesItem::~TagAndAttributesItem() { … }
uint32_t ThreatDOMDetails::kMaxNodes = …;
uint32_t ThreatDOMDetails::kMaxAttributes = …;
uint32_t ThreatDOMDetails::kMaxAttributeStringLength = …;
ThreatDOMDetails* ThreatDOMDetails::Create(
content::RenderFrame* render_frame,
service_manager::BinderRegistry* registry) { … }
void ThreatDOMDetails::OnThreatReporterReceiver(
mojo::PendingReceiver<mojom::ThreatReporter> receiver) { … }
ThreatDOMDetails::ThreatDOMDetails(content::RenderFrame* render_frame,
service_manager::BinderRegistry* registry)
: … { … }
ThreatDOMDetails::~ThreatDOMDetails() { … }
void ThreatDOMDetails::GetThreatDOMDetails(
GetThreatDOMDetailsCallback callback) { … }
void ThreatDOMDetails::ExtractResources(
std::vector<mojom::ThreatDOMDetailsNodePtr>* resources) { … }
void ThreatDOMDetails::OnDestruct() { … }
}