Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(819)

Unified Diff: content/browser/download/download_item.cc

Issue 8519008: Create a Null DownloadRequestHandle for use by SavePackage DownloadItems. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merged to TOT. Created 9 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/download/download_item.cc
diff --git a/content/browser/download/download_item.cc b/content/browser/download/download_item.cc
index e3eff9943cf34b37c35f0b76a1f26125076bdb2f..46c8639c6dcd5de9d4ed75e69d781b2e54fa3d49 100644
--- a/content/browser/download/download_item.cc
+++ b/content/browser/download/download_item.cc
@@ -110,6 +110,31 @@ DownloadItem::DangerType GetDangerType(bool dangerous_file,
DownloadItem::DANGEROUS_FILE : DownloadItem::NOT_DANGEROUS;
}
+// Classes to null out request handle calls (for SavePage DownloadItems, which
+// may have, e.g., Cancel() called on them without it doing anything)
+// and to DCHECK on them (for history DownloadItems, which should never have
+// any operation that implies an off-thread component, since they don't
+// have any).
+class NullDownloadRequestHandle : public DownloadRequestHandleInterface {
+ public:
+ NullDownloadRequestHandle() {}
+
+ // DownloadRequestHandleInterface calls
+ virtual TabContents* GetTabContents() const OVERRIDE {
+ return NULL;
+ }
+ virtual DownloadManager* GetDownloadManager() const OVERRIDE {
+ return NULL;
+ }
+ virtual void PauseRequest() const OVERRIDE {}
+ virtual void ResumeRequest() const OVERRIDE {}
+ virtual void CancelRequest() const OVERRIDE {}
+ virtual std::string DebugString() const OVERRIDE {
+ return "Null DownloadRequestHandle";
+ }
+};
+
+
} // namespace
// Our download table ID starts at 1, so we use 0 to represent a download that
@@ -201,7 +226,8 @@ DownloadItem::DownloadItem(DownloadManager* download_manager,
const GURL& url,
bool is_otr,
DownloadId download_id)
- : download_id_(download_id),
+ : request_handle_(new NullDownloadRequestHandle()),
+ download_id_(download_id),
full_path_(path),
url_chain_(1, url),
referrer_url_(GURL()),
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698