Move download_item.h from content/public to components/download

This CL moves the DownloadItem class from content/public to components/download.
It is the ongoing effort to make download a standalone component.
To achieve this, this CL splits DownloadItem into 2 classes:
DownloadItem and DownloadItemDelegate.
The new DownloadItemDelegate class allows content layer to inject its own implementation.
This allows any classes that call into DownloadItem::GetWebContents()
and DownloadItem::GetBrowserContext() to still work

BUG=803135

Change-Id: I494164af65eb5d83f395b085bd35b896d62884d8
Reviewed-on: https://chromium-review.googlesource.com/907687
Commit-Queue: Min Qin <[email protected]>
Reviewed-by: John Abd-El-Malek <[email protected]>
Reviewed-by: Scott Violet <[email protected]>
Reviewed-by: David Trainor <[email protected]>
Reviewed-by: Bo <[email protected]>
Reviewed-by: Robert Sesek <[email protected]>
Reviewed-by: Sergey Volk <[email protected]>
Cr-Commit-Position: refs/heads/master@{#535817}
diff --git a/chrome/browser/extensions/webstore_installer.h b/chrome/browser/extensions/webstore_installer.h
index 8e562fca..ce7e85f 100644
--- a/chrome/browser/extensions/webstore_installer.h
+++ b/chrome/browser/extensions/webstore_installer.h
@@ -19,8 +19,8 @@
 #include "base/version.h"
 #include "chrome/browser/extensions/extension_install_prompt.h"
 #include "components/download/public/common/download_interrupt_reasons.h"
+#include "components/download/public/common/download_item.h"
 #include "content/public/browser/browser_thread.h"
-#include "content/public/browser/download_item.h"
 #include "content/public/browser/notification_observer.h"
 #include "content/public/browser/notification_registrar.h"
 #include "content/public/browser/web_contents_observer.h"
@@ -49,7 +49,7 @@
 // Downloads and installs extensions from the web store.
 class WebstoreInstaller : public content::NotificationObserver,
                           public ExtensionRegistryObserver,
-                          public content::DownloadItem::Observer,
+                          public download::DownloadItem::Observer,
                           public content::WebContentsObserver,
                           public base::RefCountedThreadSafe<
                               WebstoreInstaller,
@@ -85,9 +85,9 @@
   class Delegate {
    public:
     virtual void OnExtensionDownloadStarted(const std::string& id,
-                                            content::DownloadItem* item);
+                                            download::DownloadItem* item);
     virtual void OnExtensionDownloadProgress(const std::string& id,
-                                             content::DownloadItem* item);
+                                             download::DownloadItem* item);
     virtual void OnExtensionInstallSuccess(const std::string& id) = 0;
     virtual void OnExtensionInstallFailure(const std::string& id,
                                            const std::string& error,
@@ -169,7 +169,7 @@
   // Gets the Approval associated with the |download|, or NULL if there's none.
   // Note that the Approval is owned by |download|.
   static const Approval* GetAssociatedApproval(
-      const content::DownloadItem& download);
+      const download::DownloadItem& download);
 
   // Creates a WebstoreInstaller for downloading and installing the extension
   // with the given |id| from the Chrome Web Store. If |delegate| is not NULL,
@@ -222,12 +222,12 @@
 
   // DownloadManager::DownloadUrl callback.
   void OnDownloadStarted(const std::string& extension_id,
-                         content::DownloadItem* item,
+                         download::DownloadItem* item,
                          download::DownloadInterruptReason interrupt_reason);
 
   // DownloadItem::Observer implementation:
-  void OnDownloadUpdated(content::DownloadItem* download) override;
-  void OnDownloadDestroyed(content::DownloadItem* download) override;
+  void OnDownloadUpdated(download::DownloadItem* download) override;
+  void OnDownloadDestroyed(download::DownloadItem* download) override;
 
   // Downloads next pending module in |pending_modules_|.
   void DownloadNextPendingModule();
@@ -244,7 +244,7 @@
   void UpdateDownloadProgress();
 
   // Creates and starts CrxInstaller for the downloaded extension package.
-  void StartCrxInstaller(const content::DownloadItem& item);
+  void StartCrxInstaller(const download::DownloadItem& item);
 
   // Reports an install |error| to the delegate for the given extension if this
   // managed its installation. This also removes the associated PendingInstall.
@@ -256,7 +256,7 @@
   void ReportSuccess();
 
   // Records stats regarding an interrupted webstore download item.
-  void RecordInterrupt(const content::DownloadItem* download) const;
+  void RecordInterrupt(const download::DownloadItem* download) const;
 
   content::NotificationRegistrar registrar_;
   ScopedObserver<ExtensionRegistry, ExtensionRegistryObserver>
@@ -267,7 +267,7 @@
   InstallSource install_source_;
   // The DownloadItem is owned by the DownloadManager and is valid from when
   // OnDownloadStarted is called (with no error) until OnDownloadDestroyed().
-  content::DownloadItem* download_item_;
+  download::DownloadItem* download_item_;
   // Used to periodically update the extension's download status. This will
   // trigger at least every second, though sometimes more frequently (depending
   // on number of modules, etc).