2019-07-17 20:47:27 +02:00
|
|
|
diff --git chrome/browser/download/download_prefs.cc chrome/browser/download/download_prefs.cc
|
2022-04-21 20:58:48 +02:00
|
|
|
index f5ef1239dbece..98210504ccf53 100644
|
2019-07-17 20:47:27 +02:00
|
|
|
--- chrome/browser/download/download_prefs.cc
|
|
|
|
+++ chrome/browser/download/download_prefs.cc
|
2021-01-28 00:13:12 +01:00
|
|
|
@@ -24,6 +24,7 @@
|
2019-07-17 20:47:27 +02:00
|
|
|
#include "base/strings/utf_string_conversions.h"
|
|
|
|
#include "build/build_config.h"
|
2021-01-28 00:13:12 +01:00
|
|
|
#include "build/chromeos_buildflags.h"
|
2020-07-01 02:57:00 +02:00
|
|
|
+#include "cef/libcef/features/runtime.h"
|
2019-07-17 20:47:27 +02:00
|
|
|
#include "chrome/browser/download/chrome_download_manager_delegate.h"
|
|
|
|
#include "chrome/browser/download/download_core_service_factory.h"
|
|
|
|
#include "chrome/browser/download/download_core_service_impl.h"
|
2021-07-23 18:40:13 +02:00
|
|
|
@@ -60,6 +61,10 @@
|
2019-07-17 20:47:27 +02:00
|
|
|
#include "chrome/browser/ui/pdf/adobe_reader_info_win.h"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
+#if BUILDFLAG(ENABLE_CEF)
|
2021-07-23 18:40:13 +02:00
|
|
|
+#include "cef/libcef/browser/alloy/alloy_download_util.h"
|
2019-07-17 20:47:27 +02:00
|
|
|
+#endif
|
|
|
|
+
|
|
|
|
using content::BrowserContext;
|
|
|
|
using content::BrowserThread;
|
|
|
|
using content::DownloadManager;
|
2022-04-21 20:58:48 +02:00
|
|
|
@@ -344,6 +349,11 @@ DownloadPrefs* DownloadPrefs::FromDownloadManager(
|
2019-07-17 20:47:27 +02:00
|
|
|
// static
|
|
|
|
DownloadPrefs* DownloadPrefs::FromBrowserContext(
|
|
|
|
content::BrowserContext* context) {
|
2020-07-01 02:57:00 +02:00
|
|
|
+#if BUILDFLAG(ENABLE_CEF)
|
|
|
|
+ if (cef::IsAlloyRuntimeEnabled()) {
|
2021-07-23 18:40:13 +02:00
|
|
|
+ return alloy::GetDownloadPrefsFromBrowserContext(context);
|
2020-07-01 02:57:00 +02:00
|
|
|
+ }
|
2019-07-17 20:47:27 +02:00
|
|
|
+#endif
|
2021-06-04 03:34:56 +02:00
|
|
|
return FromDownloadManager(context->GetDownloadManager());
|
2019-07-17 20:47:27 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
diff --git chrome/browser/printing/print_preview_dialog_controller.cc chrome/browser/printing/print_preview_dialog_controller.cc
|
2022-03-26 02:12:30 +01:00
|
|
|
index d656ccabc3899..a4b7ce6a7dcd8 100644
|
2019-07-17 20:47:27 +02:00
|
|
|
--- chrome/browser/printing/print_preview_dialog_controller.cc
|
|
|
|
+++ chrome/browser/printing/print_preview_dialog_controller.cc
|
2021-07-23 18:40:13 +02:00
|
|
|
@@ -15,6 +15,7 @@
|
2019-10-01 15:55:16 +02:00
|
|
|
#include "build/branding_buildflags.h"
|
2019-07-17 20:47:27 +02:00
|
|
|
#include "build/build_config.h"
|
2021-01-28 00:13:12 +01:00
|
|
|
#include "build/chromeos_buildflags.h"
|
2019-07-17 20:47:27 +02:00
|
|
|
+#include "cef/libcef/features/features.h"
|
|
|
|
#include "chrome/browser/browser_process.h"
|
2019-09-04 17:13:32 +02:00
|
|
|
#include "chrome/browser/printing/print_view_manager.h"
|
2021-12-16 23:35:54 +01:00
|
|
|
#include "chrome/browser/task_manager/web_contents_tags.h"
|
2020-12-02 23:31:49 +01:00
|
|
|
diff --git chrome/browser/printing/print_view_manager_base.cc chrome/browser/printing/print_view_manager_base.cc
|
2022-04-27 21:24:24 +02:00
|
|
|
index fb69efbfa8e35..060aad00efe18 100644
|
2020-12-02 23:31:49 +01:00
|
|
|
--- chrome/browser/printing/print_view_manager_base.cc
|
|
|
|
+++ chrome/browser/printing/print_view_manager_base.cc
|
2022-04-27 21:24:24 +02:00
|
|
|
@@ -223,12 +223,12 @@ void UpdatePrintSettingsOnIO(
|
2021-12-16 23:35:54 +01:00
|
|
|
mojom::PrintManagerHost::UpdatePrintSettingsCallback callback,
|
|
|
|
scoped_refptr<PrintQueriesQueue> queue,
|
2022-04-27 21:24:24 +02:00
|
|
|
base::Value::Dict job_settings,
|
2021-12-16 23:35:54 +01:00
|
|
|
- base::WeakPtr<PrintViewManagerBase> manager) {
|
|
|
|
+ base::WeakPtr<PrintViewManagerBase> manager,
|
2022-03-26 02:12:30 +01:00
|
|
|
+ const content::GlobalRenderFrameHostId& global_id) {
|
2021-09-23 15:01:24 +02:00
|
|
|
DCHECK_CURRENTLY_ON(content::BrowserThread::IO);
|
|
|
|
std::unique_ptr<PrinterQuery> printer_query = queue->PopPrinterQuery(cookie);
|
|
|
|
if (!printer_query) {
|
2022-03-26 02:12:30 +01:00
|
|
|
- printer_query =
|
|
|
|
- queue->CreatePrinterQuery(content::GlobalRenderFrameHostId());
|
|
|
|
+ printer_query = queue->CreatePrinterQuery(global_id);
|
2021-09-23 15:01:24 +02:00
|
|
|
}
|
|
|
|
auto* printer_query_ptr = printer_query.get();
|
|
|
|
printer_query_ptr->SetSettings(
|
2022-04-27 21:24:24 +02:00
|
|
|
@@ -694,6 +694,7 @@ void PrintViewManagerBase::UpdatePrintSettings(
|
|
|
|
job_settings.Set(kSettingRasterizePdfDpi, value);
|
2021-12-16 23:35:54 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
+ content::RenderFrameHost* render_frame_host = GetCurrentTargetFrame();
|
|
|
|
auto callback_wrapper =
|
|
|
|
base::BindOnce(&PrintViewManagerBase::UpdatePrintSettingsReply,
|
|
|
|
weak_ptr_factory_.GetWeakPtr(), std::move(callback));
|
2022-04-27 21:24:24 +02:00
|
|
|
@@ -701,7 +702,8 @@ void PrintViewManagerBase::UpdatePrintSettings(
|
2021-12-16 23:35:54 +01:00
|
|
|
FROM_HERE,
|
|
|
|
base::BindOnce(&UpdatePrintSettingsOnIO, cookie,
|
|
|
|
std::move(callback_wrapper), queue_,
|
|
|
|
- std::move(job_settings), weak_ptr_factory_.GetWeakPtr()));
|
|
|
|
+ std::move(job_settings), weak_ptr_factory_.GetWeakPtr(),
|
2022-03-26 02:12:30 +01:00
|
|
|
+ render_frame_host->GetGlobalId()));
|
2021-12-16 23:35:54 +01:00
|
|
|
}
|
|
|
|
#endif // BUILDFLAG(ENABLE_PRINT_PREVIEW)
|
|
|
|
|
2020-10-08 21:54:42 +02:00
|
|
|
diff --git chrome/browser/printing/print_view_manager_base.h chrome/browser/printing/print_view_manager_base.h
|
2022-04-27 21:24:24 +02:00
|
|
|
index 48895e0f8a846..699d9f0029c04 100644
|
2020-10-08 21:54:42 +02:00
|
|
|
--- chrome/browser/printing/print_view_manager_base.h
|
|
|
|
+++ chrome/browser/printing/print_view_manager_base.h
|
2022-04-27 21:24:24 +02:00
|
|
|
@@ -184,9 +184,6 @@ class PrintViewManagerBase : public PrintManager, public PrintJob::Observer {
|
2020-10-08 21:54:42 +02:00
|
|
|
// Manages the low-level talk to the printer.
|
|
|
|
scoped_refptr<PrintJob> print_job_;
|
|
|
|
|
|
|
|
- private:
|
2020-12-02 23:31:49 +01:00
|
|
|
- friend class TestPrintViewManager;
|
|
|
|
-
|
2021-12-16 23:35:54 +01:00
|
|
|
// content::WebContentsObserver implementation.
|
|
|
|
void RenderFrameHostStateChanged(
|
|
|
|
content::RenderFrameHost* render_frame_host,
|
2019-07-17 20:47:27 +02:00
|
|
|
diff --git chrome/browser/resources/print_preview/ui/destination_dialog.html chrome/browser/resources/print_preview/ui/destination_dialog.html
|
2022-04-21 20:58:48 +02:00
|
|
|
index 5ea55a097c156..1ad6e23647be9 100644
|
2019-07-17 20:47:27 +02:00
|
|
|
--- chrome/browser/resources/print_preview/ui/destination_dialog.html
|
|
|
|
+++ chrome/browser/resources/print_preview/ui/destination_dialog.html
|
2022-04-21 20:58:48 +02:00
|
|
|
@@ -15,10 +15,7 @@
|
2021-01-28 00:13:12 +01:00
|
|
|
</print-preview-destination-list>
|
2020-02-10 18:10:17 +01:00
|
|
|
</div>
|
|
|
|
<div slot="button-container">
|
2020-12-02 23:31:49 +01:00
|
|
|
- <cr-button on-click="onManageButtonClick_">
|
2020-02-10 18:10:17 +01:00
|
|
|
- $i18n{manage}
|
2020-12-02 23:31:49 +01:00
|
|
|
- <iron-icon icon="cr:open-in-new" id="manageIcon"></iron-icon>
|
2020-02-10 18:10:17 +01:00
|
|
|
- </cr-button>
|
|
|
|
+ <div></div>
|
|
|
|
<cr-button class="cancel-button" on-click="onCancelButtonClick_">
|
|
|
|
$i18n{cancel}
|
|
|
|
</cr-button>
|
2019-07-17 20:47:27 +02:00
|
|
|
diff --git chrome/browser/ui/webui/constrained_web_dialog_ui.cc chrome/browser/ui/webui/constrained_web_dialog_ui.cc
|
2022-02-21 23:23:40 +01:00
|
|
|
index f6098966f5b34..da78289b66155 100644
|
2019-07-17 20:47:27 +02:00
|
|
|
--- chrome/browser/ui/webui/constrained_web_dialog_ui.cc
|
|
|
|
+++ chrome/browser/ui/webui/constrained_web_dialog_ui.cc
|
2022-02-16 22:26:44 +01:00
|
|
|
@@ -13,6 +13,7 @@
|
|
|
|
#include "base/memory/ptr_util.h"
|
|
|
|
#include "base/memory/raw_ptr.h"
|
|
|
|
#include "base/values.h"
|
|
|
|
+#include "cef/libcef/features/runtime.h"
|
|
|
|
#include "content/public/browser/notification_service.h"
|
|
|
|
#include "content/public/browser/render_frame_host.h"
|
|
|
|
#include "content/public/browser/web_contents.h"
|
|
|
|
@@ -57,7 +58,9 @@ class ConstrainedWebDialogDelegateUserData
|
2019-07-17 20:47:27 +02:00
|
|
|
ConstrainedWebDialogUI::ConstrainedWebDialogUI(content::WebUI* web_ui)
|
|
|
|
: WebUIController(web_ui) {
|
|
|
|
#if BUILDFLAG(ENABLE_EXTENSIONS)
|
2022-02-16 22:26:44 +01:00
|
|
|
+ if (!cef::IsAlloyRuntimeEnabled()) {
|
2019-07-17 20:47:27 +02:00
|
|
|
extensions::TabHelper::CreateForWebContents(web_ui->GetWebContents());
|
2022-02-16 22:26:44 +01:00
|
|
|
+ }
|
2019-07-17 20:47:27 +02:00
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
diff --git chrome/browser/ui/webui/print_preview/print_preview_ui.cc chrome/browser/ui/webui/print_preview/print_preview_ui.cc
|
2022-04-27 21:24:24 +02:00
|
|
|
index 70a13e9c0c5e4..1eb0e9c8faa62 100644
|
2019-07-17 20:47:27 +02:00
|
|
|
--- chrome/browser/ui/webui/print_preview/print_preview_ui.cc
|
|
|
|
+++ chrome/browser/ui/webui/print_preview/print_preview_ui.cc
|
2021-12-16 23:35:54 +01:00
|
|
|
@@ -22,6 +22,7 @@
|
2019-07-17 20:47:27 +02:00
|
|
|
#include "base/values.h"
|
|
|
|
#include "build/build_config.h"
|
2021-01-28 00:13:12 +01:00
|
|
|
#include "build/chromeos_buildflags.h"
|
2021-06-04 03:34:56 +02:00
|
|
|
+#include "cef/libcef/features/runtime.h"
|
2019-07-17 20:47:27 +02:00
|
|
|
#include "chrome/browser/browser_process.h"
|
2020-07-08 19:23:29 +02:00
|
|
|
#include "chrome/browser/pdf/pdf_extension_util.h"
|
2020-08-29 00:39:23 +02:00
|
|
|
#include "chrome/browser/printing/background_printing_manager.h"
|
2022-03-26 02:12:30 +01:00
|
|
|
@@ -96,6 +97,13 @@ const char16_t kBasicPrintShortcut[] = u"\u0028\u21e7\u2318\u0050\u0029";
|
2021-06-04 03:34:56 +02:00
|
|
|
const char16_t kBasicPrintShortcut[] = u"(Ctrl+Shift+P)";
|
2019-07-17 20:47:27 +02:00
|
|
|
#endif
|
|
|
|
|
2021-06-04 03:34:56 +02:00
|
|
|
+const char16_t* GetBasicPrintShortcut() {
|
|
|
|
+ if (cef::IsAlloyRuntimeEnabled()) {
|
|
|
|
+ return u"";
|
|
|
|
+ }
|
|
|
|
+ return kBasicPrintShortcut;
|
|
|
|
+}
|
|
|
|
+
|
2021-03-04 23:36:57 +01:00
|
|
|
constexpr char kInvalidArgsForDidStartPreview[] =
|
|
|
|
"Invalid arguments for DidStartPreview";
|
2021-06-04 03:34:56 +02:00
|
|
|
constexpr char kInvalidPageNumberForDidPreviewPage[] =
|
2022-04-27 21:24:24 +02:00
|
|
|
@@ -326,7 +334,7 @@ void AddPrintPreviewStrings(content::WebUIDataSource* source) {
|
2022-04-21 20:58:48 +02:00
|
|
|
source->AddLocalizedStrings(kLocalizedStrings);
|
2021-06-04 03:34:56 +02:00
|
|
|
|
2022-01-25 21:26:51 +01:00
|
|
|
#if !BUILDFLAG(IS_CHROMEOS)
|
2021-06-04 03:34:56 +02:00
|
|
|
- const std::u16string shortcut_text(kBasicPrintShortcut);
|
|
|
|
+ const std::u16string shortcut_text(GetBasicPrintShortcut());
|
|
|
|
source->AddString("systemDialogOption",
|
|
|
|
l10n_util::GetStringFUTF16(
|
|
|
|
IDS_PRINT_PREVIEW_SYSTEM_DIALOG_OPTION, shortcut_text));
|