Fill in the Network Isolation Key for download request

Earlier only some download requests had the NIK set
( and this CL is increasing the coverage of
the type of download requests with NIK set.

The rule is summarized as follows: the NIK for any download request is
<top frame origin, frame origin> of the document that initiated the
download; NIK for navigation resulted download follows the navigation's
NIK - i.e. use <top-frame origin, top-frame origin> for top navigation;
NIK for download retry/resume/parallel-download follows the original
download/navigation requests’ NIK.

This CL increases the coverage by putting the NIK in the constructor of
DownloadUrlParameters, so that when the ResourceRequest is created in -> CreateResourceRequest() it can always grab the NIK
from the params.

Existing tests coverage: <a download>; context menu save-as download;
and download resume.

TODO 1: In one constructor of DownloadItem it’s supposed to read from
history service (disk). We’ll need to persist the NIK also to disk in
order to pass it to DownloadItem. This is not implemented in this patch.

TODO 2: It’s unclear what is the download request in
DownloadDriverImpl::Start. Currently the NIK is left empty as a TODO.

Bug: 1003528
Change-Id: I16cc494dc9c9c5a3d1e756954adc8bf9dd96ae26
Commit-Queue: Yao Xiao <>
Reviewed-by: Avi Drissman <>
Reviewed-by: Min Qin <>
Cr-Commit-Position: refs/heads/master@{#722234}
28 files changed