first attempt to track the origin requesters of webRequest events

This commit is contained in:
Boik 2017-09-02 21:49:42 +08:00
parent 59cadf9e4b
commit 549c30f9b2
3 changed files with 6338 additions and 3 deletions

View file

@ -75,9 +75,14 @@ void ToDictionary(base::DictionaryValue* details, net::URLRequest* request) {
details->SetInteger("id", request->identifier());
details->SetDouble("timestamp", base::Time::Now().ToDoubleT() * 1000);
auto info = content::ResourceRequestInfo::ForRequest(request);
details->SetString("resourceType",
info ? ResourceTypeToString(info->GetResourceType())
: "other");
if (info) {
int64_t process_id = info->GetChildID();
int64_t routing_id = info->GetRouteID();
details->SetDouble("webContentsGetId", (process_id << 32) + routing_id);
details->SetString("resourceType", ResourceTypeToString(info->GetResourceType()));
} else {
details->SetString("resourceType", "other");
}
}
void ToDictionary(base::DictionaryValue* details,