|
@@ -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/BUILD.gn b/BUILD.gn
|
|
|
-index 32902c0b0c7fa1f1b4371f1bee24c364a4ff89e2..0c9b25af67c7b44b8e839e8839a3ea0ca8b03202 100644
|
|
|
+index 645819d78ca8526340714f05acc9f1819e72c4e3..86f6cfd19586f1d352d6a91c3d76b7323ccf26fe 100644
|
|
|
--- a/BUILD.gn
|
|
|
+++ b/BUILD.gn
|
|
|
-@@ -973,7 +973,6 @@ if (is_win) {
|
|
|
+@@ -987,7 +987,6 @@ if (is_win) {
|
|
|
"//media:media_unittests",
|
|
|
"//media/midi:midi_unittests",
|
|
|
"//net:net_unittests",
|
|
@@ -22,7 +22,7 @@ index 32902c0b0c7fa1f1b4371f1bee24c364a4ff89e2..0c9b25af67c7b44b8e839e8839a3ea0c
|
|
|
"//sql:sql_unittests",
|
|
|
"//third_party/breakpad:symupload($host_toolchain)",
|
|
|
"//ui/base:ui_base_unittests",
|
|
|
-@@ -982,6 +981,10 @@ if (is_win) {
|
|
|
+@@ -996,6 +995,10 @@ if (is_win) {
|
|
|
"//ui/views:views_unittests",
|
|
|
"//url:url_unittests",
|
|
|
]
|
|
@@ -78,7 +78,7 @@ index 331a084371402b5a2440b5d60feac8f0189e84b9..6755d1f497cef4deea6b83df1d8720dc
|
|
|
: PdfRenderSettings::Mode::POSTSCRIPT_LEVEL3;
|
|
|
}
|
|
|
diff --git a/chrome/browser/printing/print_job_worker.cc b/chrome/browser/printing/print_job_worker.cc
|
|
|
-index ab2f824eb77ae4c8a916d57914120544bec70ec5..8eef429cf3ea613e83dc408d93faa8d2661cf5db 100644
|
|
|
+index f0d4596f0e95391e752c48dc6ac12f76397c27f1..b7313ce8037c88aa5b8826dc2edcb0dfa4ebee46 100644
|
|
|
--- a/chrome/browser/printing/print_job_worker.cc
|
|
|
+++ b/chrome/browser/printing/print_job_worker.cc
|
|
|
@@ -20,7 +20,6 @@
|
|
@@ -97,7 +97,7 @@ index ab2f824eb77ae4c8a916d57914120544bec70ec5..8eef429cf3ea613e83dc408d93faa8d2
|
|
|
#include "printing/backend/print_backend.h"
|
|
|
#include "printing/buildflags/buildflags.h"
|
|
|
#include "printing/mojom/print.mojom.h"
|
|
|
-@@ -209,16 +209,19 @@ void PrintJobWorker::SetSettings(base::Value::Dict new_settings,
|
|
|
+@@ -208,16 +208,19 @@ void PrintJobWorker::SetSettings(base::Value::Dict new_settings,
|
|
|
#endif // BUILDFLAG(IS_LINUX) && defined(USE_CUPS)
|
|
|
}
|
|
|
|
|
@@ -134,7 +134,7 @@ index 398d59a0ebad165981e9e96b29ffc672e4b841eb..e420d87ef0e90cddb740ac4b24f92519
|
|
|
|
|
|
void PrintJobWorkerOop::UnregisterServiceManagerClient() {
|
|
|
diff --git a/chrome/browser/printing/print_view_manager_base.cc b/chrome/browser/printing/print_view_manager_base.cc
|
|
|
-index 8a17d3bf5a7fe924d5e562589864747e294931d1..5b270a41efb53bef55cbcb65ca655212b98a2b15 100644
|
|
|
+index 8f4cb7f50dd34c4ef49022242c4b93d703a508a2..d9183b6c1d84a4685f38e84071eb25f26cd28867 100644
|
|
|
--- a/chrome/browser/printing/print_view_manager_base.cc
|
|
|
+++ b/chrome/browser/printing/print_view_manager_base.cc
|
|
|
@@ -30,8 +30,6 @@
|
|
@@ -146,7 +146,7 @@ index 8a17d3bf5a7fe924d5e562589864747e294931d1..5b270a41efb53bef55cbcb65ca655212
|
|
|
#include "chrome/common/pref_names.h"
|
|
|
#include "chrome/grit/generated_resources.h"
|
|
|
#include "components/prefs/pref_service.h"
|
|
|
-@@ -86,10 +84,23 @@ namespace printing {
|
|
|
+@@ -82,10 +80,23 @@ namespace printing {
|
|
|
|
|
|
namespace {
|
|
|
|
|
@@ -170,7 +170,7 @@ index 8a17d3bf5a7fe924d5e562589864747e294931d1..5b270a41efb53bef55cbcb65ca655212
|
|
|
// Runs always on the UI thread.
|
|
|
static bool is_dialog_shown = false;
|
|
|
if (is_dialog_shown)
|
|
|
-@@ -98,6 +109,7 @@ void ShowWarningMessageBox(const std::u16string& message) {
|
|
|
+@@ -94,6 +105,7 @@ void ShowWarningMessageBox(const std::u16string& message) {
|
|
|
base::AutoReset<bool> auto_reset(&is_dialog_shown, true);
|
|
|
|
|
|
chrome::ShowWarningMessageBox(nullptr, std::u16string(), message);
|
|
@@ -178,7 +178,7 @@ index 8a17d3bf5a7fe924d5e562589864747e294931d1..5b270a41efb53bef55cbcb65ca655212
|
|
|
}
|
|
|
|
|
|
void OnDidGetDefaultPrintSettings(
|
|
|
-@@ -147,7 +159,9 @@ void OnDidUpdatePrintSettings(
|
|
|
+@@ -143,7 +155,9 @@ void OnDidUpdatePrintSettings(
|
|
|
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
|
|
|
DCHECK(printer_query);
|
|
|
mojom::PrintPagesParamsPtr params = CreateEmptyPrintPagesParamsPtr();
|
|
@@ -189,7 +189,7 @@ index 8a17d3bf5a7fe924d5e562589864747e294931d1..5b270a41efb53bef55cbcb65ca655212
|
|
|
RenderParamsFromPrintSettings(printer_query->settings(),
|
|
|
params->params.get());
|
|
|
params->params->document_cookie = printer_query->cookie();
|
|
|
-@@ -175,6 +189,7 @@ void OnDidScriptedPrint(
|
|
|
+@@ -171,6 +185,7 @@ void OnDidScriptedPrint(
|
|
|
mojom::PrintManagerHost::ScriptedPrintCallback callback) {
|
|
|
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
|
|
|
mojom::PrintPagesParamsPtr params = CreateEmptyPrintPagesParamsPtr();
|
|
@@ -197,7 +197,7 @@ index 8a17d3bf5a7fe924d5e562589864747e294931d1..5b270a41efb53bef55cbcb65ca655212
|
|
|
if (printer_query->last_status() == mojom::ResultCode::kSuccess &&
|
|
|
printer_query->settings().dpi()) {
|
|
|
RenderParamsFromPrintSettings(printer_query->settings(),
|
|
|
-@@ -184,7 +199,8 @@ void OnDidScriptedPrint(
|
|
|
+@@ -180,7 +195,8 @@ void OnDidScriptedPrint(
|
|
|
}
|
|
|
bool has_valid_cookie = params->params->document_cookie;
|
|
|
bool has_dpi = !params->params->dpi.IsEmpty();
|
|
@@ -207,7 +207,7 @@ index 8a17d3bf5a7fe924d5e562589864747e294931d1..5b270a41efb53bef55cbcb65ca655212
|
|
|
|
|
|
if (has_dpi && has_valid_cookie) {
|
|
|
queue->QueuePrinterQuery(std::move(printer_query));
|
|
|
-@@ -199,12 +215,14 @@ PrintViewManagerBase::PrintViewManagerBase(content::WebContents* web_contents)
|
|
|
+@@ -195,12 +211,14 @@ PrintViewManagerBase::PrintViewManagerBase(content::WebContents* web_contents)
|
|
|
: PrintManager(web_contents),
|
|
|
queue_(g_browser_process->print_job_manager()->queue()) {
|
|
|
DCHECK(queue_);
|
|
@@ -222,7 +222,7 @@ index 8a17d3bf5a7fe924d5e562589864747e294931d1..5b270a41efb53bef55cbcb65ca655212
|
|
|
}
|
|
|
|
|
|
PrintViewManagerBase::~PrintViewManagerBase() {
|
|
|
-@@ -212,7 +230,10 @@ PrintViewManagerBase::~PrintViewManagerBase() {
|
|
|
+@@ -208,7 +226,10 @@ PrintViewManagerBase::~PrintViewManagerBase() {
|
|
|
DisconnectFromCurrentPrintJob();
|
|
|
}
|
|
|
|
|
@@ -234,17 +234,17 @@ index 8a17d3bf5a7fe924d5e562589864747e294931d1..5b270a41efb53bef55cbcb65ca655212
|
|
|
// Remember the ID for `rfh`, to enable checking that the `RenderFrameHost`
|
|
|
// is still valid after a possible inner message loop runs in
|
|
|
// `DisconnectFromCurrentPrintJob()`.
|
|
|
-@@ -240,6 +261,9 @@ bool PrintViewManagerBase::PrintNow(content::RenderFrameHost* rfh) {
|
|
|
+@@ -236,6 +257,9 @@ bool PrintViewManagerBase::PrintNow(content::RenderFrameHost* rfh) {
|
|
|
#endif
|
|
|
|
|
|
SetPrintingRFH(rfh);
|
|
|
+ callback_ = std::move(callback);
|
|
|
+
|
|
|
+ GetPrintRenderFrame(rfh)->PrintRequestedPages(silent, std::move(settings));
|
|
|
-
|
|
|
- #if BUILDFLAG(ENABLE_PRINT_CONTENT_ANALYSIS)
|
|
|
- enterprise_connectors::ContentAnalysisDelegate::Data scanning_data;
|
|
|
-@@ -452,7 +476,8 @@ void PrintViewManagerBase::GetDefaultPrintSettingsReply(
|
|
|
+ CompletePrintNow(rfh);
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+@@ -395,7 +419,8 @@ void PrintViewManagerBase::GetDefaultPrintSettingsReply(
|
|
|
void PrintViewManagerBase::ScriptedPrintReply(
|
|
|
ScriptedPrintCallback callback,
|
|
|
int process_id,
|
|
@@ -254,7 +254,7 @@ index 8a17d3bf5a7fe924d5e562589864747e294931d1..5b270a41efb53bef55cbcb65ca655212
|
|
|
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
|
|
|
|
|
|
#if BUILDFLAG(ENABLE_OOP_PRINTING)
|
|
|
-@@ -467,8 +492,11 @@ void PrintViewManagerBase::ScriptedPrintReply(
|
|
|
+@@ -410,8 +435,11 @@ void PrintViewManagerBase::ScriptedPrintReply(
|
|
|
return;
|
|
|
}
|
|
|
|
|
@@ -267,7 +267,7 @@ index 8a17d3bf5a7fe924d5e562589864747e294931d1..5b270a41efb53bef55cbcb65ca655212
|
|
|
}
|
|
|
|
|
|
void PrintViewManagerBase::UpdatePrintingEnabled() {
|
|
|
-@@ -476,8 +504,7 @@ void PrintViewManagerBase::UpdatePrintingEnabled() {
|
|
|
+@@ -419,8 +447,7 @@ void PrintViewManagerBase::UpdatePrintingEnabled() {
|
|
|
// The Unretained() is safe because ForEachRenderFrameHost() is synchronous.
|
|
|
web_contents()->GetPrimaryMainFrame()->ForEachRenderFrameHost(
|
|
|
base::BindRepeating(&PrintViewManagerBase::SendPrintingEnabled,
|
|
@@ -277,7 +277,7 @@ index 8a17d3bf5a7fe924d5e562589864747e294931d1..5b270a41efb53bef55cbcb65ca655212
|
|
|
}
|
|
|
|
|
|
void PrintViewManagerBase::NavigationStopped() {
|
|
|
-@@ -593,11 +620,14 @@ void PrintViewManagerBase::DidPrintDocument(
|
|
|
+@@ -536,11 +563,14 @@ void PrintViewManagerBase::DidPrintDocument(
|
|
|
void PrintViewManagerBase::GetDefaultPrintSettings(
|
|
|
GetDefaultPrintSettingsCallback callback) {
|
|
|
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
|
|
@@ -292,7 +292,7 @@ index 8a17d3bf5a7fe924d5e562589864747e294931d1..5b270a41efb53bef55cbcb65ca655212
|
|
|
#if BUILDFLAG(ENABLE_OOP_PRINTING)
|
|
|
if (printing::features::kEnableOopPrintDriversJobPrint.Get() &&
|
|
|
!service_manager_client_id_.has_value()) {
|
|
|
-@@ -635,18 +665,20 @@ void PrintViewManagerBase::UpdatePrintSettings(
|
|
|
+@@ -578,18 +608,20 @@ void PrintViewManagerBase::UpdatePrintSettings(
|
|
|
base::Value::Dict job_settings,
|
|
|
UpdatePrintSettingsCallback callback) {
|
|
|
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
|
|
@@ -314,7 +314,7 @@ index 8a17d3bf5a7fe924d5e562589864747e294931d1..5b270a41efb53bef55cbcb65ca655212
|
|
|
content::BrowserContext* context =
|
|
|
web_contents() ? web_contents()->GetBrowserContext() : nullptr;
|
|
|
PrefService* prefs =
|
|
|
-@@ -656,6 +688,7 @@ void PrintViewManagerBase::UpdatePrintSettings(
|
|
|
+@@ -599,6 +631,7 @@ void PrintViewManagerBase::UpdatePrintSettings(
|
|
|
if (value > 0)
|
|
|
job_settings.Set(kSettingRasterizePdfDpi, value);
|
|
|
}
|
|
@@ -322,7 +322,7 @@ index 8a17d3bf5a7fe924d5e562589864747e294931d1..5b270a41efb53bef55cbcb65ca655212
|
|
|
|
|
|
auto callback_wrapper =
|
|
|
base::BindOnce(&PrintViewManagerBase::UpdatePrintSettingsReply,
|
|
|
-@@ -687,14 +720,14 @@ void PrintViewManagerBase::ScriptedPrint(mojom::ScriptedPrintParamsPtr params,
|
|
|
+@@ -630,14 +663,14 @@ void PrintViewManagerBase::ScriptedPrint(mojom::ScriptedPrintParamsPtr params,
|
|
|
// didn't happen for some reason.
|
|
|
bad_message::ReceivedBadMessage(
|
|
|
render_process_host, bad_message::PVMB_SCRIPTED_PRINT_FENCED_FRAME);
|
|
@@ -339,7 +339,7 @@ index 8a17d3bf5a7fe924d5e562589864747e294931d1..5b270a41efb53bef55cbcb65ca655212
|
|
|
return;
|
|
|
}
|
|
|
#endif
|
|
|
-@@ -732,7 +765,6 @@ void PrintViewManagerBase::PrintingFailed(int32_t cookie,
|
|
|
+@@ -675,7 +708,6 @@ void PrintViewManagerBase::PrintingFailed(int32_t cookie,
|
|
|
PrintManager::PrintingFailed(cookie, reason);
|
|
|
|
|
|
#if !BUILDFLAG(IS_ANDROID) // Android does not implement this function.
|
|
@@ -347,7 +347,7 @@ index 8a17d3bf5a7fe924d5e562589864747e294931d1..5b270a41efb53bef55cbcb65ca655212
|
|
|
#endif
|
|
|
|
|
|
ReleasePrinterQuery();
|
|
|
-@@ -747,6 +779,11 @@ void PrintViewManagerBase::RemoveObserver(Observer& observer) {
|
|
|
+@@ -690,6 +722,11 @@ void PrintViewManagerBase::RemoveObserver(Observer& observer) {
|
|
|
}
|
|
|
|
|
|
void PrintViewManagerBase::ShowInvalidPrinterSettingsError() {
|
|
@@ -359,7 +359,7 @@ index 8a17d3bf5a7fe924d5e562589864747e294931d1..5b270a41efb53bef55cbcb65ca655212
|
|
|
base::ThreadTaskRunnerHandle::Get()->PostTask(
|
|
|
FROM_HERE, base::BindOnce(&ShowWarningMessageBox,
|
|
|
l10n_util::GetStringUTF16(
|
|
|
-@@ -757,10 +794,12 @@ void PrintViewManagerBase::RenderFrameHostStateChanged(
|
|
|
+@@ -700,10 +737,12 @@ void PrintViewManagerBase::RenderFrameHostStateChanged(
|
|
|
content::RenderFrameHost* render_frame_host,
|
|
|
content::RenderFrameHost::LifecycleState /*old_state*/,
|
|
|
content::RenderFrameHost::LifecycleState new_state) {
|
|
@@ -372,7 +372,7 @@ index 8a17d3bf5a7fe924d5e562589864747e294931d1..5b270a41efb53bef55cbcb65ca655212
|
|
|
}
|
|
|
|
|
|
void PrintViewManagerBase::DidStartLoading() {
|
|
|
-@@ -821,7 +860,12 @@ void PrintViewManagerBase::OnJobDone() {
|
|
|
+@@ -759,7 +798,12 @@ void PrintViewManagerBase::OnJobDone() {
|
|
|
// Printing is done, we don't need it anymore.
|
|
|
// print_job_->is_job_pending() may still be true, depending on the order
|
|
|
// of object registration.
|
|
@@ -386,7 +386,7 @@ index 8a17d3bf5a7fe924d5e562589864747e294931d1..5b270a41efb53bef55cbcb65ca655212
|
|
|
ReleasePrintJob();
|
|
|
}
|
|
|
|
|
|
-@@ -835,7 +879,7 @@ bool PrintViewManagerBase::RenderAllMissingPagesNow() {
|
|
|
+@@ -773,7 +817,7 @@ bool PrintViewManagerBase::RenderAllMissingPagesNow() {
|
|
|
|
|
|
// Is the document already complete?
|
|
|
if (print_job_->document() && print_job_->document()->IsComplete()) {
|
|
@@ -395,7 +395,7 @@ index 8a17d3bf5a7fe924d5e562589864747e294931d1..5b270a41efb53bef55cbcb65ca655212
|
|
|
return true;
|
|
|
}
|
|
|
|
|
|
-@@ -883,7 +927,10 @@ bool PrintViewManagerBase::CreateNewPrintJob(
|
|
|
+@@ -821,7 +865,10 @@ bool PrintViewManagerBase::CreateNewPrintJob(
|
|
|
|
|
|
// Disconnect the current `print_job_`.
|
|
|
auto weak_this = weak_ptr_factory_.GetWeakPtr();
|
|
@@ -407,7 +407,7 @@ index 8a17d3bf5a7fe924d5e562589864747e294931d1..5b270a41efb53bef55cbcb65ca655212
|
|
|
if (!weak_this)
|
|
|
return false;
|
|
|
|
|
|
-@@ -904,7 +951,7 @@ bool PrintViewManagerBase::CreateNewPrintJob(
|
|
|
+@@ -842,7 +889,7 @@ bool PrintViewManagerBase::CreateNewPrintJob(
|
|
|
#endif
|
|
|
print_job_->AddObserver(*this);
|
|
|
|
|
@@ -416,7 +416,7 @@ index 8a17d3bf5a7fe924d5e562589864747e294931d1..5b270a41efb53bef55cbcb65ca655212
|
|
|
return true;
|
|
|
}
|
|
|
|
|
|
-@@ -964,6 +1011,11 @@ void PrintViewManagerBase::ReleasePrintJob() {
|
|
|
+@@ -902,6 +949,11 @@ void PrintViewManagerBase::ReleasePrintJob() {
|
|
|
}
|
|
|
#endif
|
|
|
|
|
@@ -428,7 +428,7 @@ index 8a17d3bf5a7fe924d5e562589864747e294931d1..5b270a41efb53bef55cbcb65ca655212
|
|
|
if (!print_job_)
|
|
|
return;
|
|
|
|
|
|
-@@ -971,7 +1023,7 @@ void PrintViewManagerBase::ReleasePrintJob() {
|
|
|
+@@ -909,7 +961,7 @@ void PrintViewManagerBase::ReleasePrintJob() {
|
|
|
// printing_rfh_ should only ever point to a RenderFrameHost with a live
|
|
|
// RenderFrame.
|
|
|
DCHECK(rfh->IsRenderFrameLive());
|
|
@@ -437,7 +437,7 @@ index 8a17d3bf5a7fe924d5e562589864747e294931d1..5b270a41efb53bef55cbcb65ca655212
|
|
|
}
|
|
|
|
|
|
print_job_->RemoveObserver(*this);
|
|
|
-@@ -1013,7 +1065,7 @@ bool PrintViewManagerBase::RunInnerMessageLoop() {
|
|
|
+@@ -951,7 +1003,7 @@ bool PrintViewManagerBase::RunInnerMessageLoop() {
|
|
|
}
|
|
|
|
|
|
bool PrintViewManagerBase::OpportunisticallyCreatePrintJob(int cookie) {
|
|
@@ -446,7 +446,7 @@ index 8a17d3bf5a7fe924d5e562589864747e294931d1..5b270a41efb53bef55cbcb65ca655212
|
|
|
return true;
|
|
|
|
|
|
if (!cookie) {
|
|
|
-@@ -1121,7 +1173,7 @@ void PrintViewManagerBase::SendPrintingEnabled(bool enabled,
|
|
|
+@@ -1059,7 +1111,7 @@ void PrintViewManagerBase::SendPrintingEnabled(bool enabled,
|
|
|
}
|
|
|
|
|
|
void PrintViewManagerBase::CompletePrintNow(content::RenderFrameHost* rfh) {
|
|
@@ -456,10 +456,10 @@ index 8a17d3bf5a7fe924d5e562589864747e294931d1..5b270a41efb53bef55cbcb65ca655212
|
|
|
for (auto& observer : GetObservers())
|
|
|
observer.OnPrintNow(rfh);
|
|
|
diff --git a/chrome/browser/printing/print_view_manager_base.h b/chrome/browser/printing/print_view_manager_base.h
|
|
|
-index f146d74541cae93a957c5b2596a005e25c20f7cf..120f2bb8b27f814c4f7dc93cef7fb187845e6a75 100644
|
|
|
+index 871e00c49028ccf58d207f904c22e0107f3c2b65..c9b136ab165410eb533f84254454dac0b6674f14 100644
|
|
|
--- a/chrome/browser/printing/print_view_manager_base.h
|
|
|
+++ b/chrome/browser/printing/print_view_manager_base.h
|
|
|
-@@ -43,6 +43,8 @@ namespace printing {
|
|
|
+@@ -42,6 +42,8 @@ namespace printing {
|
|
|
class PrintQueriesQueue;
|
|
|
class PrinterQuery;
|
|
|
|
|
@@ -468,7 +468,7 @@ index f146d74541cae93a957c5b2596a005e25c20f7cf..120f2bb8b27f814c4f7dc93cef7fb187
|
|
|
// Base class for managing the print commands for a WebContents.
|
|
|
class PrintViewManagerBase : public PrintManager, public PrintJob::Observer {
|
|
|
public:
|
|
|
-@@ -70,7 +72,10 @@ class PrintViewManagerBase : public PrintManager, public PrintJob::Observer {
|
|
|
+@@ -65,7 +67,10 @@ class PrintViewManagerBase : public PrintManager, public PrintJob::Observer {
|
|
|
// Prints the current document immediately. Since the rendering is
|
|
|
// asynchronous, the actual printing will not be completed on the return of
|
|
|
// this function. Returns false if printing is impossible at the moment.
|
|
@@ -480,7 +480,7 @@ index f146d74541cae93a957c5b2596a005e25c20f7cf..120f2bb8b27f814c4f7dc93cef7fb187
|
|
|
|
|
|
#if BUILDFLAG(ENABLE_PRINT_PREVIEW)
|
|
|
// Prints the document in `print_data` with settings specified in
|
|
|
-@@ -128,6 +133,7 @@ class PrintViewManagerBase : public PrintManager, public PrintJob::Observer {
|
|
|
+@@ -123,6 +128,7 @@ class PrintViewManagerBase : public PrintManager, public PrintJob::Observer {
|
|
|
void ShowInvalidPrinterSettingsError() override;
|
|
|
void PrintingFailed(int32_t cookie,
|
|
|
mojom::PrintFailureReason reason) override;
|
|
@@ -488,7 +488,7 @@ index f146d74541cae93a957c5b2596a005e25c20f7cf..120f2bb8b27f814c4f7dc93cef7fb187
|
|
|
|
|
|
// Adds and removes observers for `PrintViewManagerBase` events. The order in
|
|
|
// which notifications are sent to observers is undefined. Observers must be
|
|
|
-@@ -135,6 +141,14 @@ class PrintViewManagerBase : public PrintManager, public PrintJob::Observer {
|
|
|
+@@ -130,6 +136,14 @@ class PrintViewManagerBase : public PrintManager, public PrintJob::Observer {
|
|
|
void AddObserver(Observer& observer);
|
|
|
void RemoveObserver(Observer& observer);
|
|
|
|
|
@@ -503,7 +503,7 @@ index f146d74541cae93a957c5b2596a005e25c20f7cf..120f2bb8b27f814c4f7dc93cef7fb187
|
|
|
protected:
|
|
|
explicit PrintViewManagerBase(content::WebContents* web_contents);
|
|
|
|
|
|
-@@ -256,7 +270,8 @@ class PrintViewManagerBase : public PrintManager, public PrintJob::Observer {
|
|
|
+@@ -251,7 +265,8 @@ class PrintViewManagerBase : public PrintManager, public PrintJob::Observer {
|
|
|
// Runs `callback` with `params` to reply to ScriptedPrint().
|
|
|
void ScriptedPrintReply(ScriptedPrintCallback callback,
|
|
|
int process_id,
|
|
@@ -513,7 +513,7 @@ index f146d74541cae93a957c5b2596a005e25c20f7cf..120f2bb8b27f814c4f7dc93cef7fb187
|
|
|
|
|
|
// Requests the RenderView to render all the missing pages for the print job.
|
|
|
// No-op if no print job is pending. Returns true if at least one page has
|
|
|
-@@ -336,8 +351,11 @@ class PrintViewManagerBase : public PrintManager, public PrintJob::Observer {
|
|
|
+@@ -324,8 +339,11 @@ class PrintViewManagerBase : public PrintManager, public PrintJob::Observer {
|
|
|
// The current RFH that is printing with a system printing dialog.
|
|
|
raw_ptr<content::RenderFrameHost> printing_rfh_ = nullptr;
|
|
|
|
|
@@ -575,7 +575,7 @@ index 95d9f19082978772297cff1bcd9c5f73db50bd62..96fe7fbb54fe0908e2153d901c130b6a
|
|
|
// Tells the browser that there are invalid printer settings.
|
|
|
ShowInvalidPrinterSettingsError();
|
|
|
diff --git a/components/printing/renderer/print_render_frame_helper.cc b/components/printing/renderer/print_render_frame_helper.cc
|
|
|
-index fe8cd8bc27b1e955b177c7952ccb862faf0f228b..d5a2a9a8452b925a693335547d193a86bc0e0f90 100644
|
|
|
+index 2331b4db94bb6397616dc230498960860554787f..ade741255b9e0274252121ecc2ec68697429c8ad 100644
|
|
|
--- a/components/printing/renderer/print_render_frame_helper.cc
|
|
|
+++ b/components/printing/renderer/print_render_frame_helper.cc
|
|
|
@@ -42,6 +42,7 @@
|
|
@@ -586,7 +586,7 @@ index fe8cd8bc27b1e955b177c7952ccb862faf0f228b..d5a2a9a8452b925a693335547d193a86
|
|
|
#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"
|
|
|
-@@ -1282,7 +1283,8 @@ void PrintRenderFrameHelper::ScriptedPrint(bool user_initiated) {
|
|
|
+@@ -1283,7 +1284,8 @@ void PrintRenderFrameHelper::ScriptedPrint(bool user_initiated) {
|
|
|
if (!weak_this)
|
|
|
return;
|
|
|
|
|
@@ -596,7 +596,7 @@ index fe8cd8bc27b1e955b177c7952ccb862faf0f228b..d5a2a9a8452b925a693335547d193a86
|
|
|
if (!weak_this)
|
|
|
return;
|
|
|
|
|
|
-@@ -1313,7 +1315,7 @@ void PrintRenderFrameHelper::BindPrintRenderFrameReceiver(
|
|
|
+@@ -1314,7 +1316,7 @@ void PrintRenderFrameHelper::BindPrintRenderFrameReceiver(
|
|
|
receivers_.Add(this, std::move(receiver));
|
|
|
}
|
|
|
|
|
@@ -605,7 +605,7 @@ index fe8cd8bc27b1e955b177c7952ccb862faf0f228b..d5a2a9a8452b925a693335547d193a86
|
|
|
ScopedIPC scoped_ipc(weak_ptr_factory_.GetWeakPtr());
|
|
|
if (ipc_nesting_level_ > kAllowedIpcDepthForPrint)
|
|
|
return;
|
|
|
-@@ -1328,7 +1330,7 @@ void PrintRenderFrameHelper::PrintRequestedPages() {
|
|
|
+@@ -1329,7 +1331,7 @@ void PrintRenderFrameHelper::PrintRequestedPages() {
|
|
|
// plugin node and print that instead.
|
|
|
auto plugin = delegate_->GetPdfElement(frame);
|
|
|
|
|
@@ -614,7 +614,7 @@ index fe8cd8bc27b1e955b177c7952ccb862faf0f228b..d5a2a9a8452b925a693335547d193a86
|
|
|
|
|
|
if (!render_frame_gone_)
|
|
|
frame->DispatchAfterPrintEvent();
|
|
|
-@@ -1405,7 +1407,8 @@ void PrintRenderFrameHelper::PrintForSystemDialog() {
|
|
|
+@@ -1406,7 +1408,8 @@ void PrintRenderFrameHelper::PrintForSystemDialog() {
|
|
|
}
|
|
|
|
|
|
Print(frame, print_preview_context_.source_node(),
|
|
@@ -624,7 +624,7 @@ index fe8cd8bc27b1e955b177c7952ccb862faf0f228b..d5a2a9a8452b925a693335547d193a86
|
|
|
if (!render_frame_gone_)
|
|
|
print_preview_context_.DispatchAfterPrintEvent();
|
|
|
// WARNING: |this| may be gone at this point. Do not do any more work here and
|
|
|
-@@ -1454,6 +1457,8 @@ void PrintRenderFrameHelper::PrintPreview(base::Value::Dict settings) {
|
|
|
+@@ -1455,6 +1458,8 @@ void PrintRenderFrameHelper::PrintPreview(base::Value::Dict settings) {
|
|
|
if (ipc_nesting_level_ > kAllowedIpcDepthForPrint)
|
|
|
return;
|
|
|
|
|
@@ -633,7 +633,7 @@ index fe8cd8bc27b1e955b177c7952ccb862faf0f228b..d5a2a9a8452b925a693335547d193a86
|
|
|
print_preview_context_.OnPrintPreview();
|
|
|
|
|
|
#if BUILDFLAG(IS_CHROMEOS_ASH)
|
|
|
-@@ -2066,7 +2071,8 @@ void PrintRenderFrameHelper::PrintNode(const blink::WebNode& node) {
|
|
|
+@@ -2067,7 +2072,8 @@ void PrintRenderFrameHelper::PrintNode(const blink::WebNode& node) {
|
|
|
return;
|
|
|
|
|
|
Print(duplicate_node.GetDocument().GetFrame(), duplicate_node,
|
|
@@ -643,7 +643,7 @@ index fe8cd8bc27b1e955b177c7952ccb862faf0f228b..d5a2a9a8452b925a693335547d193a86
|
|
|
// Check if |this| is still valid.
|
|
|
if (!weak_this)
|
|
|
return;
|
|
|
-@@ -2081,7 +2087,9 @@ void PrintRenderFrameHelper::PrintNode(const blink::WebNode& node) {
|
|
|
+@@ -2082,7 +2088,9 @@ void PrintRenderFrameHelper::PrintNode(const blink::WebNode& node) {
|
|
|
|
|
|
void PrintRenderFrameHelper::Print(blink::WebLocalFrame* frame,
|
|
|
const blink::WebNode& node,
|
|
@@ -654,7 +654,7 @@ index fe8cd8bc27b1e955b177c7952ccb862faf0f228b..d5a2a9a8452b925a693335547d193a86
|
|
|
// If still not finished with earlier print request simply ignore.
|
|
|
if (prep_frame_view_)
|
|
|
return;
|
|
|
-@@ -2089,7 +2097,7 @@ void PrintRenderFrameHelper::Print(blink::WebLocalFrame* frame,
|
|
|
+@@ -2090,7 +2098,7 @@ void PrintRenderFrameHelper::Print(blink::WebLocalFrame* frame,
|
|
|
FrameReference frame_ref(frame);
|
|
|
|
|
|
uint32_t expected_page_count = 0;
|
|
@@ -663,7 +663,7 @@ index fe8cd8bc27b1e955b177c7952ccb862faf0f228b..d5a2a9a8452b925a693335547d193a86
|
|
|
DidFinishPrinting(FAIL_PRINT_INIT);
|
|
|
return; // Failed to init print page settings.
|
|
|
}
|
|
|
-@@ -2108,8 +2116,15 @@ void PrintRenderFrameHelper::Print(blink::WebLocalFrame* frame,
|
|
|
+@@ -2109,8 +2117,15 @@ void PrintRenderFrameHelper::Print(blink::WebLocalFrame* frame,
|
|
|
print_pages_params_->params->print_scaling_option;
|
|
|
|
|
|
auto self = weak_ptr_factory_.GetWeakPtr();
|
|
@@ -680,7 +680,7 @@ index fe8cd8bc27b1e955b177c7952ccb862faf0f228b..d5a2a9a8452b925a693335547d193a86
|
|
|
// Check if |this| is still valid.
|
|
|
if (!self)
|
|
|
return;
|
|
|
-@@ -2374,36 +2389,52 @@ void PrintRenderFrameHelper::IPCProcessed() {
|
|
|
+@@ -2375,36 +2390,52 @@ void PrintRenderFrameHelper::IPCProcessed() {
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -745,7 +745,7 @@ index fe8cd8bc27b1e955b177c7952ccb862faf0f228b..d5a2a9a8452b925a693335547d193a86
|
|
|
notify_browser_of_print_failure_ = false;
|
|
|
GetPrintManagerHost()->ShowInvalidPrinterSettingsError();
|
|
|
return false;
|
|
|
-@@ -2528,7 +2559,7 @@ mojom::PrintPagesParamsPtr PrintRenderFrameHelper::GetPrintSettingsFromUser(
|
|
|
+@@ -2529,7 +2560,7 @@ mojom::PrintPagesParamsPtr PrintRenderFrameHelper::GetPrintSettingsFromUser(
|
|
|
std::move(params),
|
|
|
base::BindOnce(
|
|
|
[](base::OnceClosure quit_closure, mojom::PrintPagesParamsPtr* output,
|
|
@@ -796,10 +796,10 @@ index 66026548181a897c161d7202646f33fd8847ccb8..113a8165b5db6294087773e5a4b2f003
|
|
|
#if BUILDFLAG(ENABLE_PRINT_PREVIEW)
|
|
|
// Set options for print preset from source PDF document.
|
|
|
diff --git a/content/browser/BUILD.gn b/content/browser/BUILD.gn
|
|
|
-index 0704a34a2fc4afdf618004d5bee69a7777cc3491..47edb94bd9078364fb03f35849b389a6b2992922 100644
|
|
|
+index 993ec8acd401d5ccb1e07652c28f6f0a1d89c6bc..638dbd46cb572274a17b0c06ed3db0cf7b614b7f 100644
|
|
|
--- a/content/browser/BUILD.gn
|
|
|
+++ b/content/browser/BUILD.gn
|
|
|
-@@ -2783,8 +2783,9 @@ source_set("browser") {
|
|
|
+@@ -2802,8 +2802,9 @@ source_set("browser") {
|
|
|
"//ppapi/shared_impl",
|
|
|
]
|
|
|
|
|
@@ -812,7 +812,7 @@ index 0704a34a2fc4afdf618004d5bee69a7777cc3491..47edb94bd9078364fb03f35849b389a6
|
|
|
if (is_chromeos) {
|
|
|
sources += [
|
|
|
diff --git a/content/browser/utility_sandbox_delegate_win.cc b/content/browser/utility_sandbox_delegate_win.cc
|
|
|
-index 2ae5fc805ccbd81448d3b9d5aa482bcfd7a747f8..b2ed764463f977bd242d9da79270244062c210d6 100644
|
|
|
+index e7f5b062791f6b2b94943c88d487757f2d77c7c5..f69ed3d412caa7254cfbea85a5448770a42b537d 100644
|
|
|
--- a/content/browser/utility_sandbox_delegate_win.cc
|
|
|
+++ b/content/browser/utility_sandbox_delegate_win.cc
|
|
|
@@ -95,6 +95,7 @@ bool NetworkPreSpawnTarget(sandbox::TargetPolicy* policy) {
|
|
@@ -828,9 +828,9 @@ index 2ae5fc805ccbd81448d3b9d5aa482bcfd7a747f8..b2ed764463f977bd242d9da792702440
|
|
|
return true;
|
|
|
}
|
|
|
+#endif
|
|
|
- } // namespace
|
|
|
|
|
|
- std::string UtilitySandboxedProcessLauncherDelegate::GetSandboxTag() {
|
|
|
+ std::string UtilityAppContainerId(base::CommandLine& cmd_line) {
|
|
|
+ return base::WideToUTF8(cmd_line.GetProgram().value());
|
|
|
diff --git a/printing/printing_context.cc b/printing/printing_context.cc
|
|
|
index 6cca846b9831da669ca52aff776caf5a23f6f4d1..39d1032f276181a535de9fba89c2246c7a9814d7 100644
|
|
|
--- a/printing/printing_context.cc
|