зеркало из https://github.com/electron/electron.git
No need for default_download_path_ member.
This commit is contained in:
Родитель
59c3efd44b
Коммит
877830e4a1
|
@ -32,7 +32,7 @@ class AtomBrowserContext : public brightray::BrowserContext {
|
||||||
content::DownloadManagerDelegate* GetDownloadManagerDelegate() override;
|
content::DownloadManagerDelegate* GetDownloadManagerDelegate() override;
|
||||||
content::BrowserPluginGuestManager* GetGuestManager() override;
|
content::BrowserPluginGuestManager* GetGuestManager() override;
|
||||||
|
|
||||||
// brightray::BrowserContext::
|
// brightray::BrowserContext:
|
||||||
void RegisterPrefs(PrefRegistrySimple* pref_registry) override;
|
void RegisterPrefs(PrefRegistrySimple* pref_registry) override;
|
||||||
|
|
||||||
AtomURLRequestJobFactory* job_factory() const { return job_factory_; }
|
AtomURLRequestJobFactory* job_factory() const { return job_factory_; }
|
||||||
|
|
|
@ -102,12 +102,12 @@ bool AtomDownloadManagerDelegate::DetermineDownloadTarget(
|
||||||
|
|
||||||
AtomBrowserContext* browser_context = static_cast<AtomBrowserContext*>(
|
AtomBrowserContext* browser_context = static_cast<AtomBrowserContext*>(
|
||||||
download_manager_->GetBrowserContext());
|
download_manager_->GetBrowserContext());
|
||||||
default_download_path_ = browser_context->prefs()->GetFilePath(
|
base::FilePath default_download_path = browser_context->prefs()->GetFilePath(
|
||||||
prefs::kDownloadDefaultDirectory);
|
prefs::kDownloadDefaultDirectory);
|
||||||
// If users didn't set download path, use 'Downloads' directory by default.
|
// 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();
|
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()) {
|
if (!download->GetForcedFilePath().empty()) {
|
||||||
|
@ -131,7 +131,7 @@ bool AtomDownloadManagerDelegate::DetermineDownloadTarget(
|
||||||
download->GetContentDisposition(),
|
download->GetContentDisposition(),
|
||||||
download->GetSuggestedFilename(),
|
download->GetSuggestedFilename(),
|
||||||
download->GetMimeType(),
|
download->GetMimeType(),
|
||||||
default_download_path_,
|
default_download_path,
|
||||||
download_path_callback));
|
download_path_callback));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -47,7 +47,6 @@ class AtomDownloadManagerDelegate : public content::DownloadManagerDelegate {
|
||||||
|
|
||||||
private:
|
private:
|
||||||
content::DownloadManager* download_manager_;
|
content::DownloadManager* download_manager_;
|
||||||
base::FilePath default_download_path_;
|
|
||||||
base::WeakPtrFactory<AtomDownloadManagerDelegate> weak_ptr_factory_;
|
base::WeakPtrFactory<AtomDownloadManagerDelegate> weak_ptr_factory_;
|
||||||
|
|
||||||
DISALLOW_COPY_AND_ASSIGN(AtomDownloadManagerDelegate);
|
DISALLOW_COPY_AND_ASSIGN(AtomDownloadManagerDelegate);
|
||||||
|
|
Загрузка…
Ссылка в новой задаче