diff options
author | rdsmith@chromium.org <rdsmith@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-11-05 18:54:55 +0000 |
---|---|---|
committer | rdsmith@chromium.org <rdsmith@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-11-05 18:54:55 +0000 |
commit | fb904eb5405ef95e0cb0a3d7a8936db400dab91d (patch) | |
tree | 154e03f43ed486e70f8b86d15ebf31338e9248c7 /content | |
parent | beb9940fb0983ecedf4c52197c8888def56e1b8d (diff) | |
download | chromium_src-fb904eb5405ef95e0cb0a3d7a8936db400dab91d.zip chromium_src-fb904eb5405ef95e0cb0a3d7a8936db400dab91d.tar.gz chromium_src-fb904eb5405ef95e0cb0a3d7a8936db400dab91d.tar.bz2 |
Avoid interpreting initial navigation as a download if the download
is really a Save Page As ... operation.
BUG=156538
R=benjhayden@chromium.org
Review URL: https://chromiumcodereview.appspot.com/11276057
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@165972 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content')
-rw-r--r-- | content/browser/download/download_item_impl.cc | 8 | ||||
-rw-r--r-- | content/browser/download/download_item_impl.h | 2 | ||||
-rw-r--r-- | content/browser/download/save_package.cc | 2 | ||||
-rw-r--r-- | content/public/browser/download_item.h | 1 | ||||
-rw-r--r-- | content/public/test/mock_download_item.h | 1 |
5 files changed, 9 insertions, 5 deletions
diff --git a/content/browser/download/download_item_impl.cc b/content/browser/download/download_item_impl.cc index 3cd5e2f..0ab139e 100644 --- a/content/browser/download/download_item_impl.cc +++ b/content/browser/download/download_item_impl.cc @@ -560,6 +560,10 @@ const std::string& DownloadItemImpl::GetETag() const { return etag_; } +bool DownloadItemImpl::IsSavePackageDownload() const { + return is_save_package_download_; +} + const FilePath& DownloadItemImpl::GetFullPath() const { return current_path_; } @@ -848,10 +852,6 @@ DownloadItemImpl::DestinationObserverAsWeakPtr() { return weak_ptr_factory_.GetWeakPtr(); } -bool DownloadItemImpl::IsSavePackageDownload() const { - return is_save_package_download_; -} - void DownloadItemImpl::SetTotalBytes(int64 total_bytes) { total_bytes_ = total_bytes; } diff --git a/content/browser/download/download_item_impl.h b/content/browser/download/download_item_impl.h index e086655..cf6b6e9 100644 --- a/content/browser/download/download_item_impl.h +++ b/content/browser/download/download_item_impl.h @@ -99,6 +99,7 @@ class CONTENT_EXPORT DownloadItemImpl virtual PageTransition GetTransitionType() const OVERRIDE; virtual const std::string& GetLastModifiedTime() const OVERRIDE; virtual const std::string& GetETag() const OVERRIDE; + virtual bool IsSavePackageDownload() const OVERRIDE; virtual const FilePath& GetFullPath() const OVERRIDE; virtual const FilePath& GetTargetFilePath() const OVERRIDE; virtual const FilePath& GetForcedFilePath() const OVERRIDE; @@ -172,7 +173,6 @@ class CONTENT_EXPORT DownloadItemImpl base::WeakPtr<DownloadDestinationObserver> DestinationObserverAsWeakPtr(); // For dispatching on whether we're dealing with a SavePackage download. - virtual bool IsSavePackageDownload() const; // DownloadItemImpl routines only needed by SavePackage ---------------------- diff --git a/content/browser/download/save_package.cc b/content/browser/download/save_package.cc index 6558b17..9d245d9 100644 --- a/content/browser/download/save_package.cc +++ b/content/browser/download/save_package.cc @@ -289,6 +289,7 @@ bool SavePackage::Init( ((save_type_ == SAVE_PAGE_TYPE_AS_MHTML) ? "multipart/related" : "text/html"), this); + // Confirm above didn't delete the tab out from under us. if (!download_created_callback.is_null()) download_created_callback.Run(download_); @@ -1324,6 +1325,7 @@ void SavePackage::CreateDirectoryOnFileThread( void SavePackage::ContinueGetSaveInfo(const FilePath& suggested_path, bool can_save_as_complete) { + // The WebContents which owns this SavePackage may have disappeared during // the UI->FILE->UI thread hop of // GetSaveInfo->CreateDirectoryOnFileThread->ContinueGetSaveInfo. diff --git a/content/public/browser/download_item.h b/content/public/browser/download_item.h index 364e4f3..2d732bb 100644 --- a/content/public/browser/download_item.h +++ b/content/public/browser/download_item.h @@ -199,6 +199,7 @@ class CONTENT_EXPORT DownloadItem : public base::SupportsUserData { virtual PageTransition GetTransitionType() const = 0; virtual const std::string& GetLastModifiedTime() const = 0; virtual const std::string& GetETag() const = 0; + virtual bool IsSavePackageDownload() const = 0; // Destination State accessors -------------------------------------------- diff --git a/content/public/test/mock_download_item.h b/content/public/test/mock_download_item.h index f59a6d6..137cef4 100644 --- a/content/public/test/mock_download_item.h +++ b/content/public/test/mock_download_item.h @@ -55,6 +55,7 @@ class MockDownloadItem : public DownloadItem { MOCK_CONST_METHOD0(GetTransitionType, PageTransition()); MOCK_CONST_METHOD0(GetLastModifiedTime, const std::string&()); MOCK_CONST_METHOD0(GetETag, const std::string&()); + MOCK_CONST_METHOD0(IsSavePackageDownload, bool()); MOCK_CONST_METHOD0(GetFullPath, const FilePath&()); MOCK_CONST_METHOD0(GetTargetFilePath, const FilePath&()); MOCK_CONST_METHOD0(GetForcedFilePath, const FilePath&()); |