|
@@ -11,10 +11,10 @@ majority of changes originally come from these PRs:
|
|
|
This patch also fixes callback for manual user cancellation and success.
|
|
|
|
|
|
diff --git a/chrome/browser/printing/print_job.cc b/chrome/browser/printing/print_job.cc
|
|
|
-index a5b0e4ff00b7c3886c484e5a6a307816bc3f5de4..eb2e22fb2f9ac39f2fb33393e72d9248b8c30736 100644
|
|
|
+index 1f33cee63624693729b27caabb9f25891cf169f8..3d20b4e11497d91bf24b433846440a26df3effa4 100644
|
|
|
--- a/chrome/browser/printing/print_job.cc
|
|
|
+++ b/chrome/browser/printing/print_job.cc
|
|
|
-@@ -349,18 +349,25 @@ void PrintJob::StartPdfToEmfConversion(
|
|
|
+@@ -350,18 +350,25 @@ void PrintJob::StartPdfToEmfConversion(
|
|
|
// seems to work with the fix for this bug applied.
|
|
|
const PrintSettings& settings = document()->settings();
|
|
|
bool print_text_with_gdi =
|
|
@@ -43,10 +43,10 @@ index a5b0e4ff00b7c3886c484e5a6a307816bc3f5de4..eb2e22fb2f9ac39f2fb33393e72d9248
|
|
|
using RenderMode = PdfRenderSettings::Mode;
|
|
|
RenderMode mode;
|
|
|
diff --git a/chrome/browser/printing/print_job_worker.cc b/chrome/browser/printing/print_job_worker.cc
|
|
|
-index 8e648fa8d563ab4ce98ffcca6825e4ddde1f60ce..47ba61f7b8d37b51587f75ae027c409603e03c63 100644
|
|
|
+index 47a5b3c2a11ec595ff926df10f856ed3c5375c55..38769ab454b143a1f50d1291a363092cd3dad407 100644
|
|
|
--- a/chrome/browser/printing/print_job_worker.cc
|
|
|
+++ b/chrome/browser/printing/print_job_worker.cc
|
|
|
-@@ -21,7 +21,6 @@
|
|
|
+@@ -22,7 +22,6 @@
|
|
|
#include "chrome/browser/browser_process.h"
|
|
|
#include "chrome/browser/chrome_notification_types.h"
|
|
|
#include "chrome/browser/printing/print_job.h"
|
|
@@ -54,7 +54,7 @@ index 8e648fa8d563ab4ce98ffcca6825e4ddde1f60ce..47ba61f7b8d37b51587f75ae027c4096
|
|
|
#include "components/crash/core/common/crash_keys.h"
|
|
|
#include "content/public/browser/browser_task_traits.h"
|
|
|
#include "content/public/browser/browser_thread.h"
|
|
|
-@@ -29,6 +28,7 @@
|
|
|
+@@ -30,6 +29,7 @@
|
|
|
#include "content/public/browser/render_frame_host.h"
|
|
|
#include "content/public/browser/web_contents.h"
|
|
|
#include "printing/backend/print_backend.h"
|
|
@@ -62,8 +62,8 @@ index 8e648fa8d563ab4ce98ffcca6825e4ddde1f60ce..47ba61f7b8d37b51587f75ae027c4096
|
|
|
#include "printing/print_job_constants.h"
|
|
|
#include "printing/printed_document.h"
|
|
|
#include "printing/printing_utils.h"
|
|
|
-@@ -236,16 +236,21 @@ void PrintJobWorker::UpdatePrintSettings(base::Value new_settings,
|
|
|
- #endif // defined(OS_LINUX) && defined(USE_CUPS) && !defined(OS_CHROMEOS)
|
|
|
+@@ -238,16 +238,21 @@ void PrintJobWorker::UpdatePrintSettings(base::Value new_settings,
|
|
|
+ // defined(USE_CUPS)
|
|
|
}
|
|
|
|
|
|
- PrintingContext::Result result;
|
|
@@ -86,8 +86,8 @@ index 8e648fa8d563ab4ce98ffcca6825e4ddde1f60ce..47ba61f7b8d37b51587f75ae027c4096
|
|
|
- GetSettingsDone(std::move(callback), result);
|
|
|
}
|
|
|
|
|
|
- #if defined(OS_CHROMEOS)
|
|
|
-@@ -261,6 +266,13 @@ void PrintJobWorker::UpdatePrintSettingsFromPOD(
|
|
|
+ #if BUILDFLAG(IS_CHROMEOS_ASH)
|
|
|
+@@ -263,6 +268,13 @@ void PrintJobWorker::UpdatePrintSettingsFromPOD(
|
|
|
|
|
|
void PrintJobWorker::GetSettingsDone(SettingsCallback callback,
|
|
|
PrintingContext::Result result) {
|
|
@@ -102,10 +102,10 @@ index 8e648fa8d563ab4ce98ffcca6825e4ddde1f60ce..47ba61f7b8d37b51587f75ae027c4096
|
|
|
}
|
|
|
|
|
|
diff --git a/chrome/browser/printing/print_view_manager_base.cc b/chrome/browser/printing/print_view_manager_base.cc
|
|
|
-index 277f2ca033d1be253da6c489897bb9cbedceb9e9..82d920addbb1bb8a07986d75004a0e73c1078650 100644
|
|
|
+index 94774af53c16d13329c189739fb8c25a58e42494..9364f3bf37d5244bbcedb672e891d14094510816 100644
|
|
|
--- a/chrome/browser/printing/print_view_manager_base.cc
|
|
|
+++ b/chrome/browser/printing/print_view_manager_base.cc
|
|
|
-@@ -29,10 +29,7 @@
|
|
|
+@@ -30,10 +30,7 @@
|
|
|
#include "chrome/browser/printing/print_view_manager_common.h"
|
|
|
#include "chrome/browser/printing/printer_query.h"
|
|
|
#include "chrome/browser/profiles/profile.h"
|
|
@@ -116,7 +116,7 @@ index 277f2ca033d1be253da6c489897bb9cbedceb9e9..82d920addbb1bb8a07986d75004a0e73
|
|
|
#include "chromeos/constants/chromeos_features.h"
|
|
|
#include "components/prefs/pref_service.h"
|
|
|
#include "components/printing/browser/print_composite_client.h"
|
|
|
-@@ -49,6 +46,7 @@
|
|
|
+@@ -50,6 +47,7 @@
|
|
|
#include "content/public/browser/render_process_host.h"
|
|
|
#include "content/public/browser/render_view_host.h"
|
|
|
#include "content/public/browser/web_contents.h"
|
|
@@ -124,7 +124,7 @@ index 277f2ca033d1be253da6c489897bb9cbedceb9e9..82d920addbb1bb8a07986d75004a0e73
|
|
|
#include "mojo/public/cpp/system/buffer.h"
|
|
|
#include "printing/buildflags/buildflags.h"
|
|
|
#include "printing/metafile_skia.h"
|
|
|
-@@ -73,6 +71,8 @@ using PrintSettingsCallback =
|
|
|
+@@ -74,6 +72,8 @@ using PrintSettingsCallback =
|
|
|
base::OnceCallback<void(std::unique_ptr<PrinterQuery>)>;
|
|
|
|
|
|
void ShowWarningMessageBox(const base::string16& message) {
|
|
@@ -133,7 +133,7 @@ index 277f2ca033d1be253da6c489897bb9cbedceb9e9..82d920addbb1bb8a07986d75004a0e73
|
|
|
// Runs always on the UI thread.
|
|
|
static bool is_dialog_shown = false;
|
|
|
if (is_dialog_shown)
|
|
|
-@@ -81,6 +81,7 @@ void ShowWarningMessageBox(const base::string16& message) {
|
|
|
+@@ -82,6 +82,7 @@ void ShowWarningMessageBox(const base::string16& message) {
|
|
|
base::AutoReset<bool> auto_reset(&is_dialog_shown, true);
|
|
|
|
|
|
chrome::ShowWarningMessageBox(nullptr, base::string16(), message);
|
|
@@ -141,7 +141,7 @@ index 277f2ca033d1be253da6c489897bb9cbedceb9e9..82d920addbb1bb8a07986d75004a0e73
|
|
|
}
|
|
|
|
|
|
#if BUILDFLAG(ENABLE_PRINT_PREVIEW)
|
|
|
-@@ -218,7 +219,9 @@ void UpdatePrintSettingsReplyOnIO(
|
|
|
+@@ -219,7 +220,9 @@ void UpdatePrintSettingsReplyOnIO(
|
|
|
DCHECK(printer_query);
|
|
|
auto params = mojom::PrintPagesParams::New();
|
|
|
params->params = mojom::PrintParams::New();
|
|
@@ -152,7 +152,7 @@ index 277f2ca033d1be253da6c489897bb9cbedceb9e9..82d920addbb1bb8a07986d75004a0e73
|
|
|
RenderParamsFromPrintSettings(printer_query->settings(),
|
|
|
params->params.get());
|
|
|
params->params->document_cookie = printer_query->cookie();
|
|
|
-@@ -271,12 +274,14 @@ PrintViewManagerBase::PrintViewManagerBase(content::WebContents* web_contents)
|
|
|
+@@ -272,12 +275,14 @@ PrintViewManagerBase::PrintViewManagerBase(content::WebContents* web_contents)
|
|
|
: PrintManager(web_contents),
|
|
|
queue_(g_browser_process->print_job_manager()->queue()) {
|
|
|
DCHECK(queue_);
|
|
@@ -167,7 +167,7 @@ index 277f2ca033d1be253da6c489897bb9cbedceb9e9..82d920addbb1bb8a07986d75004a0e73
|
|
|
}
|
|
|
|
|
|
PrintViewManagerBase::~PrintViewManagerBase() {
|
|
|
-@@ -284,7 +289,10 @@ PrintViewManagerBase::~PrintViewManagerBase() {
|
|
|
+@@ -285,7 +290,10 @@ PrintViewManagerBase::~PrintViewManagerBase() {
|
|
|
DisconnectFromCurrentPrintJob();
|
|
|
}
|
|
|
|
|
@@ -179,7 +179,7 @@ index 277f2ca033d1be253da6c489897bb9cbedceb9e9..82d920addbb1bb8a07986d75004a0e73
|
|
|
DisconnectFromCurrentPrintJob();
|
|
|
|
|
|
// Don't print / print preview crashed tabs.
|
|
|
-@@ -292,7 +300,14 @@ bool PrintViewManagerBase::PrintNow(content::RenderFrameHost* rfh) {
|
|
|
+@@ -293,7 +301,14 @@ bool PrintViewManagerBase::PrintNow(content::RenderFrameHost* rfh) {
|
|
|
return false;
|
|
|
|
|
|
SetPrintingRFH(rfh);
|
|
@@ -195,7 +195,7 @@ index 277f2ca033d1be253da6c489897bb9cbedceb9e9..82d920addbb1bb8a07986d75004a0e73
|
|
|
return true;
|
|
|
}
|
|
|
|
|
|
-@@ -413,9 +428,9 @@ void PrintViewManagerBase::StartLocalPrintJob(
|
|
|
+@@ -414,9 +429,9 @@ void PrintViewManagerBase::StartLocalPrintJob(
|
|
|
void PrintViewManagerBase::UpdatePrintingEnabled() {
|
|
|
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
|
|
|
// The Unretained() is safe because ForEachFrame() is synchronous.
|
|
@@ -208,7 +208,7 @@ index 277f2ca033d1be253da6c489897bb9cbedceb9e9..82d920addbb1bb8a07986d75004a0e73
|
|
|
}
|
|
|
|
|
|
void PrintViewManagerBase::NavigationStopped() {
|
|
|
-@@ -520,12 +535,13 @@ void PrintViewManagerBase::OnDidPrintDocument(
|
|
|
+@@ -532,12 +547,13 @@ void PrintViewManagerBase::DidPrintDocument(
|
|
|
void PrintViewManagerBase::GetDefaultPrintSettings(
|
|
|
GetDefaultPrintSettingsCallback callback) {
|
|
|
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
|
|
@@ -223,7 +223,7 @@ index 277f2ca033d1be253da6c489897bb9cbedceb9e9..82d920addbb1bb8a07986d75004a0e73
|
|
|
content::RenderFrameHost* render_frame_host =
|
|
|
print_manager_host_receivers_.GetCurrentTargetFrame();
|
|
|
|
|
|
-@@ -541,11 +557,12 @@ void PrintViewManagerBase::UpdatePrintSettings(
|
|
|
+@@ -553,11 +569,12 @@ void PrintViewManagerBase::UpdatePrintSettings(
|
|
|
base::Value job_settings,
|
|
|
UpdatePrintSettingsCallback callback) {
|
|
|
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
|
|
@@ -237,7 +237,7 @@ index 277f2ca033d1be253da6c489897bb9cbedceb9e9..82d920addbb1bb8a07986d75004a0e73
|
|
|
if (!job_settings.FindIntKey(kSettingPrinterType)) {
|
|
|
UpdatePrintSettingsReply(std::move(callback), nullptr, false);
|
|
|
return;
|
|
|
-@@ -566,7 +583,7 @@ void PrintViewManagerBase::PrintingFailed(int32_t cookie) {
|
|
|
+@@ -578,7 +595,7 @@ void PrintViewManagerBase::PrintingFailed(int32_t cookie) {
|
|
|
PrintManager::PrintingFailed(cookie);
|
|
|
|
|
|
#if BUILDFLAG(ENABLE_PRINT_PREVIEW)
|
|
@@ -246,7 +246,7 @@ index 277f2ca033d1be253da6c489897bb9cbedceb9e9..82d920addbb1bb8a07986d75004a0e73
|
|
|
#endif
|
|
|
|
|
|
ReleasePrinterQuery();
|
|
|
-@@ -585,6 +602,11 @@ void PrintViewManagerBase::OnScriptedPrint(
|
|
|
+@@ -597,6 +614,11 @@ void PrintViewManagerBase::OnScriptedPrint(
|
|
|
}
|
|
|
|
|
|
void PrintViewManagerBase::ShowInvalidPrinterSettingsError() {
|
|
@@ -258,7 +258,7 @@ index 277f2ca033d1be253da6c489897bb9cbedceb9e9..82d920addbb1bb8a07986d75004a0e73
|
|
|
base::ThreadTaskRunnerHandle::Get()->PostTask(
|
|
|
FROM_HERE, base::BindOnce(&ShowWarningMessageBox,
|
|
|
l10n_util::GetStringUTF16(
|
|
|
-@@ -654,9 +676,13 @@ void PrintViewManagerBase::OnNotifyPrintJobEvent(
|
|
|
+@@ -666,9 +688,13 @@ void PrintViewManagerBase::OnNotifyPrintJobEvent(
|
|
|
content::NotificationService::NoDetails());
|
|
|
break;
|
|
|
}
|
|
@@ -274,7 +274,7 @@ index 277f2ca033d1be253da6c489897bb9cbedceb9e9..82d920addbb1bb8a07986d75004a0e73
|
|
|
NOTREACHED();
|
|
|
break;
|
|
|
}
|
|
|
-@@ -754,8 +780,10 @@ bool PrintViewManagerBase::CreateNewPrintJob(
|
|
|
+@@ -766,8 +792,10 @@ bool PrintViewManagerBase::CreateNewPrintJob(
|
|
|
DCHECK(!quit_inner_loop_);
|
|
|
DCHECK(query);
|
|
|
|
|
@@ -287,7 +287,7 @@ index 277f2ca033d1be253da6c489897bb9cbedceb9e9..82d920addbb1bb8a07986d75004a0e73
|
|
|
|
|
|
// We can't print if there is no renderer.
|
|
|
if (!web_contents()->GetMainFrame()->GetRenderViewHost() ||
|
|
|
-@@ -779,8 +807,6 @@ bool PrintViewManagerBase::CreateNewPrintJob(
|
|
|
+@@ -791,8 +819,6 @@ bool PrintViewManagerBase::CreateNewPrintJob(
|
|
|
print_job_->SetSource(source, /*source_id=*/"");
|
|
|
#endif
|
|
|
|
|
@@ -296,7 +296,7 @@ index 277f2ca033d1be253da6c489897bb9cbedceb9e9..82d920addbb1bb8a07986d75004a0e73
|
|
|
printing_succeeded_ = false;
|
|
|
return true;
|
|
|
}
|
|
|
-@@ -829,14 +855,22 @@ void PrintViewManagerBase::ReleasePrintJob() {
|
|
|
+@@ -841,14 +867,22 @@ void PrintViewManagerBase::ReleasePrintJob() {
|
|
|
content::RenderFrameHost* rfh = printing_rfh_;
|
|
|
printing_rfh_ = nullptr;
|
|
|
|
|
@@ -321,7 +321,7 @@ index 277f2ca033d1be253da6c489897bb9cbedceb9e9..82d920addbb1bb8a07986d75004a0e73
|
|
|
// Don't close the worker thread.
|
|
|
print_job_ = nullptr;
|
|
|
}
|
|
|
-@@ -872,7 +906,7 @@ bool PrintViewManagerBase::RunInnerMessageLoop() {
|
|
|
+@@ -884,7 +918,7 @@ bool PrintViewManagerBase::RunInnerMessageLoop() {
|
|
|
}
|
|
|
|
|
|
bool PrintViewManagerBase::OpportunisticallyCreatePrintJob(int cookie) {
|
|
@@ -331,7 +331,7 @@ index 277f2ca033d1be253da6c489897bb9cbedceb9e9..82d920addbb1bb8a07986d75004a0e73
|
|
|
|
|
|
if (!cookie) {
|
|
|
diff --git a/chrome/browser/printing/print_view_manager_base.h b/chrome/browser/printing/print_view_manager_base.h
|
|
|
-index e22cff218a565637d0e0cd4f1290fda7f47fd25d..6c03577126ce0b313c3777f1f1aebebbf39831c7 100644
|
|
|
+index 59ef9a7f60dc21bdf1f4f87092e490cc1f1f1fe7..0c6da3f7658314776bf8fd7898a50d4cd30c6eb9 100644
|
|
|
--- a/chrome/browser/printing/print_view_manager_base.h
|
|
|
+++ b/chrome/browser/printing/print_view_manager_base.h
|
|
|
@@ -38,6 +38,8 @@ class PrintJob;
|
|
@@ -355,7 +355,7 @@ index e22cff218a565637d0e0cd4f1290fda7f47fd25d..6c03577126ce0b313c3777f1f1aebebb
|
|
|
|
|
|
#if BUILDFLAG(ENABLE_PRINT_PREVIEW)
|
|
|
// Prints the document in |print_data| with settings specified in
|
|
|
-@@ -219,9 +224,15 @@ class PrintViewManagerBase : public content::NotificationObserver,
|
|
|
+@@ -217,9 +222,15 @@ class PrintViewManagerBase : public content::NotificationObserver,
|
|
|
// The current RFH that is printing with a system printing dialog.
|
|
|
content::RenderFrameHost* printing_rfh_ = nullptr;
|
|
|
|
|
@@ -372,7 +372,7 @@ index e22cff218a565637d0e0cd4f1290fda7f47fd25d..6c03577126ce0b313c3777f1f1aebebb
|
|
|
// This means we are _blocking_ until all the necessary pages have been
|
|
|
// rendered or the print settings are being loaded.
|
|
|
diff --git a/chrome/browser/printing/printing_message_filter.cc b/chrome/browser/printing/printing_message_filter.cc
|
|
|
-index 8d7f4a90ae9f23fc94ebc425c17df8d03a8df36e..ee8152a2f9bfeaad733d1db8ecfa7b3170da101f 100644
|
|
|
+index ca5858bffffa5fabd77de502f6453ccd8b315653..943d753ed78276acc094d92b171b7220f1caa49f 100644
|
|
|
--- a/chrome/browser/printing/printing_message_filter.cc
|
|
|
+++ b/chrome/browser/printing/printing_message_filter.cc
|
|
|
@@ -22,6 +22,7 @@
|
|
@@ -396,7 +396,7 @@ index 8d7f4a90ae9f23fc94ebc425c17df8d03a8df36e..ee8152a2f9bfeaad733d1db8ecfa7b31
|
|
|
render_process_id_(render_process_id),
|
|
|
queue_(g_browser_process->print_job_manager()->queue()) {
|
|
|
DCHECK(queue_.get());
|
|
|
- printing_shutdown_notifier_ =
|
|
|
+ printing_shutdown_subscription_ =
|
|
|
PrintingMessageFilterShutdownNotifierFactory::GetInstance()
|
|
|
- ->Get(profile)
|
|
|
+ ->Get(browser_context)
|
|
@@ -419,7 +419,7 @@ index 8d7f4a90ae9f23fc94ebc425c17df8d03a8df36e..ee8152a2f9bfeaad733d1db8ecfa7b31
|
|
|
#endif
|
|
|
|
|
|
diff --git a/chrome/browser/printing/printing_message_filter.h b/chrome/browser/printing/printing_message_filter.h
|
|
|
-index 9d6a8900d2b0ec02c421e6f32644cfd3e1cdf1ce..b9018490784d83b98625a40d1e9de55385448a13 100644
|
|
|
+index ec7bda04cfac09eba3d5285770d1054c2997c170..c36d6eca8c6aa1a23d39d742c04496b4fcc56e4e 100644
|
|
|
--- a/chrome/browser/printing/printing_message_filter.h
|
|
|
+++ b/chrome/browser/printing/printing_message_filter.h
|
|
|
@@ -22,6 +22,10 @@
|
|
@@ -444,7 +444,7 @@ index 9d6a8900d2b0ec02c421e6f32644cfd3e1cdf1ce..b9018490784d83b98625a40d1e9de553
|
|
|
// content::BrowserMessageFilter:
|
|
|
bool OnMessageReceived(const IPC::Message& message) override;
|
|
|
diff --git a/components/printing/common/print.mojom b/components/printing/common/print.mojom
|
|
|
-index bcd40171250b5d642ac14fb802f22a17fc1f61ec..5877f7d3c2eb27acf61d9bc03b0a8b9873172dc6 100644
|
|
|
+index 2c19fe79d3c4286749bf5e66e3b042b7367b674e..5fe34d36c872945c3bc16b35b2844f4561368254 100644
|
|
|
--- a/components/printing/common/print.mojom
|
|
|
+++ b/components/printing/common/print.mojom
|
|
|
@@ -230,7 +230,7 @@ interface PrintPreviewUI {
|
|
@@ -457,7 +457,7 @@ index bcd40171250b5d642ac14fb802f22a17fc1f61ec..5877f7d3c2eb27acf61d9bc03b0a8b98
|
|
|
// Tells the RenderFrame to switch the CSS to print media type, render every
|
|
|
// requested page using the print preview document's frame/node, and then
|
|
|
diff --git a/components/printing/renderer/print_render_frame_helper.cc b/components/printing/renderer/print_render_frame_helper.cc
|
|
|
-index cc147dbfedbb5f16a8527d3720a0d55c73d019ab..ccbbfd297158ce5e696af36eb53fd8ad21ce491f 100644
|
|
|
+index 07c52050b6dd6ebd8dfa06736ec962b889f1c2b7..f78e0a255fdcf4114beb3c7e19efa899424523e9 100644
|
|
|
--- a/components/printing/renderer/print_render_frame_helper.cc
|
|
|
+++ b/components/printing/renderer/print_render_frame_helper.cc
|
|
|
@@ -38,6 +38,7 @@
|
|
@@ -468,7 +468,7 @@ index cc147dbfedbb5f16a8527d3720a0d55c73d019ab..ccbbfd297158ce5e696af36eb53fd8ad
|
|
|
#include "printing/units.h"
|
|
|
#include "third_party/blink/public/common/associated_interfaces/associated_interface_provider.h"
|
|
|
#include "third_party/blink/public/common/associated_interfaces/associated_interface_registry.h"
|
|
|
-@@ -1168,7 +1169,8 @@ void PrintRenderFrameHelper::ScriptedPrint(bool user_initiated) {
|
|
|
+@@ -1174,7 +1175,8 @@ void PrintRenderFrameHelper::ScriptedPrint(bool user_initiated) {
|
|
|
if (!weak_this)
|
|
|
return;
|
|
|
|
|
@@ -478,7 +478,7 @@ index cc147dbfedbb5f16a8527d3720a0d55c73d019ab..ccbbfd297158ce5e696af36eb53fd8ad
|
|
|
|
|
|
if (weak_this)
|
|
|
web_frame->DispatchAfterPrintEvent();
|
|
|
-@@ -1195,7 +1197,7 @@ void PrintRenderFrameHelper::BindPrintRenderFrameReceiver(
|
|
|
+@@ -1201,7 +1203,7 @@ void PrintRenderFrameHelper::BindPrintRenderFrameReceiver(
|
|
|
receivers_.Add(this, std::move(receiver));
|
|
|
}
|
|
|
|
|
@@ -487,7 +487,7 @@ index cc147dbfedbb5f16a8527d3720a0d55c73d019ab..ccbbfd297158ce5e696af36eb53fd8ad
|
|
|
ScopedIPC scoped_ipc(weak_ptr_factory_.GetWeakPtr());
|
|
|
if (ipc_nesting_level_ > 1)
|
|
|
return;
|
|
|
-@@ -1210,7 +1212,7 @@ void PrintRenderFrameHelper::PrintRequestedPages() {
|
|
|
+@@ -1216,7 +1218,7 @@ void PrintRenderFrameHelper::PrintRequestedPages() {
|
|
|
// that instead.
|
|
|
auto plugin = delegate_->GetPdfElement(frame);
|
|
|
|
|
@@ -496,7 +496,7 @@ index cc147dbfedbb5f16a8527d3720a0d55c73d019ab..ccbbfd297158ce5e696af36eb53fd8ad
|
|
|
|
|
|
if (!render_frame_gone_)
|
|
|
frame->DispatchAfterPrintEvent();
|
|
|
-@@ -1229,7 +1231,8 @@ void PrintRenderFrameHelper::PrintForSystemDialog() {
|
|
|
+@@ -1235,7 +1237,8 @@ void PrintRenderFrameHelper::PrintForSystemDialog() {
|
|
|
}
|
|
|
|
|
|
Print(frame, print_preview_context_.source_node(),
|
|
@@ -506,7 +506,7 @@ index cc147dbfedbb5f16a8527d3720a0d55c73d019ab..ccbbfd297158ce5e696af36eb53fd8ad
|
|
|
if (!render_frame_gone_)
|
|
|
print_preview_context_.DispatchAfterPrintEvent();
|
|
|
// WARNING: |this| may be gone at this point. Do not do any more work here and
|
|
|
-@@ -1277,6 +1280,8 @@ void PrintRenderFrameHelper::PrintPreview(base::Value settings) {
|
|
|
+@@ -1283,6 +1286,8 @@ void PrintRenderFrameHelper::PrintPreview(base::Value settings) {
|
|
|
if (ipc_nesting_level_ > 1)
|
|
|
return;
|
|
|
|
|
@@ -515,7 +515,7 @@ index cc147dbfedbb5f16a8527d3720a0d55c73d019ab..ccbbfd297158ce5e696af36eb53fd8ad
|
|
|
print_preview_context_.OnPrintPreview();
|
|
|
|
|
|
if (print_preview_context_.IsForArc()) {
|
|
|
-@@ -1813,7 +1818,8 @@ void PrintRenderFrameHelper::PrintNode(const blink::WebNode& node) {
|
|
|
+@@ -1819,7 +1824,8 @@ void PrintRenderFrameHelper::PrintNode(const blink::WebNode& node) {
|
|
|
return;
|
|
|
|
|
|
Print(duplicate_node.GetDocument().GetFrame(), duplicate_node,
|
|
@@ -525,7 +525,7 @@ index cc147dbfedbb5f16a8527d3720a0d55c73d019ab..ccbbfd297158ce5e696af36eb53fd8ad
|
|
|
// Check if |this| is still valid.
|
|
|
if (!weak_this)
|
|
|
return;
|
|
|
-@@ -1828,7 +1834,9 @@ void PrintRenderFrameHelper::PrintNode(const blink::WebNode& node) {
|
|
|
+@@ -1834,7 +1840,9 @@ void PrintRenderFrameHelper::PrintNode(const blink::WebNode& node) {
|
|
|
|
|
|
void PrintRenderFrameHelper::Print(blink::WebLocalFrame* frame,
|
|
|
const blink::WebNode& node,
|
|
@@ -536,7 +536,7 @@ index cc147dbfedbb5f16a8527d3720a0d55c73d019ab..ccbbfd297158ce5e696af36eb53fd8ad
|
|
|
// If still not finished with earlier print request simply ignore.
|
|
|
if (prep_frame_view_)
|
|
|
return;
|
|
|
-@@ -1836,7 +1844,7 @@ void PrintRenderFrameHelper::Print(blink::WebLocalFrame* frame,
|
|
|
+@@ -1842,7 +1850,7 @@ void PrintRenderFrameHelper::Print(blink::WebLocalFrame* frame,
|
|
|
FrameReference frame_ref(frame);
|
|
|
|
|
|
uint32_t expected_page_count = 0;
|
|
@@ -545,7 +545,7 @@ index cc147dbfedbb5f16a8527d3720a0d55c73d019ab..ccbbfd297158ce5e696af36eb53fd8ad
|
|
|
DidFinishPrinting(FAIL_PRINT_INIT);
|
|
|
return; // Failed to init print page settings.
|
|
|
}
|
|
|
-@@ -1855,10 +1863,41 @@ void PrintRenderFrameHelper::Print(blink::WebLocalFrame* frame,
|
|
|
+@@ -1861,10 +1869,41 @@ void PrintRenderFrameHelper::Print(blink::WebLocalFrame* frame,
|
|
|
print_pages_params_->params->print_scaling_option;
|
|
|
|
|
|
mojom::PrintPagesParams print_settings;
|
|
@@ -590,7 +590,7 @@ index cc147dbfedbb5f16a8527d3720a0d55c73d019ab..ccbbfd297158ce5e696af36eb53fd8ad
|
|
|
// Check if |this| is still valid.
|
|
|
if (!self)
|
|
|
return;
|
|
|
-@@ -2102,7 +2141,9 @@ void PrintRenderFrameHelper::IPCProcessed() {
|
|
|
+@@ -2108,7 +2147,9 @@ void PrintRenderFrameHelper::IPCProcessed() {
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -601,7 +601,7 @@ index cc147dbfedbb5f16a8527d3720a0d55c73d019ab..ccbbfd297158ce5e696af36eb53fd8ad
|
|
|
mojom::PrintPagesParams settings;
|
|
|
settings.params = mojom::PrintParams::New();
|
|
|
GetPrintManagerHost()->GetDefaultPrintSettings(&settings.params);
|
|
|
-@@ -2126,12 +2167,14 @@ bool PrintRenderFrameHelper::InitPrintSettings(bool fit_to_paper_size) {
|
|
|
+@@ -2132,12 +2173,14 @@ bool PrintRenderFrameHelper::InitPrintSettings(bool fit_to_paper_size) {
|
|
|
return result;
|
|
|
}
|
|
|
|
|
@@ -621,10 +621,10 @@ index cc147dbfedbb5f16a8527d3720a0d55c73d019ab..ccbbfd297158ce5e696af36eb53fd8ad
|
|
|
GetPrintManagerHost()->ShowInvalidPrinterSettingsError();
|
|
|
return false;
|
|
|
diff --git a/components/printing/renderer/print_render_frame_helper.h b/components/printing/renderer/print_render_frame_helper.h
|
|
|
-index 78d76aadc206a0922163f87f0575ca0cfe344880..d51fff55ebd5c9d1a39637039b279b491d025b08 100644
|
|
|
+index a874a182e048adf4a6cfb0444b79420b8e0e31bf..8fc1db14a0d6d523a53ac6e47d5107fec5561aaf 100644
|
|
|
--- a/components/printing/renderer/print_render_frame_helper.h
|
|
|
+++ b/components/printing/renderer/print_render_frame_helper.h
|
|
|
-@@ -230,7 +230,7 @@ class PrintRenderFrameHelper
|
|
|
+@@ -231,7 +231,7 @@ class PrintRenderFrameHelper
|
|
|
mojo::PendingAssociatedReceiver<mojom::PrintRenderFrame> receiver);
|
|
|
|
|
|
// printing::mojom::PrintRenderFrame:
|
|
@@ -633,7 +633,7 @@ index 78d76aadc206a0922163f87f0575ca0cfe344880..d51fff55ebd5c9d1a39637039b279b49
|
|
|
void PrintForSystemDialog() override;
|
|
|
#if BUILDFLAG(ENABLE_PRINT_PREVIEW)
|
|
|
void SetPrintPreviewUI(
|
|
|
-@@ -297,7 +297,9 @@ class PrintRenderFrameHelper
|
|
|
+@@ -298,7 +298,9 @@ class PrintRenderFrameHelper
|
|
|
// WARNING: |this| may be gone after this method returns.
|
|
|
void Print(blink::WebLocalFrame* frame,
|
|
|
const blink::WebNode& node,
|
|
@@ -644,7 +644,7 @@ index 78d76aadc206a0922163f87f0575ca0cfe344880..d51fff55ebd5c9d1a39637039b279b49
|
|
|
|
|
|
// Notification when printing is done - signal tear-down/free resources.
|
|
|
void DidFinishPrinting(PrintingResult result);
|
|
|
-@@ -306,12 +308,14 @@ class PrintRenderFrameHelper
|
|
|
+@@ -307,12 +309,14 @@ class PrintRenderFrameHelper
|
|
|
|
|
|
// Initialize print page settings with default settings.
|
|
|
// Used only for native printing workflow.
|
|
@@ -662,7 +662,7 @@ index 78d76aadc206a0922163f87f0575ca0cfe344880..d51fff55ebd5c9d1a39637039b279b49
|
|
|
#if BUILDFLAG(ENABLE_PRINT_PREVIEW)
|
|
|
// Set options for print preset from source PDF document.
|
|
|
diff --git a/printing/printing_context.cc b/printing/printing_context.cc
|
|
|
-index 49e0e83868dc8f4e32eab5b08172f0697552a532..eb8fd82289e6bb370934883c039bdde704604768 100644
|
|
|
+index 92561ff7c6bce6febd8cd2f39f59e3df707f8bdb..241686fa8bdc346f073b5fb92f57c72cfd1be8af 100644
|
|
|
--- a/printing/printing_context.cc
|
|
|
+++ b/printing/printing_context.cc
|
|
|
@@ -96,7 +96,6 @@ PrintingContext::Result PrintingContext::UsePdfSettings() {
|
|
@@ -674,7 +674,7 @@ index 49e0e83868dc8f4e32eab5b08172f0697552a532..eb8fd82289e6bb370934883c039bdde7
|
|
|
std::unique_ptr<PrintSettings> settings =
|
|
|
PrintSettingsFromJobSettings(job_settings);
|
|
|
diff --git a/printing/printing_context.h b/printing/printing_context.h
|
|
|
-index 896d1b26f492862b3ae501ca5b756cfb201d1c75..a3762cb0e222d425359bd803c8406f7a11b59ade 100644
|
|
|
+index 268e03d2b8d4f1c81f6ebe81b44ffa6252f88c4b..1baef8c1d58becf760b1576a2d541810a2f98555 100644
|
|
|
--- a/printing/printing_context.h
|
|
|
+++ b/printing/printing_context.h
|
|
|
@@ -134,12 +134,12 @@ class PRINTING_EXPORT PrintingContext {
|