Allow ManifestIconDownloader to download images from a specified frame.

Before this CL, ManifestIconDownloader always downloads icons from the
main frame. This creates a buggy interaction with Content Security
Policy, when the manifest icon download is initiated from inside a
frame.

After this CL, the callers of ManifestIconDownloader can specify an
initiator frame (as a GlobalFrameRoutingId) in which to download the
image. The frame routing ID is passed to WebContents to find the correct
frame that exposes the mojo.ImageDownloader interface.

This CL also exposes the mojo.ImageDownloader interface in all frames
instead of just the main frame.

A subsequent CL will update the callers of ManifestIconDownloader to
pass in the correct frame routing ID.

Bug: 1055360
Change-Id: I31fd58453392ec4e1165ac20dc3a1284dc05f6f8
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2085752
Commit-Queue: Danyao Wang <[email protected]>
Reviewed-by: Kentaro Hara <[email protected]>
Reviewed-by: Kinuko Yasuda <[email protected]>
Cr-Commit-Position: refs/heads/master@{#747105}
diff --git a/content/public/browser/web_contents.h b/content/public/browser/web_contents.h
index 865c1481..65d6373 100644
--- a/content/public/browser/web_contents.h
+++ b/content/public/browser/web_contents.h
@@ -942,6 +942,17 @@
                             bool bypass_cache,
                             ImageDownloadCallback callback) = 0;
 
+  // Same as DownloadImage(), but uses the ImageDownloader from the specified
+  // frame instead of the main frame.
+  virtual int DownloadImageInFrame(
+      const GlobalFrameRoutingId& initiator_frame_routing_id,
+      const GURL& url,
+      bool is_favicon,
+      uint32_t preferred_size,
+      uint32_t max_bitmap_size,
+      bool bypass_cache,
+      ImageDownloadCallback callback) = 0;
+
   // Finds text on a page. |search_text| should not be empty.
   virtual void Find(int request_id,
                     const base::string16& search_text,