No need for default_download_path_ member.

This commit is contained in:
Haojian Wu 2015-07-29 14:03:07 +08:00
Родитель 59c3efd44b
Коммит 877830e4a1
3 изменённых файлов: 5 добавлений и 6 удалений

Просмотреть файл

@ -32,7 +32,7 @@ class AtomBrowserContext : public brightray::BrowserContext {
content::DownloadManagerDelegate* GetDownloadManagerDelegate() override;
content::BrowserPluginGuestManager* GetGuestManager() override;
// brightray::BrowserContext::
// brightray::BrowserContext:
void RegisterPrefs(PrefRegistrySimple* pref_registry) override;
AtomURLRequestJobFactory* job_factory() const { return job_factory_; }

Просмотреть файл

@ -102,12 +102,12 @@ bool AtomDownloadManagerDelegate::DetermineDownloadTarget(
AtomBrowserContext* browser_context = static_cast<AtomBrowserContext*>(
download_manager_->GetBrowserContext());
default_download_path_ = browser_context->prefs()->GetFilePath(
base::FilePath default_download_path = browser_context->prefs()->GetFilePath(
prefs::kDownloadDefaultDirectory);
// If users didn't set download path, use 'Downloads' directory by default.
if (default_download_path_.empty()) {
if (default_download_path.empty()) {
auto path = download_manager_->GetBrowserContext()->GetPath();
default_download_path_ = path.Append(FILE_PATH_LITERAL("Downloads"));
default_download_path = path.Append(FILE_PATH_LITERAL("Downloads"));
}
if (!download->GetForcedFilePath().empty()) {
@ -131,7 +131,7 @@ bool AtomDownloadManagerDelegate::DetermineDownloadTarget(
download->GetContentDisposition(),
download->GetSuggestedFilename(),
download->GetMimeType(),
default_download_path_,
default_download_path,
download_path_callback));
return true;
}

Просмотреть файл

@ -47,7 +47,6 @@ class AtomDownloadManagerDelegate : public content::DownloadManagerDelegate {
private:
content::DownloadManager* download_manager_;
base::FilePath default_download_path_;
base::WeakPtrFactory<AtomDownloadManagerDelegate> weak_ptr_factory_;
DISALLOW_COPY_AND_ASSIGN(AtomDownloadManagerDelegate);