Use DownloadManager to initiate downloads instead ResourceDispatcherHost

Downloads have two major failure pathways: dealing with failures before
DownloadResourceHandler/DownloadRequestCore creation, and dealing with
failures after.

Somewhat relatedly, ResourceDispatcherHost::BeginDownload() currently is
responsible for implementing some aspects of download initiation that
really don't belong there. For example, download started callbacks are
handled by ResourceDispatcherHost prior to the creation of
DownloadResourceHandler.

Both of these aren't great. In order to unify failure paths and remove
downloads handling code from ResourceDispatcherHost, we need to first
need to reduce RDH::BeginDownload callers down to just
DownloadManagerImpl. Then we can move download handling logic out of RDH
into DownloadManager.

This CL removes the only other caller of RDH::BeginDownload, which is
RenderMessageFilter. It now makes a UI thread hop to initiate a download
via DownloadManager. The overhead of the thread hop should be negligible
since the frequency of download requests are low.

The touched code paths are already being exercised by existing
content_browsertests.

R=davidben@chromium.org
BUG=7648

Review URL: https://codereview.chromium.org/1644743003

Cr-Commit-Position: refs/heads/master@{#372381}
1 file changed