[Downloads] Use the initiating StoragePartition for resumption.

The URLRequest created for downloads resumption should be created using
the same StoragePartition as the one used to initiate the download.
Downloads used to use the request context returned via
ResourceContext::GetURLRequestContext(), which can yield the wrong
URLRequestContext (and the wrong StoragePartition) when multiple
StoragePartitions are in use.

Currently non-default StoragePartitions are used for implementing
WebView tag in platform apps. Hence a download that's initiated in a
WebView, if resumed, could result in a network request being issued
that's backed by the wrong StoragePartition without this fix.

This change:

  * Adds the site instance URL to the metadata that's persisted for each
    download.

  * Updates history database schema to accommodate site URL.

  * Updates DownloadURLParameters to take a URLRequestContextGetter
    instead of a ResourceContext. The latter can be uniquely determined
    by the DownloadManager.

  * Updates DownloadItemImpl to use the site instance URL to determine
    the correct StoragePartition to use during resumption.

The rest is assorted tests and plumbing.

R=creis@chromium.org,sky@chromium.org,asargent@chromium.org,jam@chromium.org,svaldez@chromium.org
BUG=606627

Review-Url: https://codereview.chromium.org/1924473003
Cr-Commit-Position: refs/heads/master@{#392849}
43 files changed