mirror of
https://github.com/aphrody-labs/cef.git
synced 2026-10-13 21:07:07 +00:00
- Windows SDK 10.0.28000.2270 is now required - CefRegisterExtension is deprecated due to https://crbug.com/40347662
110 lines
4.3 KiB
Diff
110 lines
4.3 KiB
Diff
diff --git chrome/browser/download/chrome_download_manager_delegate.cc chrome/browser/download/chrome_download_manager_delegate.cc
|
|
index d0b653e5eaaf2f62f67039c9fd72e8297a1710c0..f5a090d9d558a34a25241b5da31c6885fde19794 100644
|
|
--- chrome/browser/download/chrome_download_manager_delegate.cc
|
|
+++ chrome/browser/download/chrome_download_manager_delegate.cc
|
|
@@ -31,6 +31,7 @@
|
|
#include "base/task/thread_pool.h"
|
|
#include "base/time/time.h"
|
|
#include "build/build_config.h"
|
|
+#include "cef/libcef/features/features.h"
|
|
#include "chrome/browser/browser_process.h"
|
|
#include "chrome/browser/download/download_core_service.h"
|
|
#include "chrome/browser/download/download_core_service_factory.h"
|
|
@@ -182,6 +183,10 @@
|
|
#endif // BUILDFLAG(ENTERPRISE_CLOUD_CONTENT_ANALYSIS)
|
|
#endif // BUILDFLAG(SAFE_BROWSING_DOWNLOAD_PROTECTION)
|
|
|
|
+#if BUILDFLAG(ENABLE_CEF)
|
|
+#include "cef/libcef/browser/download_manager_delegate.h"
|
|
+#endif
|
|
+
|
|
using content::BrowserThread;
|
|
using content::DownloadManager;
|
|
using download::DownloadItem;
|
|
@@ -687,6 +692,10 @@ ChromeDownloadManagerDelegate::ChromeDownloadManagerDelegate(Profile* profile)
|
|
download_message_bridge_(std::make_unique<DownloadMessageBridge>()),
|
|
#endif
|
|
download_prefs_(std::make_unique<DownloadPrefs>(profile)) {
|
|
+#if BUILDFLAG(ENABLE_CEF)
|
|
+ cef_delegate_ =
|
|
+ cef::DownloadManagerDelegate::Create(profile_->GetDownloadManager());
|
|
+#endif
|
|
}
|
|
|
|
ChromeDownloadManagerDelegate::~ChromeDownloadManagerDelegate() {
|
|
@@ -755,6 +764,9 @@ void ChromeDownloadManagerDelegate::Shutdown() {
|
|
download_manager_->RemoveObserver(this);
|
|
download_manager_ = nullptr;
|
|
}
|
|
+#if BUILDFLAG(ENABLE_CEF)
|
|
+ cef_delegate_.reset();
|
|
+#endif
|
|
}
|
|
|
|
void ChromeDownloadManagerDelegate::OnDownloadCanceledAtShutdown(
|
|
@@ -835,6 +847,12 @@ bool ChromeDownloadManagerDelegate::DetermineDownloadTarget(
|
|
ReportPDFLoadStatus(PDFLoadStatus::kTriggeredNoGestureDriveByDownload);
|
|
}
|
|
|
|
+#if BUILDFLAG(ENABLE_CEF)
|
|
+ if (cef_delegate_->DetermineDownloadTarget(download, callback)) {
|
|
+ return true;
|
|
+ }
|
|
+#endif
|
|
+
|
|
DownloadTargetDeterminer::CompletionCallback target_determined_callback =
|
|
base::BindOnce(&ChromeDownloadManagerDelegate::OnDownloadTargetDetermined,
|
|
weak_ptr_factory_.GetWeakPtr(), download->GetId(),
|
|
@@ -1399,9 +1417,12 @@ void ChromeDownloadManagerDelegate::OpenDownload(DownloadItem* download) {
|
|
|
|
BrowserWindowInterface* browser =
|
|
chrome::ScopedTabbedBrowserDisplayer(profile_).browser_window_interface();
|
|
- CHECK(browser &&
|
|
- WindowFeatureController::From(browser)->CanSupportWindowFeature(
|
|
- WindowFeatureController::WindowFeature::kFeatureTabStrip));
|
|
+ CHECK(browser
|
|
+#if !BUILDFLAG(ENABLE_CEF)
|
|
+ && WindowFeatureController::From(browser)->CanSupportWindowFeature(
|
|
+ WindowFeatureController::WindowFeature::kFeatureTabStrip)
|
|
+#endif
|
|
+ );
|
|
content::OpenURLParams params(
|
|
net::FilePathToFileURL(download->GetTargetFilePath()),
|
|
content::Referrer(), WindowOpenDisposition::NEW_FOREGROUND_TAB,
|
|
diff --git chrome/browser/download/chrome_download_manager_delegate.h chrome/browser/download/chrome_download_manager_delegate.h
|
|
index e3cbfecee6776d76b97fa1acb1a66b5bedddb333..68c47ab3d5608fdbf546534191e91e37e5531b4b 100644
|
|
--- chrome/browser/download/chrome_download_manager_delegate.h
|
|
+++ chrome/browser/download/chrome_download_manager_delegate.h
|
|
@@ -20,6 +20,7 @@
|
|
#include "base/task/sequenced_task_runner.h"
|
|
#include "base/unguessable_token.h"
|
|
#include "build/build_config.h"
|
|
+#include "cef/libcef/features/features.h"
|
|
#include "chrome/browser/download/download_completion_blocker.h"
|
|
#include "chrome/browser/download/download_target_determiner_delegate.h"
|
|
#include "components/download/public/common/download_danger_type.h"
|
|
@@ -75,6 +76,12 @@ enum class DownloadCheckResult;
|
|
}
|
|
#endif
|
|
|
|
+#if BUILDFLAG(ENABLE_CEF)
|
|
+namespace cef {
|
|
+class DownloadManagerDelegate;
|
|
+}
|
|
+#endif
|
|
+
|
|
// This is the Chrome side helper for the download system.
|
|
class ChromeDownloadManagerDelegate
|
|
: public content::DownloadManagerDelegate,
|
|
@@ -450,6 +457,10 @@ class ChromeDownloadManagerDelegate
|
|
// Whether a file picker dialog is showing.
|
|
bool is_file_picker_showing_ = false;
|
|
|
|
+#if BUILDFLAG(ENABLE_CEF)
|
|
+ std::unique_ptr<cef::DownloadManagerDelegate> cef_delegate_;
|
|
+#endif
|
|
+
|
|
base::WeakPtrFactory<ChromeDownloadManagerDelegate> weak_ptr_factory_{this};
|
|
};
|
|
|