diff options
18 files changed, 184 insertions, 351 deletions
diff --git a/chrome/browser/DEPS b/chrome/browser/DEPS index 782262b..6155ac4 100644 --- a/chrome/browser/DEPS +++ b/chrome/browser/DEPS @@ -44,7 +44,6 @@ include_rules = [ "+content/browser/download/download_create_info.h", "+content/browser/download/download_file_impl.h", "+content/browser/download/download_file_manager.h", - "+content/browser/download/download_item_impl.h", "+content/browser/download/download_persistent_store_info.h", "+content/browser/download/download_request_handle.h", "+content/browser/download/download_state_info.h", diff --git a/chrome/browser/download/chrome_download_manager_delegate.cc b/chrome/browser/download/chrome_download_manager_delegate.cc index 73856ba..b353035 100644 --- a/chrome/browser/download/chrome_download_manager_delegate.cc +++ b/chrome/browser/download/chrome_download_manager_delegate.cc @@ -144,31 +144,9 @@ void ChromeDownloadManagerDelegate::ChooseDownloadPath( download_manager_, web_contents, suggested_path, data); } -bool ChromeDownloadManagerDelegate::OverrideIntermediatePath( - DownloadItem* item, - FilePath* intermediate_path) { - if (item->GetDangerType() != content::DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS) { - if (item->PromptUserForSaveLocation()) { - // When we prompt the user, we overwrite the FullPath with what the user - // wanted to use. Construct a file path using the previously determined - // intermediate filename and the new path. - // TODO(asanka): This can trample an in-progress download in the new - // target directory if it was using the same intermediate name. - FilePath file_name = item->GetSuggestedPath().BaseName(); - *intermediate_path = item->GetFullPath().DirName().Append(file_name); - return true; - } else { - // The download's name is already set to an intermediate name, so no need - // to override. - return false; - } - } - - // The download is a safe download. We need to rename it to its intermediate - // '.crdownload' path. The final name after user confirmation will be set - // from DownloadItem::OnDownloadCompleting. - *intermediate_path = download_util::GetCrDownloadPath(item->GetFullPath()); - return true; +FilePath ChromeDownloadManagerDelegate::GetIntermediatePath( + const FilePath& suggested_path) { + return download_util::GetCrDownloadPath(suggested_path); } WebContents* ChromeDownloadManagerDelegate:: @@ -254,10 +232,6 @@ bool ChromeDownloadManagerDelegate::GenerateFileHash() { #endif } -void ChromeDownloadManagerDelegate::OnResponseCompleted(DownloadItem* item) { - // TODO(noelutz): remove this method from the delegate API. -} - void ChromeDownloadManagerDelegate::AddItemToPersistentStore( DownloadItem* item) { download_history_->AddEntry(item, diff --git a/chrome/browser/download/chrome_download_manager_delegate.h b/chrome/browser/download/chrome_download_manager_delegate.h index d0464763..6d7c6ea 100644 --- a/chrome/browser/download/chrome_download_manager_delegate.h +++ b/chrome/browser/download/chrome_download_manager_delegate.h @@ -59,15 +59,13 @@ class ChromeDownloadManagerDelegate virtual void ChooseDownloadPath(content::WebContents* web_contents, const FilePath& suggested_path, void* data) OVERRIDE; - virtual bool OverrideIntermediatePath(content::DownloadItem* item, - FilePath* intermediate_path) OVERRIDE; + virtual FilePath GetIntermediatePath(const FilePath& suggested_path) OVERRIDE; virtual content::WebContents* GetAlternativeWebContentsToNotifyForDownload() OVERRIDE; virtual bool ShouldOpenFileBasedOnExtension(const FilePath& path) OVERRIDE; virtual bool ShouldCompleteDownload(content::DownloadItem* item) OVERRIDE; virtual bool ShouldOpenDownload(content::DownloadItem* item) OVERRIDE; virtual bool GenerateFileHash() OVERRIDE; - virtual void OnResponseCompleted(content::DownloadItem* item) OVERRIDE; virtual void AddItemToPersistentStore(content::DownloadItem* item) OVERRIDE; virtual void UpdateItemInPersistentStore( content::DownloadItem* item) OVERRIDE; diff --git a/chrome/chrome_tests.gypi b/chrome/chrome_tests.gypi index 756e9ea..1549df0 100644 --- a/chrome/chrome_tests.gypi +++ b/chrome/chrome_tests.gypi @@ -1395,8 +1395,6 @@ 'browser/cookies_tree_model_unittest.cc', 'browser/custom_handlers/protocol_handler_registry_unittest.cc', 'browser/diagnostics/diagnostics_model_unittest.cc', - 'browser/download/download_item_unittest.cc', - 'browser/download/download_manager_unittest.cc', 'browser/download/download_request_infobar_delegate_unittest.cc', 'browser/download/download_request_limiter_unittest.cc', 'browser/download/download_shelf_unittest.cc', diff --git a/content/browser/download/download_file_manager_unittest.cc b/content/browser/download/download_file_manager_unittest.cc index de710f2..d3cc760 100644 --- a/content/browser/download/download_file_manager_unittest.cc +++ b/content/browser/download/download_file_manager_unittest.cc @@ -15,7 +15,6 @@ #include "content/browser/download/download_status_updater.h" #include "content/browser/download/mock_download_file.h" #include "content/browser/download/mock_download_manager.h" -#include "content/browser/download/mock_download_manager_delegate.h" #include "content/public/browser/download_id.h" #include "net/base/io_buffer.h" #include "net/base/net_errors.h" diff --git a/content/browser/download/download_file_unittest.cc b/content/browser/download/download_file_unittest.cc index 9ca77c5..a00207e 100644 --- a/content/browser/download/download_file_unittest.cc +++ b/content/browser/download/download_file_unittest.cc @@ -11,7 +11,6 @@ #include "content/browser/download/download_request_handle.h" #include "content/browser/download/download_status_updater.h" #include "content/browser/download/mock_download_manager.h" -#include "content/browser/download/mock_download_manager_delegate.h" #include "content/public/browser/download_manager.h" #include "net/base/file_stream.h" #include "net/base/net_errors.h" diff --git a/content/browser/download/download_id_unittest.cc b/content/browser/download/download_id_unittest.cc index 5a80a39..c3c8ea1 100644 --- a/content/browser/download/download_id_unittest.cc +++ b/content/browser/download/download_id_unittest.cc @@ -12,7 +12,6 @@ #include "base/memory/scoped_ptr.h" #include "content/browser/browser_thread_impl.h" #include "content/browser/download/mock_download_manager.h" -#include "content/browser/download/mock_download_manager_delegate.h" #include "testing/gtest/include/gtest/gtest.h" using content::BrowserThread; diff --git a/chrome/browser/download/download_item_unittest.cc b/content/browser/download/download_item_impl_unittest.cc index dcafc04..acfd82c 100644 --- a/chrome/browser/download/download_item_unittest.cc +++ b/content/browser/download/download_item_impl_unittest.cc @@ -5,7 +5,6 @@ #include "base/message_loop.h" #include "base/stl_util.h" #include "base/threading/thread.h" -#include "chrome/test/base/testing_profile.h" #include "content/browser/download/download_create_info.h" #include "content/browser/download/download_item_impl.h" #include "content/browser/download/download_request_handle.h" diff --git a/content/browser/download/download_manager_impl.cc b/content/browser/download/download_manager_impl.cc index d34310d8..65f60c9 100644 --- a/content/browser/download/download_manager_impl.cc +++ b/content/browser/download/download_manager_impl.cc @@ -462,8 +462,27 @@ void DownloadManagerImpl::ContinueDownloadWithPath( // Rename to intermediate name. FilePath download_path; - if (!delegate_->OverrideIntermediatePath(download, &download_path)) - download_path = download->GetFullPath(); + if (download->GetDangerType() != + content::DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS) { + if (download->PromptUserForSaveLocation()) { + // When we prompt the user, we overwrite the FullPath with what the user + // wanted to use. Construct a file path using the previously determined + // intermediate filename and the new path. + // TODO(asanka): This can trample an in-progress download in the new + // target directory if it was using the same intermediate name. + FilePath file_name = download->GetSuggestedPath().BaseName(); + download_path = download->GetFullPath().DirName().Append(file_name); + } else { + // The download's name is already set to an intermediate name, so no need + // to override. + download_path = download->GetFullPath(); + } + } else { + // The download is a safe download. We need to rename it to its + // intermediate path. The final name after user confirmation will be set + // from DownloadItem::OnDownloadCompleting. + download_path = delegate_->GetIntermediatePath(download->GetFullPath()); + } BrowserThread::PostTask( BrowserThread::FILE, FROM_HERE, @@ -507,7 +526,6 @@ void DownloadManagerImpl::OnResponseCompleted(int32 download_id, DownloadItem* download = active_downloads_[download_id]; download->OnAllDataSaved(size, hash); - delegate_->OnResponseCompleted(download); download->MaybeCompleteDownload(); } diff --git a/chrome/browser/download/download_manager_unittest.cc b/content/browser/download/download_manager_impl_unittest.cc index 59723fe..44bb537f 100644 --- a/chrome/browser/download/download_manager_unittest.cc +++ b/content/browser/download/download_manager_impl_unittest.cc @@ -7,8 +7,6 @@ #include "base/bind.h" #include "base/file_util.h" -#include "base/i18n/number_formatting.h" -#include "base/i18n/rtl.h" #include "base/memory/scoped_ptr.h" #include "base/message_loop.h" #include "base/scoped_temp_dir.h" @@ -17,32 +15,25 @@ #include "base/string_util.h" #include "base/utf_string_conversions.h" #include "build/build_config.h" -#include "chrome/browser/download/chrome_download_manager_delegate.h" -#include "chrome/browser/download/download_item_model.h" -#include "chrome/browser/download/download_prefs.h" -#include "chrome/browser/download/download_util.h" -#include "chrome/browser/prefs/pref_service.h" -#include "chrome/common/pref_names.h" -#include "chrome/test/base/testing_profile.h" #include "content/browser/download/download_buffer.h" #include "content/browser/download/download_create_info.h" #include "content/browser/download/download_file_impl.h" #include "content/browser/download/download_file_manager.h" +#include "content/browser/download/download_manager_impl.h" #include "content/browser/download/download_request_handle.h" #include "content/browser/download/download_status_updater.h" #include "content/browser/download/interrupt_reasons.h" #include "content/browser/download/mock_download_file.h" #include "content/browser/download/mock_download_manager.h" #include "content/public/browser/download_item.h" -#include "content/public/browser/download_manager.h" +#include "content/public/browser/download_manager_delegate.h" +#include "content/test/test_browser_context.h" #include "content/test/test_browser_thread.h" -#include "grit/generated_resources.h" #include "net/base/io_buffer.h" +#include "net/base/net_util.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gmock_mutant.h" #include "testing/gtest/include/gtest/gtest.h" -#include "ui/base/l10n/l10n_util.h" -#include "ui/base/text/bytes_formatting.h" #if defined(USE_AURA) && defined(OS_WIN) // http://crbug.com/105200 @@ -63,17 +54,23 @@ #define MAYBE_DownloadFileErrorTest DownloadFileErrorTest #endif +using content::BrowserContext; using content::BrowserThread; using content::DownloadFile; using content::DownloadId; using content::DownloadItem; using content::DownloadManager; +using content::WebContents; using ::testing::ReturnRef; using ::testing::Return; -using content::WebContents; namespace { +FilePath GetTempDownloadPath(const FilePath& suggested_path) { + return DownloadFile::AppendSuffixToPath( + suggested_path, FILE_PATH_LITERAL(".temp")); +} + class MockDownloadFileFactory : public DownloadFileManager::DownloadFileFactory { public: @@ -96,11 +93,40 @@ DownloadFile* MockDownloadFileFactory::CreateFile( DownloadId::Domain kValidIdDomain = "valid DownloadId::Domain"; -class TestDownloadManagerDelegate : public ChromeDownloadManagerDelegate { +class TestDownloadManagerDelegate : public content::DownloadManagerDelegate { public: - explicit TestDownloadManagerDelegate(Profile* profile) - : ChromeDownloadManagerDelegate(profile), - mark_content_dangerous_(false) { + TestDownloadManagerDelegate() + : mark_content_dangerous_(false), + prompt_user_for_save_location_(false), + download_manager_(NULL) { + } + + void set_download_manager(content::DownloadManager* dm) { + download_manager_ = dm; + } + + void set_prompt_user_for_save_location(bool value) { + prompt_user_for_save_location_ = value; + } + + virtual bool ShouldStartDownload(int32 download_id) OVERRIDE { + DownloadItem* item = download_manager_->GetActiveDownloadItem(download_id); + DownloadStateInfo state = item->GetStateInfo(); + FilePath path = net::GenerateFileName(item->GetURL(), + item->GetContentDisposition(), + item->GetReferrerCharset(), + item->GetSuggestedFilename(), + item->GetMimeType(), + std::string()); + if (!ShouldOpenFileBasedOnExtension(path) && prompt_user_for_save_location_) + state.prompt_user_for_save_location = true; + item->SetFileCheckResults(state); + return true; + } + + virtual FilePath GetIntermediatePath( + const FilePath& suggested_path) OVERRIDE { + return GetTempDownloadPath(suggested_path); } virtual void ChooseDownloadPath(WebContents* web_contents, @@ -114,13 +140,13 @@ class TestDownloadManagerDelegate : public ChromeDownloadManagerDelegate { BrowserThread::PostTask( BrowserThread::UI, FROM_HERE, base::Bind(&DownloadManager::FileSelectionCanceled, - download_manager_.get(), + download_manager_, base::Unretained(data))); } else { BrowserThread::PostTask( BrowserThread::UI, FROM_HERE, base::Bind(&DownloadManager::FileSelected, - download_manager_.get(), + download_manager_, file_selection_response_, base::Unretained(data))); } @@ -128,6 +154,15 @@ class TestDownloadManagerDelegate : public ChromeDownloadManagerDelegate { file_selection_response_.clear(); } + virtual bool ShouldOpenFileBasedOnExtension(const FilePath& path) OVERRIDE { + return path.Extension() == FilePath::StringType(FILE_PATH_LITERAL(".pdf")); + } + + virtual void AddItemToPersistentStore(DownloadItem* item) OVERRIDE { + static int64 db_handle = DownloadItem::kUninitializedHandle; + download_manager_->OnItemAddedToPersistentStore(item->GetId(), --db_handle); + } + void SetFileSelectionExpectation(const FilePath& suggested_path, const FilePath& response) { expected_suggested_path_ = suggested_path; @@ -143,7 +178,7 @@ class TestDownloadManagerDelegate : public ChromeDownloadManagerDelegate { BrowserThread::PostTask( BrowserThread::UI, FROM_HERE, base::Bind(&TestDownloadManagerDelegate::MarkContentDangerous, - this, item->GetId())); + base::Unretained(this), item->GetId())); mark_content_dangerous_ = false; return false; } else { @@ -163,6 +198,8 @@ class TestDownloadManagerDelegate : public ChromeDownloadManagerDelegate { FilePath expected_suggested_path_; FilePath file_selection_response_; bool mark_content_dangerous_; + bool prompt_user_for_save_location_; + DownloadManager* download_manager_; }; } // namespace @@ -173,25 +210,24 @@ class DownloadManagerTest : public testing::Test { static const size_t kTestDataLen; DownloadManagerTest() - : profile_(new TestingProfile()), - download_manager_delegate_(new TestDownloadManagerDelegate( - profile_.get())), + : browser_context(new TestBrowserContext()), + download_manager_delegate_(new TestDownloadManagerDelegate()), download_manager_(DownloadManager::Create( - download_manager_delegate_, &download_status_updater_)), + download_manager_delegate_.get(), &download_status_updater_)), ui_thread_(BrowserThread::UI, &message_loop_), file_thread_(BrowserThread::FILE, &message_loop_), download_buffer_(new content::DownloadBuffer) { - download_manager_->Init(profile_.get()); - download_manager_delegate_->SetDownloadManager(download_manager_); + download_manager_->Init(browser_context.get()); + download_manager_delegate_->set_download_manager(download_manager_); } ~DownloadManagerTest() { download_manager_->Shutdown(); - // profile_ must outlive download_manager_, so we explicitly delete + // browser_context must outlive download_manager_, so we explicitly delete // download_manager_ first. download_manager_ = NULL; - download_manager_delegate_ = NULL; - profile_.reset(NULL); + download_manager_delegate_.reset(); + browser_context.reset(NULL); message_loop_.RunAllPending(); } @@ -250,8 +286,8 @@ class DownloadManagerTest : public testing::Test { protected: DownloadStatusUpdater download_status_updater_; - scoped_ptr<TestingProfile> profile_; - scoped_refptr<TestDownloadManagerDelegate> download_manager_delegate_; + scoped_ptr<TestBrowserContext> browser_context; + scoped_ptr<TestDownloadManagerDelegate> download_manager_delegate_; scoped_refptr<DownloadManager> download_manager_; scoped_refptr<DownloadFileManager> file_manager_; MessageLoopForUI message_loop_; @@ -387,15 +423,15 @@ const struct { int expected_rename_count; } kDownloadRenameCases[] = { // Safe download, download finishes BEFORE file name determined. - // Renamed twice (linear path through UI). Crdownload file does not need + // Renamed twice (linear path through UI). temp file does not need // to be deleted. { FILE_PATH_LITERAL("foo.zip"), content::DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS, true, 2, }, // Potentially dangerous download (e.g., file is dangerous), download finishes // BEFORE file name determined. Needs to be renamed only once. - { FILE_PATH_LITERAL("Unconfirmed xxx.crdownload"), + { FILE_PATH_LITERAL("Unconfirmed xxx.temp"), content::DOWNLOAD_DANGER_TYPE_MAYBE_DANGEROUS_CONTENT, true, 1, }, - { FILE_PATH_LITERAL("Unconfirmed xxx.crdownload"), + { FILE_PATH_LITERAL("Unconfirmed xxx.temp"), content::DOWNLOAD_DANGER_TYPE_DANGEROUS_FILE, true, 1, }, // Safe download, download finishes AFTER file name determined. // Needs to be renamed twice. @@ -403,9 +439,9 @@ const struct { false, 2, }, // Potentially dangerous download, download finishes AFTER file name // determined. Needs to be renamed only once. - { FILE_PATH_LITERAL("Unconfirmed xxx.crdownload"), + { FILE_PATH_LITERAL("Unconfirmed xxx.temp"), content::DOWNLOAD_DANGER_TYPE_MAYBE_DANGEROUS_CONTENT, false, 1, }, - { FILE_PATH_LITERAL("Unconfirmed xxx.crdownload"), + { FILE_PATH_LITERAL("Unconfirmed xxx.temp"), content::DOWNLOAD_DANGER_TYPE_DANGEROUS_FILE, false, 1, }, }; @@ -483,16 +519,9 @@ class ItemObserver : public DownloadItem::Observer { TEST_F(DownloadManagerTest, MAYBE_StartDownload) { content::TestBrowserThread io_thread(BrowserThread::IO, &message_loop_); - PrefService* prefs = profile_->GetPrefs(); - prefs->SetFilePath(prefs::kDownloadDefaultDirectory, FilePath()); - DownloadPrefs* download_prefs = - DownloadPrefs::FromDownloadManager(download_manager_); - download_prefs->EnableAutoOpenBasedOnExtension( - FilePath(FILE_PATH_LITERAL("example.pdf"))); - for (size_t i = 0; i < ARRAYSIZE_UNSAFE(kStartDownloadCases); ++i) { - prefs->SetBoolean(prefs::kPromptForDownload, - kStartDownloadCases[i].prompt_for_download); + download_manager_delegate_->set_prompt_user_for_save_location( + kStartDownloadCases[i].prompt_for_download); SelectFileObserver observer(download_manager_); // Normally, the download system takes ownership of info, and is @@ -571,7 +600,7 @@ const struct DownloadFilenameTestCase { DONT_PROMPT, content::DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS, FILE_PATH_LITERAL(""), - FILE_PATH_LITERAL("$dl/foo.txt.crdownload"), + FILE_PATH_LITERAL("$dl/foo.txt.temp"), FILE_PATH_LITERAL("$dl/foo.txt"), DONT_VALIDATE }, @@ -582,7 +611,7 @@ const struct DownloadFilenameTestCase { PROMPT, content::DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS, FILE_PATH_LITERAL("$dl/foo.txt"), - FILE_PATH_LITERAL("$dl/foo.txt.crdownload"), + FILE_PATH_LITERAL("$dl/foo.txt.temp"), FILE_PATH_LITERAL("$dl/foo.txt"), DONT_VALIDATE }, @@ -594,7 +623,7 @@ const struct DownloadFilenameTestCase { PROMPT, content::DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS, FILE_PATH_LITERAL("$dl/foo.txt"), - FILE_PATH_LITERAL("$dl/bar.txt.crdownload"), + FILE_PATH_LITERAL("$dl/bar.txt.temp"), FILE_PATH_LITERAL("$dl/bar.txt"), DONT_VALIDATE }, @@ -606,7 +635,7 @@ const struct DownloadFilenameTestCase { PROMPT, content::DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS, FILE_PATH_LITERAL("$dl/foo.txt"), - FILE_PATH_LITERAL("$alt/bar.txt.crdownload"), + FILE_PATH_LITERAL("$alt/bar.txt.temp"), FILE_PATH_LITERAL("$alt/bar.txt"), DONT_VALIDATE }, @@ -699,7 +728,7 @@ const struct DownloadFilenameTestCase { DONT_PROMPT, content::DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS, FILE_PATH_LITERAL(""), - FILE_PATH_LITERAL("$dl/exists.txt.crdownload"), + FILE_PATH_LITERAL("$dl/exists.txt.temp"), FILE_PATH_LITERAL("$dl/exists.txt"), DONT_VALIDATE }, @@ -869,8 +898,8 @@ TEST_F(DownloadManagerTest, DownloadRenameTest) { .WillOnce(Return(net::OK)); } else { ASSERT_EQ(2, kDownloadRenameCases[i].expected_rename_count); - FilePath crdownload(download_util::GetCrDownloadPath(new_path)); - EXPECT_CALL(*download_file, Rename(crdownload)) + FilePath temp(GetTempDownloadPath(new_path)); + EXPECT_CALL(*download_file, Rename(temp)) .Times(1) .WillOnce(Return(net::OK)); EXPECT_CALL(*download_file, Rename(new_path)) @@ -917,7 +946,7 @@ TEST_F(DownloadManagerTest, DownloadInterruptTest) { info->url_chain.push_back(GURL()); info->total_bytes = static_cast<int64>(kTestDataLen); const FilePath new_path(FILE_PATH_LITERAL("foo.zip")); - const FilePath cr_path(download_util::GetCrDownloadPath(new_path)); + const FilePath cr_path(GetTempDownloadPath(new_path)); MockDownloadFile* download_file(new MockDownloadFile()); ON_CALL(*download_file, AppendDataToFile(_, _)) @@ -934,9 +963,6 @@ TEST_F(DownloadManagerTest, DownloadInterruptTest) { DownloadItem* download = GetActiveDownloadItem(0); ASSERT_TRUE(download != NULL); - scoped_ptr<DownloadItemModel> download_item_model( - new DownloadItemModel(download)); - EXPECT_EQ(DownloadItem::IN_PROGRESS, download->GetState()); scoped_ptr<ItemObserver> observer(new ItemObserver(download)); @@ -961,15 +987,6 @@ TEST_F(DownloadManagerTest, DownloadInterruptTest) { EXPECT_FALSE(observer->was_opened()); EXPECT_FALSE(download->GetFileExternallyRemoved()); EXPECT_EQ(DownloadItem::INTERRUPTED, download->GetState()); - ui::DataUnits amount_units = ui::GetByteDisplayUnits(kTestDataLen); - string16 simple_size = - ui::FormatBytesWithUnits(error_size, amount_units, false); - string16 simple_total = base::i18n::GetDisplayStringInLTRDirectionality( - ui::FormatBytesWithUnits(kTestDataLen, amount_units, true)); - EXPECT_EQ(download_item_model->GetStatusText(), - l10n_util::GetStringFUTF16(IDS_DOWNLOAD_STATUS_INTERRUPTED, - simple_size, - simple_total)); download->Cancel(true); @@ -1022,9 +1039,6 @@ TEST_F(DownloadManagerTest, MAYBE_DownloadFileErrorTest) { DownloadItem* download = GetActiveDownloadItem(0); ASSERT_TRUE(download != NULL); - // This will keep track of what should be displayed on the shelf. - scoped_ptr<DownloadItemModel> download_item_model( - new DownloadItemModel(download)); EXPECT_EQ(DownloadItem::IN_PROGRESS, download->GetState()); scoped_ptr<ItemObserver> observer(new ItemObserver(download)); @@ -1056,19 +1070,6 @@ TEST_F(DownloadManagerTest, MAYBE_DownloadFileErrorTest) { EXPECT_FALSE(download->GetFileExternallyRemoved()); EXPECT_EQ(DownloadItem::INTERRUPTED, download->GetState()); - // Check the download shelf's information. - size_t error_size = kTestDataLen * 3; - size_t total_size = kTestDataLen * 3; - ui::DataUnits amount_units = ui::GetByteDisplayUnits(kTestDataLen); - string16 simple_size = - ui::FormatBytesWithUnits(error_size, amount_units, false); - string16 simple_total = base::i18n::GetDisplayStringInLTRDirectionality( - ui::FormatBytesWithUnits(total_size, amount_units, true)); - EXPECT_EQ(l10n_util::GetStringFUTF16(IDS_DOWNLOAD_STATUS_INTERRUPTED, - simple_size, - simple_total), - download_item_model->GetStatusText()); - // Clean up. download->Cancel(true); message_loop_.RunAllPending(); @@ -1089,7 +1090,7 @@ TEST_F(DownloadManagerTest, DownloadCancelTest) { info->prompt_user_for_save_location = false; info->url_chain.push_back(GURL()); const FilePath new_path(FILE_PATH_LITERAL("foo.zip")); - const FilePath cr_path(download_util::GetCrDownloadPath(new_path)); + const FilePath cr_path(GetTempDownloadPath(new_path)); MockDownloadFile* download_file(new MockDownloadFile()); ON_CALL(*download_file, AppendDataToFile(_, _)) @@ -1105,8 +1106,6 @@ TEST_F(DownloadManagerTest, DownloadCancelTest) { DownloadItem* download = GetActiveDownloadItem(0); ASSERT_TRUE(download != NULL); - scoped_ptr<DownloadItemModel> download_item_model( - new DownloadItemModel(download)); EXPECT_EQ(DownloadItem::IN_PROGRESS, download->GetState()); scoped_ptr<ItemObserver> observer(new ItemObserver(download)); @@ -1130,8 +1129,6 @@ TEST_F(DownloadManagerTest, DownloadCancelTest) { EXPECT_FALSE(observer->was_opened()); EXPECT_FALSE(download->GetFileExternallyRemoved()); EXPECT_EQ(DownloadItem::CANCELLED, download->GetState()); - EXPECT_EQ(download_item_model->GetStatusText(), - l10n_util::GetStringUTF16(IDS_DOWNLOAD_STATUS_CANCELED)); file_manager()->CancelDownload(id); @@ -1151,7 +1148,7 @@ TEST_F(DownloadManagerTest, MAYBE_DownloadOverwriteTest) { // File names we're using. const FilePath new_path(temp_dir_.path().AppendASCII("foo.txt")); - const FilePath cr_path(download_util::GetCrDownloadPath(new_path)); + const FilePath cr_path(GetTempDownloadPath(new_path)); EXPECT_FALSE(file_util::PathExists(new_path)); // Create the file that we will overwrite. Will be automatically cleaned @@ -1179,8 +1176,6 @@ TEST_F(DownloadManagerTest, MAYBE_DownloadOverwriteTest) { DownloadItem* download = GetActiveDownloadItem(0); ASSERT_TRUE(download != NULL); - scoped_ptr<DownloadItemModel> download_item_model( - new DownloadItemModel(download)); EXPECT_EQ(DownloadItem::IN_PROGRESS, download->GetState()); scoped_ptr<ItemObserver> observer(new ItemObserver(download)); @@ -1193,7 +1188,7 @@ TEST_F(DownloadManagerTest, MAYBE_DownloadOverwriteTest) { new DownloadFileImpl(info.get(), new DownloadRequestHandle(), download_manager_, false)); download_file->Rename(cr_path); - // This creates the .crdownload version of the file. + // This creates the .temp version of the file. download_file->Initialize(); // |download_file| is owned by DownloadFileManager. AddDownloadToFileManager(info->download_id.local(), download_file); @@ -1219,7 +1214,6 @@ TEST_F(DownloadManagerTest, MAYBE_DownloadOverwriteTest) { EXPECT_FALSE(observer->was_opened()); EXPECT_FALSE(download->GetFileExternallyRemoved()); EXPECT_EQ(DownloadItem::COMPLETE, download->GetState()); - EXPECT_EQ(download_item_model->GetStatusText(), string16()); EXPECT_TRUE(file_util::PathExists(new_path)); EXPECT_FALSE(file_util::PathExists(cr_path)); @@ -1241,7 +1235,7 @@ TEST_F(DownloadManagerTest, MAYBE_DownloadRemoveTest) { // File names we're using. const FilePath new_path(temp_dir_.path().AppendASCII("foo.txt")); - const FilePath cr_path(download_util::GetCrDownloadPath(new_path)); + const FilePath cr_path(GetTempDownloadPath(new_path)); EXPECT_FALSE(file_util::PathExists(new_path)); // Normally, the download system takes ownership of info, and is @@ -1256,8 +1250,6 @@ TEST_F(DownloadManagerTest, MAYBE_DownloadRemoveTest) { DownloadItem* download = GetActiveDownloadItem(0); ASSERT_TRUE(download != NULL); - scoped_ptr<DownloadItemModel> download_item_model( - new DownloadItemModel(download)); EXPECT_EQ(DownloadItem::IN_PROGRESS, download->GetState()); scoped_ptr<ItemObserver> observer(new ItemObserver(download)); @@ -1270,7 +1262,7 @@ TEST_F(DownloadManagerTest, MAYBE_DownloadRemoveTest) { new DownloadFileImpl(info.get(), new DownloadRequestHandle(), download_manager_, false)); download_file->Rename(cr_path); - // This creates the .crdownload version of the file. + // This creates the .temp version of the file. download_file->Initialize(); // |download_file| is owned by DownloadFileManager. AddDownloadToFileManager(info->download_id.local(), download_file); @@ -1296,7 +1288,6 @@ TEST_F(DownloadManagerTest, MAYBE_DownloadRemoveTest) { EXPECT_FALSE(observer->was_opened()); EXPECT_FALSE(download->GetFileExternallyRemoved()); EXPECT_EQ(DownloadItem::COMPLETE, download->GetState()); - EXPECT_EQ(download_item_model->GetStatusText(), string16()); EXPECT_TRUE(file_util::PathExists(new_path)); EXPECT_FALSE(file_util::PathExists(cr_path)); @@ -1316,8 +1307,6 @@ TEST_F(DownloadManagerTest, MAYBE_DownloadRemoveTest) { EXPECT_FALSE(observer->was_opened()); EXPECT_TRUE(download->GetFileExternallyRemoved()); EXPECT_EQ(DownloadItem::COMPLETE, download->GetState()); - EXPECT_EQ(download_item_model->GetStatusText(), - l10n_util::GetStringUTF16(IDS_DOWNLOAD_STATUS_REMOVED)); EXPECT_FALSE(file_util::PathExists(new_path)); } diff --git a/content/browser/download/mock_download_manager_delegate.cc b/content/browser/download/mock_download_manager_delegate.cc deleted file mode 100644 index 481f1ae..0000000 --- a/content/browser/download/mock_download_manager_delegate.cc +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "content/browser/download/mock_download_manager_delegate.h" - -MockDownloadManagerDelegate::MockDownloadManagerDelegate() { -} - -MockDownloadManagerDelegate::~MockDownloadManagerDelegate() { -} diff --git a/content/browser/download/mock_download_manager_delegate.h b/content/browser/download/mock_download_manager_delegate.h deleted file mode 100644 index ff48765..0000000 --- a/content/browser/download/mock_download_manager_delegate.h +++ /dev/null @@ -1,65 +0,0 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef CONTENT_BROWSER_DOWNLOAD_MOCK_DOWNLOAD_MANAGER_DELEGATE_H_ -#define CONTENT_BROWSER_DOWNLOAD_MOCK_DOWNLOAD_MANAGER_DELEGATE_H_ -#pragma once - -#include "base/compiler_specific.h" -#include "base/file_path.h" -#include "content/browser/download/download_types.h" -#include "content/public/browser/download_id.h" -#include "content/public/browser/download_manager_delegate.h" -#include "testing/gmock/include/gmock/gmock.h" -#include "testing/gtest/include/gtest/gtest.h" - -namespace content { -class DownloadManager; -} - -class MockDownloadManagerDelegate : public content::DownloadManagerDelegate { - public: - MockDownloadManagerDelegate(); - virtual ~MockDownloadManagerDelegate(); - - // DownloadManagerDelegate functions: - MOCK_METHOD1(SetDownloadManager, void(content::DownloadManager* dm)); - MOCK_METHOD0(Shutdown, void()); - MOCK_METHOD0(GetNextId, content::DownloadId()); - MOCK_METHOD1(ShouldStartDownload, bool(int32 download_id)); - MOCK_METHOD3(ChooseDownloadPath, void(content::WebContents* web_contents, - const FilePath& suggested_path, - void* data)); - MOCK_METHOD2(OverrideIntermediatePath, bool(content::DownloadItem* item, - FilePath* intermediate_path)); - MOCK_METHOD0(GetAlternativeWebContentsToNotifyForDownload, - content::WebContents*()); - MOCK_METHOD1(ShouldOpenFileBasedOnExtension, bool(const FilePath& path)); - MOCK_METHOD1(ShouldCompleteDownload, bool(content::DownloadItem* item)); - MOCK_METHOD1(ShouldOpenDownload, bool(content::DownloadItem* item)); - MOCK_METHOD0(GenerateFileHash, bool()); - MOCK_METHOD1(OnResponseCompleted, void(content::DownloadItem* item)); - MOCK_METHOD1(AddItemToPersistentStore, void(content::DownloadItem* item)); - MOCK_METHOD1(UpdateItemInPersistentStore, void(content::DownloadItem* item)); - MOCK_METHOD2(UpdatePathForItemInPersistentStore, void( - content::DownloadItem* item, - const FilePath& new_path)); - MOCK_METHOD1(RemoveItemFromPersistentStore, - void(content::DownloadItem* item)); - MOCK_METHOD2(RemoveItemsFromPersistentStoreBetween, void( - base::Time remove_begin, - base::Time remove_end)); - MOCK_METHOD3(GetSaveDir, void(content::WebContents* web_contents, - FilePath* website_save_dir, - FilePath* download_save_dir)); - MOCK_METHOD5(ChooseSavePath, void( - content::WebContents* web_contents, - const FilePath& suggested_path, - const FilePath::StringType& default_extension, - bool can_save_as_complete, - content::SaveFilePathPickedCallback callback)); - MOCK_METHOD0(DownloadProgressUpdated, void()); -}; - -#endif // CONTENT_BROWSER_DOWNLOAD_MOCK_DOWNLOAD_MANAGER_DELEGATE_H_ diff --git a/content/content_browser.gypi b/content/content_browser.gypi index 623c7e9..c2d9bcf 100644 --- a/content/content_browser.gypi +++ b/content/content_browser.gypi @@ -55,6 +55,7 @@ 'public/browser/download_manager.h', 'public/browser/download_query.cc', 'public/browser/download_query.h', + 'public/browser/download_manager_delegate.cc', 'public/browser/download_manager_delegate.h', 'public/browser/favicon_status.cc', 'public/browser/favicon_status.h', diff --git a/content/content_tests.gypi b/content/content_tests.gypi index f75d1a4..e525382 100644 --- a/content/content_tests.gypi +++ b/content/content_tests.gypi @@ -38,8 +38,6 @@ 'browser/download/mock_download_manager.h', 'browser/download/mock_download_item.cc', 'browser/download/mock_download_item.h', - 'browser/download/mock_download_manager_delegate.cc', - 'browser/download/mock_download_manager_delegate.h', 'browser/geolocation/arbitrator_dependency_factories_for_test.cc', 'browser/geolocation/arbitrator_dependency_factories_for_test.h', 'browser/geolocation/fake_access_token_store.cc', @@ -203,6 +201,8 @@ 'browser/download/download_file_manager_unittest.cc', 'browser/download/download_file_unittest.cc', 'browser/download/download_id_unittest.cc', + 'browser/download/download_item_impl_unittest.cc', + 'browser/download/download_manager_impl_unittest.cc', 'browser/download/download_query_unittest.cc', 'browser/download/download_status_updater_unittest.cc', 'browser/download/save_package_unittest.cc', diff --git a/content/public/browser/download_manager_delegate.cc b/content/public/browser/download_manager_delegate.cc new file mode 100644 index 0000000..6abc0ad --- /dev/null +++ b/content/public/browser/download_manager_delegate.cc @@ -0,0 +1,46 @@ +// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "content/public/browser/download_manager_delegate.h" + +#include "content/public/browser/download_id.h" + +namespace content { + +DownloadId DownloadManagerDelegate::GetNextId() { + return DownloadId::Invalid(); +} + +bool DownloadManagerDelegate::ShouldStartDownload(int32 download_id) { + return true; +} + +FilePath DownloadManagerDelegate::GetIntermediatePath( + const FilePath& suggested_path) { + return suggested_path; +} + +WebContents* DownloadManagerDelegate:: + GetAlternativeWebContentsToNotifyForDownload() { + return NULL; +} + +bool DownloadManagerDelegate::ShouldOpenFileBasedOnExtension( + const FilePath& path) { + return false; +} + +bool DownloadManagerDelegate::ShouldCompleteDownload(DownloadItem* item) { + return true; +} + +bool DownloadManagerDelegate::ShouldOpenDownload(DownloadItem* item) { + return true; +} + +bool DownloadManagerDelegate::GenerateFileHash() { + return false; +} + +} // namespace content diff --git a/content/public/browser/download_manager_delegate.h b/content/public/browser/download_manager_delegate.h index 4776ef0..bf02083a 100644 --- a/content/public/browser/download_manager_delegate.h +++ b/content/public/browser/download_manager_delegate.h @@ -10,6 +10,7 @@ #include "base/callback.h" #include "base/file_path.h" #include "base/time.h" +#include "content/common/content_export.h" #include "content/public/browser/save_page_type.h" namespace content { @@ -22,41 +23,39 @@ typedef base::Callback<void(const FilePath&, content::SavePageType)> SaveFilePathPickedCallback; // Browser's download manager: manages all downloads and destination view. -class DownloadManagerDelegate { +class CONTENT_EXPORT DownloadManagerDelegate { public: virtual ~DownloadManagerDelegate() {} // Lets the delegate know that the download manager is shutting down. - virtual void Shutdown() = 0; + virtual void Shutdown() {} // Returns a new DownloadId. - virtual DownloadId GetNextId() = 0; + virtual DownloadId GetNextId(); // Notifies the delegate that a download is starting. The delegate can return // false to delay the start of the download, in which case it should call // DownloadManager::RestartDownload when it's ready. - virtual bool ShouldStartDownload(int32 download_id) = 0; + virtual bool ShouldStartDownload(int32 download_id); // Asks the user for the path for a download. The delegate calls // DownloadManager::FileSelected or DownloadManager::FileSelectionCanceled to // give the answer. virtual void ChooseDownloadPath(WebContents* web_contents, const FilePath& suggested_path, - void* data) = 0; + void* data) {} - // Allows the embedder to override the file path for the download while it's - // progress. Return false to leave the filename as item->full_path(), or - // return true and set |intermediate_path| with the intermediate path. - virtual bool OverrideIntermediatePath(DownloadItem* item, - FilePath* intermediate_path) = 0; + // Allows the embedder to set an intermediate name for the download until it's + // complete. If the embedder doesn't want this return the suggested path. + virtual FilePath GetIntermediatePath(const FilePath& suggested_path); // Called when the download system wants to alert a WebContents that a // download has started, but the TabConetnts has gone away. This lets an // delegate return an alternative WebContents. The delegate can return NULL. - virtual WebContents* GetAlternativeWebContentsToNotifyForDownload() = 0; + virtual WebContents* GetAlternativeWebContentsToNotifyForDownload(); // Tests if a file type should be opened automatically. - virtual bool ShouldOpenFileBasedOnExtension(const FilePath& path) = 0; + virtual bool ShouldOpenFileBasedOnExtension(const FilePath& path); // Allows the delegate to override completion of the download. If this // function returns false, the download completion is delayed and the @@ -65,52 +64,49 @@ class DownloadManagerDelegate { // future. Note that at that point this function will be called again, // and is responsible for returning true when it really is ok for the // download to complete. - virtual bool ShouldCompleteDownload(DownloadItem* item) = 0; + virtual bool ShouldCompleteDownload(DownloadItem* item); // Allows the delegate to override opening the download. If this function // returns false, the delegate needs to call // DownloadItem::DelayedDownloadOpened when it's done with the item, // and is responsible for opening it. This function is called // after the final rename, but before the download state is set to COMPLETED. - virtual bool ShouldOpenDownload(DownloadItem* item) = 0; + virtual bool ShouldOpenDownload(DownloadItem* item); // Returns true if we need to generate a binary hash for downloads. - virtual bool GenerateFileHash() = 0; - - // Informs the delegate that given download has finishd downloading. - virtual void OnResponseCompleted(DownloadItem* item) = 0; + virtual bool GenerateFileHash(); // Notifies the delegate that a new download item is created. The // DownloadManager waits for the delegate to add information about this // download to its persistent store. When the delegate is done, it calls // DownloadManager::OnDownloadItemAddedToPersistentStore. - virtual void AddItemToPersistentStore(DownloadItem* item) = 0; + virtual void AddItemToPersistentStore(DownloadItem* item) {} // Notifies the delegate that information about the given download has change, // so that it can update its persistent store. // Does not update |url|, |start_time|, |total_bytes|; uses |db_handle| only // to select the row in the database table to update. - virtual void UpdateItemInPersistentStore(DownloadItem* item) = 0; + virtual void UpdateItemInPersistentStore(DownloadItem* item) {} // Notifies the delegate that path for the download item has changed, so that // it can update its persistent store. virtual void UpdatePathForItemInPersistentStore( DownloadItem* item, - const FilePath& new_path) = 0; + const FilePath& new_path) {} // Notifies the delegate that it should remove the download item from its // persistent store. - virtual void RemoveItemFromPersistentStore(DownloadItem* item) = 0; + virtual void RemoveItemFromPersistentStore(DownloadItem* item) {} // Notifies the delegate to remove downloads from the given time range. virtual void RemoveItemsFromPersistentStoreBetween( base::Time remove_begin, - base::Time remove_end) = 0; + base::Time remove_end) {} // Retrieve the directories to save html pages and downloads to. virtual void GetSaveDir(WebContents* web_contents, FilePath* website_save_dir, - FilePath* download_save_dir) = 0; + FilePath* download_save_dir) {} // Asks the user for the path to save a page. The delegate calls the callback // to give the answer. @@ -118,15 +114,10 @@ class DownloadManagerDelegate { const FilePath& suggested_path, const FilePath::StringType& default_extension, bool can_save_as_complete, - SaveFilePathPickedCallback callback) = 0; + SaveFilePathPickedCallback callback) {} // Informs the delegate that the progress of downloads has changed. - virtual void DownloadProgressUpdated() = 0; - - protected: - DownloadManagerDelegate() {} - - DISALLOW_COPY_AND_ASSIGN(DownloadManagerDelegate); + virtual void DownloadProgressUpdated() {} }; } // namespace content diff --git a/content/shell/shell_download_manager_delegate.cc b/content/shell/shell_download_manager_delegate.cc index 7856a66..9d386b3 100644 --- a/content/shell/shell_download_manager_delegate.cc +++ b/content/shell/shell_download_manager_delegate.cc @@ -36,9 +36,6 @@ void ShellDownloadManagerDelegate::SetDownloadManager( download_manager_ = download_manager; } -void ShellDownloadManagerDelegate::Shutdown() { -} - DownloadId ShellDownloadManagerDelegate::GetNextId() { static int next_id; return DownloadId(this, ++next_id); @@ -141,74 +138,4 @@ void ShellDownloadManagerDelegate::ChooseDownloadPath( } } -bool ShellDownloadManagerDelegate::OverrideIntermediatePath( - DownloadItem* item, - FilePath* intermediate_path) { - return false; -} - -WebContents* ShellDownloadManagerDelegate:: - GetAlternativeWebContentsToNotifyForDownload() { - return NULL; -} - -bool ShellDownloadManagerDelegate::ShouldOpenFileBasedOnExtension( - const FilePath& path) { - return false; -} - -bool ShellDownloadManagerDelegate::ShouldCompleteDownload(DownloadItem* item) { - return true; -} - -bool ShellDownloadManagerDelegate::ShouldOpenDownload(DownloadItem* item) { - return true; -} - -bool ShellDownloadManagerDelegate::GenerateFileHash() { - return false; -} - -void ShellDownloadManagerDelegate::OnResponseCompleted(DownloadItem* item) { -} - -void ShellDownloadManagerDelegate::AddItemToPersistentStore( - DownloadItem* item) { -} - -void ShellDownloadManagerDelegate::UpdateItemInPersistentStore( - DownloadItem* item) { -} - -void ShellDownloadManagerDelegate::UpdatePathForItemInPersistentStore( - DownloadItem* item, - const FilePath& new_path) { -} - -void ShellDownloadManagerDelegate::RemoveItemFromPersistentStore( - DownloadItem* item) { -} - -void ShellDownloadManagerDelegate::RemoveItemsFromPersistentStoreBetween( - base::Time remove_begin, - base::Time remove_end) { -} - -void ShellDownloadManagerDelegate::GetSaveDir( - WebContents* web_contents, - FilePath* website_save_dir, - FilePath* download_save_dir) { -} - -void ShellDownloadManagerDelegate::ChooseSavePath( - WebContents* web_contents, - const FilePath& suggested_path, - const FilePath::StringType& default_extension, - bool can_save_as_complete, - SaveFilePathPickedCallback callback) { -} - -void ShellDownloadManagerDelegate::DownloadProgressUpdated() { -} - } // namespace content diff --git a/content/shell/shell_download_manager_delegate.h b/content/shell/shell_download_manager_delegate.h index 9cb5e97..56afdf6 100644 --- a/content/shell/shell_download_manager_delegate.h +++ b/content/shell/shell_download_manager_delegate.h @@ -24,39 +24,11 @@ class ShellDownloadManagerDelegate void SetDownloadManager(DownloadManager* manager); - virtual void Shutdown() OVERRIDE; virtual DownloadId GetNextId() OVERRIDE; virtual bool ShouldStartDownload(int32 download_id) OVERRIDE; virtual void ChooseDownloadPath(WebContents* web_contents, const FilePath& suggested_path, void* data) OVERRIDE; - virtual bool OverrideIntermediatePath(DownloadItem* item, - FilePath* intermediate_path) OVERRIDE; - virtual WebContents* GetAlternativeWebContentsToNotifyForDownload() OVERRIDE; - virtual bool ShouldOpenFileBasedOnExtension(const FilePath& path) OVERRIDE; - virtual bool ShouldCompleteDownload(DownloadItem* item) OVERRIDE; - virtual bool ShouldOpenDownload(DownloadItem* item) OVERRIDE; - virtual bool GenerateFileHash() OVERRIDE; - virtual void OnResponseCompleted(DownloadItem* item) OVERRIDE; - virtual void AddItemToPersistentStore(DownloadItem* item) OVERRIDE; - virtual void UpdateItemInPersistentStore(DownloadItem* item) OVERRIDE; - virtual void UpdatePathForItemInPersistentStore( - DownloadItem* item, - const FilePath& new_path) OVERRIDE; - virtual void RemoveItemFromPersistentStore(DownloadItem* item) OVERRIDE; - virtual void RemoveItemsFromPersistentStoreBetween( - base::Time remove_begin, - base::Time remove_end) OVERRIDE; - virtual void GetSaveDir(WebContents* web_contents, - FilePath* website_save_dir, - FilePath* download_save_dir) OVERRIDE; - virtual void ChooseSavePath( - content::WebContents* web_contents, - const FilePath& suggested_path, - const FilePath::StringType& default_extension, - bool can_save_as_complete, - content::SaveFilePathPickedCallback callback) OVERRIDE; - virtual void DownloadProgressUpdated() OVERRIDE; private: friend class base::RefCountedThreadSafe<ShellDownloadManagerDelegate>; |