2019-07-17 20:47:27 +02:00
|
|
|
diff --git chrome/browser/download/download_prefs.cc chrome/browser/download/download_prefs.cc
|
2022-01-25 21:26:51 +01:00
|
|
|
index dbfae7b5e3d2c..bf18a6fbddf6d 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;
|
2021-11-10 22:57:31 +01:00
|
|
|
@@ -340,6 +345,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-01-25 21:26:51 +01:00
|
|
|
index 332fbc21aa0e3..1286fc203d6cd 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-01-25 21:26:51 +01:00
|
|
|
index c759b7a7c9d19..c63900f5d1686 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
|
2021-12-16 23:35:54 +01:00
|
|
|
@@ -248,12 +248,13 @@ void UpdatePrintSettingsOnIO(
|
|
|
|
mojom::PrintManagerHost::UpdatePrintSettingsCallback callback,
|
|
|
|
scoped_refptr<PrintQueriesQueue> queue,
|
|
|
|
base::Value job_settings,
|
|
|
|
- base::WeakPtr<PrintViewManagerBase> manager) {
|
|
|
|
+ base::WeakPtr<PrintViewManagerBase> manager,
|
|
|
|
+ int process_id,
|
|
|
|
+ int routing_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) {
|
|
|
|
- printer_query = queue->CreatePrinterQuery(
|
|
|
|
- content::ChildProcessHost::kInvalidUniqueID, MSG_ROUTING_NONE);
|
|
|
|
+ printer_query = queue->CreatePrinterQuery(process_id, routing_id);
|
|
|
|
}
|
|
|
|
auto* printer_query_ptr = printer_query.get();
|
|
|
|
printer_query_ptr->SetSettings(
|
2022-01-25 21:26:51 +01:00
|
|
|
@@ -675,6 +676,7 @@ void PrintViewManagerBase::UpdatePrintSettings(
|
2021-12-16 23:35:54 +01:00
|
|
|
job_settings.SetIntKey(kSettingRasterizePdfDpi, value);
|
|
|
|
}
|
|
|
|
|
|
|
|
+ content::RenderFrameHost* render_frame_host = GetCurrentTargetFrame();
|
|
|
|
auto callback_wrapper =
|
|
|
|
base::BindOnce(&PrintViewManagerBase::UpdatePrintSettingsReply,
|
|
|
|
weak_ptr_factory_.GetWeakPtr(), std::move(callback));
|
2022-01-25 21:26:51 +01:00
|
|
|
@@ -682,7 +684,9 @@ 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(),
|
|
|
|
+ render_frame_host->GetProcess()->GetID(),
|
|
|
|
+ render_frame_host->GetRoutingID()));
|
|
|
|
}
|
|
|
|
#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-01-25 21:26:51 +01:00
|
|
|
index aa7915ac042fe..ab4d9a8ac6e24 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-01-25 21:26:51 +01:00
|
|
|
@@ -146,9 +146,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
|
2021-06-04 03:34:56 +02:00
|
|
|
index 920f646f06484..76c0b5e5ee04b 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
|
2021-01-28 00:13:12 +01:00
|
|
|
@@ -25,10 +25,7 @@
|
|
|
|
</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-16 22:26:44 +01:00
|
|
|
index 8c5ba47779d24..91a70d8715f33 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/pdf_printer_handler.cc chrome/browser/ui/webui/print_preview/pdf_printer_handler.cc
|
2022-01-25 21:26:51 +01:00
|
|
|
index e5dfa76d26d86..b7dcf7a11479f 100644
|
2019-07-17 20:47:27 +02:00
|
|
|
--- chrome/browser/ui/webui/print_preview/pdf_printer_handler.cc
|
|
|
|
+++ chrome/browser/ui/webui/print_preview/pdf_printer_handler.cc
|
2021-06-04 03:34:56 +02:00
|
|
|
@@ -21,6 +21,7 @@
|
2020-09-22 21:54:02 +02:00
|
|
|
#include "base/values.h"
|
|
|
|
#include "build/build_config.h"
|
2021-01-28 00:13:12 +01:00
|
|
|
#include "build/chromeos_buildflags.h"
|
2020-09-22 21:54:02 +02:00
|
|
|
+#include "cef/libcef/features/runtime.h"
|
|
|
|
#include "chrome/browser/app_mode/app_mode_utils.h"
|
|
|
|
#include "chrome/browser/browser_process.h"
|
|
|
|
#include "chrome/browser/download/download_prefs.h"
|
2021-07-23 18:40:13 +02:00
|
|
|
@@ -62,6 +63,10 @@
|
2021-06-04 03:34:56 +02:00
|
|
|
#include "chromeos/lacros/lacros_service.h"
|
2020-09-22 21:54:02 +02:00
|
|
|
#endif
|
2019-07-17 20:47:27 +02:00
|
|
|
|
2020-09-22 21:54:02 +02:00
|
|
|
+#if BUILDFLAG(ENABLE_CEF)
|
2021-07-23 18:40:13 +02:00
|
|
|
+#include "cef/libcef/browser/alloy/alloy_dialog_util.h"
|
2019-07-17 20:47:27 +02:00
|
|
|
+#endif
|
2020-09-22 21:54:02 +02:00
|
|
|
+
|
|
|
|
namespace printing {
|
2019-07-17 20:47:27 +02:00
|
|
|
|
2020-09-22 21:54:02 +02:00
|
|
|
namespace {
|
2021-12-16 23:35:54 +01:00
|
|
|
@@ -414,16 +419,18 @@ void PdfPrinterHandler::SelectFile(const base::FilePath& default_filename,
|
2021-07-23 18:40:13 +02:00
|
|
|
service->GetRemote<crosapi::mojom::DriveIntegrationService>()
|
|
|
|
->GetMountPointPath(
|
|
|
|
base::BindOnce(&PdfPrinterHandler::OnSaveLocationReady,
|
|
|
|
- weak_ptr_factory_.GetWeakPtr(),
|
|
|
|
+ weak_ptr_factory_.GetWeakPtr(), initiator,
|
|
|
|
std::move(default_filename), prompt_user));
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
- OnSaveLocationReady(default_filename, prompt_user, GetSaveLocation());
|
|
|
|
+ OnSaveLocationReady(initiator, default_filename, prompt_user,
|
|
|
|
+ GetSaveLocation());
|
|
|
|
}
|
|
|
|
|
|
|
|
void PdfPrinterHandler::OnSaveLocationReady(
|
|
|
|
+ content::WebContents* initiator,
|
|
|
|
const base::FilePath& default_filename,
|
|
|
|
bool prompt_user,
|
|
|
|
const base::FilePath& path) {
|
2021-12-16 23:35:54 +01:00
|
|
|
@@ -441,10 +448,27 @@ void PdfPrinterHandler::OnSaveLocationReady(
|
2019-07-17 20:47:27 +02:00
|
|
|
// If the directory is empty there is no reason to create it or use the
|
|
|
|
// default location.
|
|
|
|
if (path.empty()) {
|
2020-09-22 21:54:02 +02:00
|
|
|
+#if BUILDFLAG(ENABLE_CEF)
|
|
|
|
+ if (cef::IsAlloyRuntimeEnabled()) {
|
|
|
|
+ ShowCefSaveAsDialog(initiator, default_filename, path);
|
|
|
|
+ return;
|
|
|
|
+ }
|
2019-07-17 20:47:27 +02:00
|
|
|
+#endif
|
2020-09-22 21:54:02 +02:00
|
|
|
OnDirectorySelected(default_filename, path);
|
2019-07-17 20:47:27 +02:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2020-09-22 21:54:02 +02:00
|
|
|
+ auto callback = base::BindOnce(&PdfPrinterHandler::OnDirectorySelected,
|
|
|
|
+ weak_ptr_factory_.GetWeakPtr(),
|
|
|
|
+ default_filename);
|
|
|
|
+#if BUILDFLAG(ENABLE_CEF)
|
|
|
|
+ if (cef::IsAlloyRuntimeEnabled()) {
|
|
|
|
+ callback = base::BindOnce(&PdfPrinterHandler::ShowCefSaveAsDialog,
|
|
|
|
+ weak_ptr_factory_.GetWeakPtr(), initiator,
|
|
|
|
+ default_filename);
|
|
|
|
+ }
|
|
|
|
+#endif
|
|
|
|
+
|
|
|
|
// Get default download directory. This will be used as a fallback if the
|
|
|
|
// save directory does not exist.
|
|
|
|
DownloadPrefs* download_prefs = DownloadPrefs::FromBrowserContext(profile_);
|
2021-12-16 23:35:54 +01:00
|
|
|
@@ -452,8 +476,7 @@ void PdfPrinterHandler::OnSaveLocationReady(
|
2020-03-30 22:13:42 +02:00
|
|
|
base::ThreadPool::PostTaskAndReplyWithResult(
|
|
|
|
FROM_HERE, {base::MayBlock(), base::TaskPriority::BEST_EFFORT},
|
2019-07-17 20:47:27 +02:00
|
|
|
base::BindOnce(&SelectSaveDirectory, path, default_path),
|
2020-09-22 21:54:02 +02:00
|
|
|
- base::BindOnce(&PdfPrinterHandler::OnDirectorySelected,
|
|
|
|
- weak_ptr_factory_.GetWeakPtr(), default_filename));
|
|
|
|
+ std::move(callback));
|
2019-07-17 20:47:27 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void PdfPrinterHandler::PostPrintToPdfTask() {
|
2021-12-16 23:35:54 +01:00
|
|
|
@@ -499,6 +522,36 @@ void PdfPrinterHandler::OnDirectorySelected(const base::FilePath& filename,
|
2019-07-17 20:47:27 +02:00
|
|
|
platform_util::GetTopLevel(preview_web_contents_->GetNativeView()), NULL);
|
|
|
|
}
|
2020-09-22 21:54:02 +02:00
|
|
|
|
|
|
|
+#if BUILDFLAG(ENABLE_CEF)
|
|
|
|
+
|
2019-07-17 20:47:27 +02:00
|
|
|
+void PdfPrinterHandler::ShowCefSaveAsDialog(content::WebContents* initiator,
|
|
|
|
+ const base::FilePath& filename,
|
|
|
|
+ const base::FilePath& directory) {
|
|
|
|
+ base::FilePath path = directory.Append(filename);
|
|
|
|
+
|
2021-07-23 18:40:13 +02:00
|
|
|
+ blink::mojom::FileChooserParams params;
|
2019-07-17 20:47:27 +02:00
|
|
|
+ params.mode = blink::mojom::FileChooserParams::Mode::kSave;
|
|
|
|
+ params.default_file_name = path;
|
2021-07-23 18:40:13 +02:00
|
|
|
+ params.accept_types.push_back(
|
|
|
|
+ alloy::FilePathTypeToString16(path.Extension()));
|
2019-07-17 20:47:27 +02:00
|
|
|
+
|
2021-07-23 18:40:13 +02:00
|
|
|
+ alloy::RunFileChooser(initiator, params,
|
|
|
|
+ base::BindOnce(&PdfPrinterHandler::SaveAsDialogDismissed,
|
|
|
|
+ weak_ptr_factory_.GetWeakPtr()));
|
2019-07-17 20:47:27 +02:00
|
|
|
+}
|
|
|
|
+
|
|
|
|
+void PdfPrinterHandler::SaveAsDialogDismissed(
|
|
|
|
+ int selected_accept_filter,
|
|
|
|
+ const std::vector<base::FilePath>& file_paths) {
|
|
|
|
+ if (file_paths.size() == 1) {
|
|
|
|
+ FileSelected(file_paths[0], 0, nullptr);
|
|
|
|
+ } else {
|
|
|
|
+ FileSelectionCanceled(nullptr);
|
|
|
|
+ }
|
|
|
|
+}
|
2020-09-22 21:54:02 +02:00
|
|
|
+
|
|
|
|
+#endif // BUILDFLAG(ENABLE_CEF)
|
|
|
|
+
|
2020-08-29 00:39:23 +02:00
|
|
|
base::FilePath PdfPrinterHandler::GetSaveLocation() const {
|
2021-01-28 00:13:12 +01:00
|
|
|
#if BUILDFLAG(IS_CHROMEOS_ASH)
|
2020-09-22 21:54:02 +02:00
|
|
|
drive::DriveIntegrationService* drive_service =
|
2019-07-17 20:47:27 +02:00
|
|
|
diff --git chrome/browser/ui/webui/print_preview/pdf_printer_handler.h chrome/browser/ui/webui/print_preview/pdf_printer_handler.h
|
2021-12-16 23:35:54 +01:00
|
|
|
index 46c8b1d08b075..1ee95cd7c3240 100644
|
2019-07-17 20:47:27 +02:00
|
|
|
--- chrome/browser/ui/webui/print_preview/pdf_printer_handler.h
|
|
|
|
+++ chrome/browser/ui/webui/print_preview/pdf_printer_handler.h
|
2021-12-16 23:35:54 +01:00
|
|
|
@@ -12,6 +12,7 @@
|
2021-04-21 00:52:34 +02:00
|
|
|
#include "base/memory/ref_counted.h"
|
2019-07-17 20:47:27 +02:00
|
|
|
#include "base/memory/weak_ptr.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/ui/webui/print_preview/printer_handler.h"
|
|
|
|
#include "ui/shell_dialogs/select_file_dialog.h"
|
2019-07-25 15:17:27 +02:00
|
|
|
|
2021-12-16 23:35:54 +01:00
|
|
|
@@ -95,10 +96,20 @@ class PdfPrinterHandler : public PrinterHandler,
|
2019-07-17 20:47:27 +02:00
|
|
|
void OnDirectorySelected(const base::FilePath& filename,
|
|
|
|
const base::FilePath& directory);
|
2020-09-22 21:54:02 +02:00
|
|
|
|
2021-07-23 18:40:13 +02:00
|
|
|
- void OnSaveLocationReady(const base::FilePath& default_filename,
|
|
|
|
+ void OnSaveLocationReady(content::WebContents* initiator,
|
|
|
|
+ const base::FilePath& default_filename,
|
|
|
|
bool prompt_user,
|
|
|
|
const base::FilePath& path);
|
|
|
|
|
2020-09-22 21:54:02 +02:00
|
|
|
+#if BUILDFLAG(ENABLE_CEF)
|
2019-07-17 20:47:27 +02:00
|
|
|
+ void ShowCefSaveAsDialog(content::WebContents* initiator,
|
|
|
|
+ const base::FilePath& filename,
|
|
|
|
+ const base::FilePath& directory);
|
|
|
|
+
|
|
|
|
+ void SaveAsDialogDismissed(int selected_accept_filter,
|
|
|
|
+ const std::vector<base::FilePath>& file_paths);
|
|
|
|
+#endif
|
2020-09-22 21:54:02 +02:00
|
|
|
+
|
2020-08-29 00:39:23 +02:00
|
|
|
// Return save location as the Drive mount or fetch from Download Preferences.
|
|
|
|
base::FilePath GetSaveLocation() const;
|
2020-09-22 21:54:02 +02:00
|
|
|
|
2019-07-17 20:47:27 +02:00
|
|
|
diff --git chrome/browser/ui/webui/print_preview/print_preview_ui.cc chrome/browser/ui/webui/print_preview/print_preview_ui.cc
|
2022-01-25 21:26:51 +01:00
|
|
|
index da70f602899a9..ca99c7d2ec09f 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"
|
2021-12-16 23:35:54 +01:00
|
|
|
@@ -97,6 +98,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[] =
|
2021-12-16 23:35:54 +01:00
|
|
|
@@ -342,7 +350,7 @@ void AddPrintPreviewStrings(content::WebUIDataSource* source) {
|
2021-06-04 03:34:56 +02:00
|
|
|
chrome::kCloudPrintCertificateErrorLearnMoreURL);
|
|
|
|
|
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));
|