Implement opener download metrics for cross-process opener navigations

Currently, the metrics only account for the same-process flow through
BeginNavigation. With this CL, we plumb the relevant information
through the RemoteFrame / RenderFrameProxy / OpenURL path.

Bug: 632514
Change-Id: I38084f83530ed21aed13c98e3c356b1d38206de6
Reviewed-on: https://chromium-review.googlesource.com/c/1380967
Commit-Queue: Charlie Harrison <[email protected]>
Reviewed-by: Nasko Oskov <[email protected]>
Reviewed-by: Dmitry Gozman <[email protected]>
Cr-Commit-Position: refs/heads/master@{#620335}
diff --git a/content/renderer/render_frame_impl.h b/content/renderer/render_frame_impl.h
index 68fb96be..6c9b951f 100644
--- a/content/renderer/render_frame_impl.h
+++ b/content/renderer/render_frame_impl.h
@@ -288,6 +288,15 @@
   // routing ID.
   static blink::WebFrame* ResolveOpener(int opener_frame_routing_id);
 
+  // Gets the download policy for a given navigation with regard to its opener
+  // status. We are trying to block downloads resulting from x-origin opener
+  // navigations if they do not have a gesture. See https://crbug.com/632514 for
+  // background.
+  static NavigationDownloadPolicy GetOpenerDownloadPolicy(
+      bool is_opener_navigation,
+      const blink::WebURLRequest& request,
+      const blink::WebSecurityOrigin& current_origin);
+
   // Overwrites the given URL to use an HTML5 embed if possible.
   blink::WebURL OverrideFlashEmbedWithHTML(const blink::WebURL& url) override;