[Downloads] Introduce GUIDs for downloads.
Chrome on Android and extensions attempt to keep references to downloads
across browser sessions using download IDs. This isn't safe since a
subsequent browser session could reuse a download ID to refer to a
different download.
In order to provide a weak cross-session reference, this CL introduces
GUIDs. At worst, attempting to lookup a download via a GUID will fail
rather than end up referring to a different download. This assumes that
there will not be any conflicts among the GUIDs, which is apparently a
safe assumption to make.
This CL includes the following changes:
* Introduce a GetGuid() method to DownloadItem and its subclasses.
* Allow DownloadItemImpl to create a new GUID for itself for new
downloads using base::GenerateGuid().
* Store and retrieve GUIDs from downloads history for persisted
downloads.
* Generate GUIDs for downloads in the history DB which are being
migrated due to a browser upgrade.
* Since we are revving the history DB schema, also adds the fields for
HTTP method and hash fields.
Note that in order to keep the size of the CL sane, code for
incorporating HTTP method and hash into the downloads system is not
included in this CL. The latter is
https://codereview.chromium.org/1751603002 .
BUG=593020
Review URL: https://codereview.chromium.org/1781983002
Cr-Commit-Position: refs/heads/master@{#381071}
27 files changed