|
@@ -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 9149a891ee2b116fd07dcbadfb64156c5a6cd469..7d0742834c77cfe26e747c8043c5d92d1390833a 100644
|
|
|
+index cf98951ce66478e0ceaf12c60daded5af599014f..1450cf3adc59d4ef7c3cce7d46ea4b16ef5e4bf7 100644
|
|
|
--- a/BUILD.gn
|
|
|
+++ b/BUILD.gn
|
|
|
-@@ -971,7 +971,6 @@ if (is_win) {
|
|
|
+@@ -965,7 +965,6 @@ if (is_win) {
|
|
|
"//media:media_unittests",
|
|
|
"//media/midi:midi_unittests",
|
|
|
"//net:net_unittests",
|
|
@@ -22,7 +22,7 @@ index 9149a891ee2b116fd07dcbadfb64156c5a6cd469..7d0742834c77cfe26e747c8043c5d92d
|
|
|
"//sql:sql_unittests",
|
|
|
"//third_party/breakpad:symupload($host_toolchain)",
|
|
|
"//ui/base:ui_base_unittests",
|
|
|
-@@ -980,6 +979,10 @@ if (is_win) {
|
|
|
+@@ -974,6 +973,10 @@ if (is_win) {
|
|
|
"//ui/views:views_unittests",
|
|
|
"//url:url_unittests",
|
|
|
]
|
|
@@ -121,7 +121,7 @@ index d17376917f4d8f5740b265a00e748929cbade643..f8c89a491c9b27e03d19327761c21bd1
|
|
|
|
|
|
#if BUILDFLAG(IS_CHROMEOS)
|
|
|
diff --git a/chrome/browser/printing/print_view_manager_base.cc b/chrome/browser/printing/print_view_manager_base.cc
|
|
|
-index 331eb8e86b3b9f0a92a002f231e4c918c10a0107..843feb1915ae461593b06393cdd4d8b6ad43ee56 100644
|
|
|
+index 0cd52f9e25177831d02911b60ce267e07f8ee79e..2317ef7f3884c34ac7f2bd815a5b16196294e553 100644
|
|
|
--- a/chrome/browser/printing/print_view_manager_base.cc
|
|
|
+++ b/chrome/browser/printing/print_view_manager_base.cc
|
|
|
@@ -29,8 +29,6 @@
|
|
@@ -253,7 +253,7 @@ index 331eb8e86b3b9f0a92a002f231e4c918c10a0107..843feb1915ae461593b06393cdd4d8b6
|
|
|
}
|
|
|
|
|
|
void PrintViewManagerBase::NavigationStopped() {
|
|
|
-@@ -533,11 +561,14 @@ void PrintViewManagerBase::DidPrintDocument(
|
|
|
+@@ -542,11 +570,14 @@ void PrintViewManagerBase::DidPrintDocument(
|
|
|
void PrintViewManagerBase::GetDefaultPrintSettings(
|
|
|
GetDefaultPrintSettingsCallback callback) {
|
|
|
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
|
|
@@ -267,8 +267,8 @@ index 331eb8e86b3b9f0a92a002f231e4c918c10a0107..843feb1915ae461593b06393cdd4d8b6
|
|
|
+#endif
|
|
|
#if BUILDFLAG(ENABLE_OOP_PRINTING)
|
|
|
if (printing::features::kEnableOopPrintDriversJobPrint.Get() &&
|
|
|
- !service_manager_client_id_.has_value()) {
|
|
|
-@@ -583,18 +614,20 @@ void PrintViewManagerBase::UpdatePrintSettings(
|
|
|
+ #if BUILDFLAG(ENABLE_PRINT_CONTENT_ANALYSIS)
|
|
|
+@@ -595,18 +626,20 @@ void PrintViewManagerBase::UpdatePrintSettings(
|
|
|
base::Value::Dict job_settings,
|
|
|
UpdatePrintSettingsCallback callback) {
|
|
|
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
|
|
@@ -290,7 +290,7 @@ index 331eb8e86b3b9f0a92a002f231e4c918c10a0107..843feb1915ae461593b06393cdd4d8b6
|
|
|
content::BrowserContext* context =
|
|
|
web_contents() ? web_contents()->GetBrowserContext() : nullptr;
|
|
|
PrefService* prefs =
|
|
|
-@@ -604,6 +637,7 @@ void PrintViewManagerBase::UpdatePrintSettings(
|
|
|
+@@ -616,6 +649,7 @@ void PrintViewManagerBase::UpdatePrintSettings(
|
|
|
if (value > 0)
|
|
|
job_settings.Set(kSettingRasterizePdfDpi, value);
|
|
|
}
|
|
@@ -298,7 +298,7 @@ index 331eb8e86b3b9f0a92a002f231e4c918c10a0107..843feb1915ae461593b06393cdd4d8b6
|
|
|
|
|
|
auto callback_wrapper =
|
|
|
base::BindOnce(&PrintViewManagerBase::UpdatePrintSettingsReply,
|
|
|
-@@ -641,14 +675,14 @@ void PrintViewManagerBase::ScriptedPrint(mojom::ScriptedPrintParamsPtr params,
|
|
|
+@@ -653,14 +687,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);
|
|
@@ -315,15 +315,16 @@ index 331eb8e86b3b9f0a92a002f231e4c918c10a0107..843feb1915ae461593b06393cdd4d8b6
|
|
|
return;
|
|
|
}
|
|
|
#endif
|
|
|
-@@ -687,7 +721,6 @@ void PrintViewManagerBase::PrintingFailed(int32_t cookie,
|
|
|
- PrintManager::PrintingFailed(cookie, reason);
|
|
|
+@@ -698,7 +732,7 @@ void PrintViewManagerBase::PrintingFailed(int32_t cookie,
|
|
|
|
|
|
- #if !BUILDFLAG(IS_ANDROID) // Android does not implement this function.
|
|
|
-- ShowPrintErrorDialog();
|
|
|
- #endif
|
|
|
+ PrintManager::PrintingFailed(cookie, reason);
|
|
|
|
|
|
- ReleasePrinterQuery();
|
|
|
-@@ -702,6 +735,11 @@ void PrintViewManagerBase::RemoveObserver(Observer& observer) {
|
|
|
+-#if !BUILDFLAG(IS_ANDROID) // Android does not implement this function.
|
|
|
++#if 0 // Electron does not implement this function.
|
|
|
+ // `PrintingFailed()` can occur because asynchronous compositing results
|
|
|
+ // don't complete until after a print job has already failed and been
|
|
|
+ // destroyed. In such cases the error notification to the user will
|
|
|
+@@ -722,6 +756,11 @@ void PrintViewManagerBase::RemoveObserver(Observer& observer) {
|
|
|
}
|
|
|
|
|
|
void PrintViewManagerBase::ShowInvalidPrinterSettingsError() {
|
|
@@ -335,7 +336,7 @@ index 331eb8e86b3b9f0a92a002f231e4c918c10a0107..843feb1915ae461593b06393cdd4d8b6
|
|
|
base::SingleThreadTaskRunner::GetCurrentDefault()->PostTask(
|
|
|
FROM_HERE, base::BindOnce(&ShowWarningMessageBox,
|
|
|
l10n_util::GetStringUTF16(
|
|
|
-@@ -712,11 +750,13 @@ void PrintViewManagerBase::RenderFrameHostStateChanged(
|
|
|
+@@ -732,11 +771,13 @@ void PrintViewManagerBase::RenderFrameHostStateChanged(
|
|
|
content::RenderFrameHost* render_frame_host,
|
|
|
content::RenderFrameHost::LifecycleState /*old_state*/,
|
|
|
content::RenderFrameHost::LifecycleState new_state) {
|
|
@@ -349,7 +350,7 @@ index 331eb8e86b3b9f0a92a002f231e4c918c10a0107..843feb1915ae461593b06393cdd4d8b6
|
|
|
}
|
|
|
|
|
|
void PrintViewManagerBase::RenderFrameDeleted(
|
|
|
-@@ -768,14 +808,20 @@ void PrintViewManagerBase::OnJobDone() {
|
|
|
+@@ -788,14 +829,20 @@ 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.
|
|
@@ -373,7 +374,7 @@ index 331eb8e86b3b9f0a92a002f231e4c918c10a0107..843feb1915ae461593b06393cdd4d8b6
|
|
|
#endif
|
|
|
|
|
|
TerminatePrintJob(true);
|
|
|
-@@ -787,7 +833,7 @@ bool PrintViewManagerBase::RenderAllMissingPagesNow() {
|
|
|
+@@ -807,7 +854,7 @@ bool PrintViewManagerBase::RenderAllMissingPagesNow() {
|
|
|
|
|
|
// Is the document already complete?
|
|
|
if (print_job_->document() && print_job_->document()->IsComplete()) {
|
|
@@ -382,7 +383,7 @@ index 331eb8e86b3b9f0a92a002f231e4c918c10a0107..843feb1915ae461593b06393cdd4d8b6
|
|
|
return true;
|
|
|
}
|
|
|
|
|
|
-@@ -835,7 +881,10 @@ bool PrintViewManagerBase::CreateNewPrintJob(
|
|
|
+@@ -855,7 +902,10 @@ bool PrintViewManagerBase::CreateNewPrintJob(
|
|
|
|
|
|
// Disconnect the current `print_job_`.
|
|
|
auto weak_this = weak_ptr_factory_.GetWeakPtr();
|
|
@@ -394,7 +395,7 @@ index 331eb8e86b3b9f0a92a002f231e4c918c10a0107..843feb1915ae461593b06393cdd4d8b6
|
|
|
if (!weak_this)
|
|
|
return false;
|
|
|
|
|
|
-@@ -856,7 +905,7 @@ bool PrintViewManagerBase::CreateNewPrintJob(
|
|
|
+@@ -876,7 +926,7 @@ bool PrintViewManagerBase::CreateNewPrintJob(
|
|
|
#endif
|
|
|
print_job_->AddObserver(*this);
|
|
|
|
|
@@ -403,7 +404,7 @@ index 331eb8e86b3b9f0a92a002f231e4c918c10a0107..843feb1915ae461593b06393cdd4d8b6
|
|
|
return true;
|
|
|
}
|
|
|
|
|
|
-@@ -918,6 +967,11 @@ void PrintViewManagerBase::ReleasePrintJob() {
|
|
|
+@@ -938,6 +988,11 @@ void PrintViewManagerBase::ReleasePrintJob() {
|
|
|
}
|
|
|
#endif
|
|
|
|
|
@@ -415,7 +416,7 @@ index 331eb8e86b3b9f0a92a002f231e4c918c10a0107..843feb1915ae461593b06393cdd4d8b6
|
|
|
if (!print_job_)
|
|
|
return;
|
|
|
|
|
|
-@@ -925,7 +979,7 @@ void PrintViewManagerBase::ReleasePrintJob() {
|
|
|
+@@ -945,7 +1000,7 @@ void PrintViewManagerBase::ReleasePrintJob() {
|
|
|
// printing_rfh_ should only ever point to a RenderFrameHost with a live
|
|
|
// RenderFrame.
|
|
|
DCHECK(rfh->IsRenderFrameLive());
|
|
@@ -424,7 +425,7 @@ index 331eb8e86b3b9f0a92a002f231e4c918c10a0107..843feb1915ae461593b06393cdd4d8b6
|
|
|
}
|
|
|
|
|
|
print_job_->RemoveObserver(*this);
|
|
|
-@@ -967,7 +1021,7 @@ bool PrintViewManagerBase::RunInnerMessageLoop() {
|
|
|
+@@ -987,7 +1042,7 @@ bool PrintViewManagerBase::RunInnerMessageLoop() {
|
|
|
}
|
|
|
|
|
|
bool PrintViewManagerBase::OpportunisticallyCreatePrintJob(int cookie) {
|
|
@@ -433,7 +434,7 @@ index 331eb8e86b3b9f0a92a002f231e4c918c10a0107..843feb1915ae461593b06393cdd4d8b6
|
|
|
return true;
|
|
|
|
|
|
if (!cookie) {
|
|
|
-@@ -1073,7 +1127,7 @@ void PrintViewManagerBase::ReleasePrinterQuery() {
|
|
|
+@@ -1094,7 +1149,7 @@ void PrintViewManagerBase::ReleasePrinterQuery() {
|
|
|
}
|
|
|
|
|
|
void PrintViewManagerBase::CompletePrintNow(content::RenderFrameHost* rfh) {
|
|
@@ -443,7 +444,7 @@ index 331eb8e86b3b9f0a92a002f231e4c918c10a0107..843feb1915ae461593b06393cdd4d8b6
|
|
|
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 0b32f0c20c2bc895f1281fa6559b308252d034df..808da5c94a0dba22f86f505d2c9644c9dea61024 100644
|
|
|
+index 25d415022a331721ac356a55e1d23da00e494162..dad283702062c210e2306854bc346c6ab0fe6a22 100644
|
|
|
--- a/chrome/browser/printing/print_view_manager_base.h
|
|
|
+++ b/chrome/browser/printing/print_view_manager_base.h
|
|
|
@@ -42,6 +42,8 @@ namespace printing {
|
|
@@ -490,7 +491,7 @@ index 0b32f0c20c2bc895f1281fa6559b308252d034df..808da5c94a0dba22f86f505d2c9644c9
|
|
|
protected:
|
|
|
explicit PrintViewManagerBase(content::WebContents* web_contents);
|
|
|
|
|
|
-@@ -260,7 +274,8 @@ class PrintViewManagerBase : public PrintManager, public PrintJob::Observer {
|
|
|
+@@ -266,7 +280,8 @@ class PrintViewManagerBase : public PrintManager, public PrintJob::Observer {
|
|
|
// Runs `callback` with `params` to reply to ScriptedPrint().
|
|
|
void ScriptedPrintReply(ScriptedPrintCallback callback,
|
|
|
int process_id,
|
|
@@ -500,7 +501,7 @@ index 0b32f0c20c2bc895f1281fa6559b308252d034df..808da5c94a0dba22f86f505d2c9644c9
|
|
|
|
|
|
// 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
|
|
|
-@@ -330,8 +345,11 @@ class PrintViewManagerBase : public PrintManager, public PrintJob::Observer {
|
|
|
+@@ -336,8 +351,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;
|
|
|
|
|
@@ -783,10 +784,10 @@ index 97151dfd451fc847472fa82d418ab1f5abd8d853..e8e963aca6c1ab0360c55da0ad0845b9
|
|
|
#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 c0c0821983a253bf26cc5bd4704074f79709e9c1..ec8da4b89278e4f53ae302fb6ae860383966a2bc 100644
|
|
|
+index 302c7a8e2b15dbfa04601651adc8f73e388d0b37..915ecd8d726cec265848502622dd13d4dff099b7 100644
|
|
|
--- a/content/browser/BUILD.gn
|
|
|
+++ b/content/browser/BUILD.gn
|
|
|
-@@ -2792,8 +2792,9 @@ source_set("browser") {
|
|
|
+@@ -2806,8 +2806,9 @@ source_set("browser") {
|
|
|
"//ppapi/shared_impl",
|
|
|
]
|
|
|
|
|
@@ -835,10 +836,10 @@ index 42095172d1406860249601537648fe22790ba744..361c20ef66d5c7acd34528711c52714d
|
|
|
bool skip_system_calls() const {
|
|
|
#if BUILDFLAG(ENABLE_OOP_PRINTING)
|
|
|
diff --git a/sandbox/policy/mac/sandbox_mac.mm b/sandbox/policy/mac/sandbox_mac.mm
|
|
|
-index 228f84aea28ad1a0778d42aa6c96f6fad6d8a708..8b62528faa1a27a5f2f09f90bd23267e22f5d044 100644
|
|
|
+index d709edc697f1390a3eb086c4be16a8185bf6e66c..e6f4cdf018bb9a1cdf140a3b80eaca9accd289d8 100644
|
|
|
--- a/sandbox/policy/mac/sandbox_mac.mm
|
|
|
+++ b/sandbox/policy/mac/sandbox_mac.mm
|
|
|
-@@ -23,7 +23,6 @@
|
|
|
+@@ -25,7 +25,6 @@
|
|
|
#include "sandbox/policy/mac/nacl_loader.sb.h"
|
|
|
#include "sandbox/policy/mac/network.sb.h"
|
|
|
#include "sandbox/policy/mac/ppapi.sb.h"
|
|
@@ -846,7 +847,7 @@ index 228f84aea28ad1a0778d42aa6c96f6fad6d8a708..8b62528faa1a27a5f2f09f90bd23267e
|
|
|
#include "sandbox/policy/mac/print_compositor.sb.h"
|
|
|
#include "sandbox/policy/mac/renderer.sb.h"
|
|
|
#if BUILDFLAG(ENABLE_SCREEN_AI_SERVICE)
|
|
|
-@@ -33,6 +32,10 @@
|
|
|
+@@ -35,6 +34,10 @@
|
|
|
#include "sandbox/policy/mac/utility.sb.h"
|
|
|
#include "sandbox/policy/mojom/sandbox.mojom.h"
|
|
|
|