2024-04-26 21:21:33 +02:00
|
|
|
diff --git chrome/browser/download/chrome_download_manager_delegate.cc chrome/browser/download/chrome_download_manager_delegate.cc
|
2024-10-24 17:05:31 +02:00
|
|
|
index 6b356ae53968e..da22286db5a3f 100644
|
2024-04-26 21:21:33 +02:00
|
|
|
--- chrome/browser/download/chrome_download_manager_delegate.cc
|
|
|
|
+++ chrome/browser/download/chrome_download_manager_delegate.cc
|
2024-08-08 22:34:44 +02:00
|
|
|
@@ -31,6 +31,7 @@
|
|
|
|
#include "base/time/time.h"
|
|
|
|
#include "build/build_config.h"
|
|
|
|
#include "build/chromeos_buildflags.h"
|
|
|
|
+#include "cef/libcef/features/features.h"
|
|
|
|
#include "chrome/browser/browser_process.h"
|
|
|
|
#include "chrome/browser/download/bubble/download_bubble_prefs.h"
|
|
|
|
#include "chrome/browser/download/download_core_service.h"
|
2024-10-24 17:05:31 +02:00
|
|
|
@@ -159,6 +160,10 @@
|
2024-07-29 19:09:20 +02:00
|
|
|
#include "chrome/browser/ash/policy/skyvault/skyvault_rename_handler.h"
|
2024-04-26 21:21:33 +02:00
|
|
|
#endif
|
|
|
|
|
|
|
|
+#if BUILDFLAG(ENABLE_CEF)
|
|
|
|
+#include "cef/libcef/browser/download_manager_delegate.h"
|
|
|
|
+#endif
|
|
|
|
+
|
|
|
|
using content::BrowserThread;
|
|
|
|
using content::DownloadManager;
|
|
|
|
using download::DownloadItem;
|
2024-10-24 17:05:31 +02:00
|
|
|
@@ -520,6 +525,11 @@ ChromeDownloadManagerDelegate::ChromeDownloadManagerDelegate(Profile* profile)
|
2024-04-26 21:21:33 +02:00
|
|
|
download_dialog_bridge_ = std::make_unique<DownloadDialogBridge>();
|
|
|
|
download_message_bridge_ = std::make_unique<DownloadMessageBridge>();
|
|
|
|
#endif
|
|
|
|
+
|
|
|
|
+#if BUILDFLAG(ENABLE_CEF)
|
|
|
|
+ cef_delegate_ =
|
|
|
|
+ cef::DownloadManagerDelegate::Create(profile_->GetDownloadManager());
|
|
|
|
+#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
ChromeDownloadManagerDelegate::~ChromeDownloadManagerDelegate() {
|
2024-10-24 17:05:31 +02:00
|
|
|
@@ -579,6 +589,9 @@ void ChromeDownloadManagerDelegate::Shutdown() {
|
2024-04-26 21:21:33 +02:00
|
|
|
download_manager_->RemoveObserver(this);
|
|
|
|
download_manager_ = nullptr;
|
|
|
|
}
|
|
|
|
+#if BUILDFLAG(ENABLE_CEF)
|
|
|
|
+ cef_delegate_.reset();
|
|
|
|
+#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
void ChromeDownloadManagerDelegate::OnDownloadCanceledAtShutdown(
|
2024-10-24 17:05:31 +02:00
|
|
|
@@ -647,6 +660,12 @@ bool ChromeDownloadManagerDelegate::DetermineDownloadTarget(
|
2024-04-26 21:21:33 +02:00
|
|
|
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(),
|
2024-10-24 17:05:31 +02:00
|
|
|
@@ -1080,8 +1099,11 @@ void ChromeDownloadManagerDelegate::OpenDownload(DownloadItem* download) {
|
2024-08-08 22:34:44 +02:00
|
|
|
Browser* browser =
|
|
|
|
web_contents ? chrome::FindBrowserWithTab(web_contents) : nullptr;
|
|
|
|
std::unique_ptr<chrome::ScopedTabbedBrowserDisplayer> browser_displayer;
|
|
|
|
- if (!browser ||
|
|
|
|
- !browser->CanSupportWindowFeature(Browser::FEATURE_TABSTRIP)) {
|
|
|
|
+ if (!browser
|
|
|
|
+#if !BUILDFLAG(ENABLE_CEF)
|
|
|
|
+ || !browser->CanSupportWindowFeature(Browser::FEATURE_TABSTRIP)
|
|
|
|
+#endif
|
|
|
|
+ ) {
|
|
|
|
browser_displayer =
|
|
|
|
std::make_unique<chrome::ScopedTabbedBrowserDisplayer>(profile_);
|
|
|
|
browser = browser_displayer->browser();
|
2024-04-26 21:21:33 +02:00
|
|
|
diff --git chrome/browser/download/chrome_download_manager_delegate.h chrome/browser/download/chrome_download_manager_delegate.h
|
2024-09-27 16:15:44 +02:00
|
|
|
index 32d23a0c98061..be6a99a33bdeb 100644
|
2024-04-26 21:21:33 +02:00
|
|
|
--- chrome/browser/download/chrome_download_manager_delegate.h
|
|
|
|
+++ chrome/browser/download/chrome_download_manager_delegate.h
|
|
|
|
@@ -19,6 +19,7 @@
|
|
|
|
#include "base/task/sequenced_task_runner.h"
|
|
|
|
#include "base/unguessable_token.h"
|
|
|
|
#include "build/build_config.h"
|
2024-07-05 19:07:07 +02:00
|
|
|
+#include "cef/libcef/features/features.h"
|
2024-04-26 21:21:33 +02:00
|
|
|
#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"
|
|
|
|
@@ -57,6 +58,12 @@ class CrxInstallError;
|
|
|
|
}
|
|
|
|
#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,
|
2024-09-27 16:15:44 +02:00
|
|
|
@@ -393,6 +400,10 @@ class ChromeDownloadManagerDelegate
|
2024-04-26 21:21:33 +02:00
|
|
|
// Whether a file picker dialog is showing.
|
|
|
|
bool is_file_picker_showing_;
|
|
|
|
|
|
|
|
+#if BUILDFLAG(ENABLE_CEF)
|
|
|
|
+ std::unique_ptr<cef::DownloadManagerDelegate> cef_delegate_;
|
|
|
|
+#endif
|
|
|
|
+
|
|
|
|
base::WeakPtrFactory<ChromeDownloadManagerDelegate> weak_ptr_factory_{this};
|
|
|
|
};
|
|
|
|
|