Commit 513b7e3b authored by rdsmith@chromium.org's avatar rdsmith@chromium.org

Make MaybeCompleteDownload private.

R=asanka@chromium.org


Review URL: https://chromiumcodereview.appspot.com/11412202

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@170533 0039d316-1c4b-4281-b951-d872f2087c98
parent 59e44048
......@@ -4,11 +4,10 @@
// File method ordering: Methods in this file are in the same order as
// in download_item_impl.h, with the following exception: The public
// interfaces Start, MaybeCompleteDownload, and OnDownloadCompleting
// are placed in chronological order with the other (private) routines
// that together define a DownloadItem's state transitions
// as the download progresses. See "Download progression cascade" later in
// this file.
// interface Start is placed in chronological order with the other
// (private) routines that together define a DownloadItem's state
// transitions as the download progresses. See "Download progression
// cascade" later in this file.
// A regular DownloadItem (created for a download in this session of the
// browser) normally goes through the following states:
......
......@@ -154,11 +154,6 @@ class CONTENT_EXPORT DownloadItemImpl
// Start the download
virtual void Start(scoped_ptr<DownloadFile> download_file);
// If all pre-requisites have been met, complete download processing, i.e. do
// internal cleanup, file rename, and potentially auto-open. (Dangerous
// downloads still may block on user acceptance after this point.)
virtual void MaybeCompleteDownload();
// Needed because of interwining with DownloadManagerImpl --------------------
// TODO(rdsmith): Unwind DownloadManagerImpl and DownloadItemImpl,
......@@ -260,10 +255,15 @@ class CONTENT_EXPORT DownloadItemImpl
void OnDownloadRenamedToIntermediateName(
DownloadInterruptReason reason, const FilePath& full_path);
// If all pre-requisites have been met, complete download processing, i.e. do
// internal cleanup, file rename, and potentially auto-open. (Dangerous
// downloads still may block on user acceptance after this point.)
void MaybeCompleteDownload();
// Called when the download is ready to complete.
// This may perform final rename if necessary and will eventually call
// DownloadItem::Completed().
virtual void OnDownloadCompleting();
void OnDownloadCompleting();
// Called after the delegate has given the go-ahead to actually complete
// the download.
......@@ -274,7 +274,7 @@ class CONTENT_EXPORT DownloadItemImpl
// Called if the embedder took over opening a download, to indicate that
// the download has been opened.
virtual void DelayedDownloadOpened(bool auto_opened);
void DelayedDownloadOpened(bool auto_opened);
// Called when the entire download operation (including renaming etc)
// is completed.
......@@ -283,7 +283,7 @@ class CONTENT_EXPORT DownloadItemImpl
// Helper routines -----------------------------------------------------------
// Indicate that an error has occurred on the download.
virtual void Interrupt(DownloadInterruptReason reason);
void Interrupt(DownloadInterruptReason reason);
// Cancel the DownloadFile if we have it.
void CancelDownloadFile();
......
......@@ -460,13 +460,12 @@ TEST_F(DownloadItemTest, CallbackAfterRename) {
::testing::Mock::VerifyAndClearExpectations(download_file);
::testing::Mock::VerifyAndClearExpectations(mock_delegate());
item->OnAllDataSaved("");
EXPECT_CALL(*download_file, RenameAndAnnotate(final_path, _))
.WillOnce(ScheduleRenameCallback(final_path));
EXPECT_CALL(*mock_delegate(), ShouldOpenDownload(item, _))
.WillOnce(Return(true));
EXPECT_CALL(*download_file, Detach());
item->MaybeCompleteDownload();
item->DestinationObserverAsWeakPtr()->DestinationCompleted("");
RunAllPendingInMessageLoops();
::testing::Mock::VerifyAndClearExpectations(download_file);
::testing::Mock::VerifyAndClearExpectations(mock_delegate());
......
......@@ -97,7 +97,6 @@ class MockDownloadItemImpl : public DownloadItemImpl {
MOCK_METHOD0(MarkAsComplete, void());
MOCK_METHOD1(OnAllDataSaved, void(const std::string&));
MOCK_METHOD0(OnDownloadedFileRemoved, void());
MOCK_METHOD0(MaybeCompleteDownload, void());
virtual void Start(
scoped_ptr<DownloadFile> download_file) OVERRIDE {
MockStart(download_file.get());
......@@ -561,10 +560,6 @@ class DownloadManagerTest : public testing::Test {
EXPECT_CALL(item, IsInProgress())
.WillOnce(Return(true));
// History addition should result in a call into MaybeCompleteDownload().
EXPECT_CALL(item, MaybeCompleteDownload())
.WillOnce(Return());
}
protected:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment