chore: bump chromium to 103.0.5046.0 (main) (#33906)

* chore: bump chromium in DEPS to 103.0.5020.0

* chore: bump chromium in DEPS to 103.0.5022.0

* chore: bump chromium in DEPS to 103.0.5024.0

* chore: update patches

* 3587410: [Printing] Remove JobEventDetails

Ref: 3587410

* chore: bump chromium in DEPS to 103.0.5026.0

* chore: update patches

* 3577218: WebUI: Delete webui_resources.grd and related GN targets.

Ref: 3577218

* chore: bump chromium in DEPS to 103.0.5028.0

* chore: update patches

* 3579297: Convert UpdatePrintSettings() to use non-deprecated base::Value APIs.

Ref: 3579297

* 3560622: serial: Add SerialPort.forget() method

Ref: 3560622

* 3581708: Restore original display when moving from tab-fullscreen to browser-fullscreen.

Ref: 3581708

* chore: fix authorization flags lint error

* 3583363: Remove net wrappers around base/strings/escape.h

Ref: 3583363

* fixup! 3560622: serial: Add SerialPort.forget() method

Ref: 3560622

* 3587589: Reland "Propagate the MIME type from DownloadTargetDeterminer to DownloadItem"

Ref: 3587589

* 3584006: Remove IsRenderViewLive from content public

Ref: 3584006

* 3596174: [api] Remove APIs for resurrecting finalizers

Ref: 3596174

* 3368244: Hook SnapshotForContentAnalysis renderer API to scan system prints

Ref: 3368244

* chore: bump chromium in DEPS to 103.0.5030.0

* chore: update patches

* chore: bump chromium in DEPS to 103.0.5032.0

* chore: bump chromium in DEPS to 103.0.5034.0

* chore: bump chromium in DEPS to 103.0.5036.0

* chore: update patches

* 3586363: Introduce PrintRenderFrame.PrintWithParams() for batch printing to PDF

Ref: 3586363

* 3593199: Remove content::PermissionType references and replace them with blink::PermissionType

Ref: 3593199

* 3368244: Hook SnapshotForContentAnalysis renderer API to scan system prints

Ref: 3368244

* chore: lint

* chore: bump chromium in DEPS to 103.0.5038.0

* chore: update patches

* fixup! 3560622: serial: Add SerialPort.forget() method

* 3606495: mac screen capture: add metric

Ref: 3606495

* chore: bump chromium in DEPS to 103.0.5040.0

* chore: update patches

* 3590840: Add IPs to DnsOverHttpsServerConfig

3590840

* stub functions for ElectronSerialDelegate and SerialChooserController to fix link

* 3566412: [base] Remove base/android dependency on post_task.h and officially remove post_task.h!

Ref: 3566412

* 3347944: [content] No longer hand-off whole MainFunctionParams to BrowserMainParts

Ref: 3347944

* fixup! 3566412: [base] Remove base/android dependency on post_task.h and off…
e3ea3e1
…icially remove post_task.h!

* chore: update process_singleton patches for content::GetIOThreadTaskRunner({})

Ref: 2015655: [BrowserThread] Migrate co/pub/br and co/br/scheduler to the new API | 2015655

* chore: migrate base::DeleteSoon to content::GetUIThreadTaskRunner({})->DeleteSoon

Ref: 3566412

* chore: remove duplicate functions for RevokePortPermissionWebInitiated & GetPortInfo

* chore: migrate Linux/Windows methods off of post_task.h

Ref: 3566412

* 64908: Stop building legacy SwiftShader GL in Chromium

https://swiftshader-review.googlesource.com/c/SwiftShader/+/64908

* 3573245: Added Themed versions of RoundedRectBackground and RoundedRectBorder.

Ref: 3573245

* chore: bump chromium in DEPS to 103.0.5042.0

* chore: update patches

* 3571804: [api] Advance API deprecation for V8 version v10.2

3571804

* fixup! 3571804: [api] Advance API deprecation for V8 version v10.2

* build: fix run-clang-format extension matching

* lint

* fix windows build

* how is clang-format still not working for me

* chore: update patches

* 3623985: Replace ad-hoc SetPublicFirstPartySets calls with method in ContentBrowserClient.

3623985

* no need to implement WillProvidePublicFirstPartySets; the default is false

* 3601036: [QT] Introduce ui/views/linux_ui/linux_ui_factory.*

3601036

* 3583363: Remove net wrappers around base/strings/escape.h

3583363

* lint

* chore: bump chromium in DEPS to 103.0.5044.0

* fix conflicts

* chore: update patches

* upgrade nan

* pin version of nan in tests

* replace my hacky deprecated override fix with the fix from upstream

* revert runtime dcheck in v8

* pin nan version at root too

* refactor: tell gyp to use c++17 when building with our node

* Revert "refactor: tell gyp to use c++17 when building with our node"

This reverts commit 41a03a5799a8f40f31555d73d20ea865acfcd192.

* Undo the reversion of 41a03a5799a8f40f31555d73d20ea865acfcd192.

This reverts commit 54440abc598153bd7e259be4a908f0ecc0b33348.

* disable sequential/test-cpu-prof-kill for now

* also sequential/test-diagnostic-dir-cpu-prof

Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com>
Co-authored-by: Keeley Hammond <khammond@slack-corp.com>
Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com>
Co-authored-by: VerteDinde <vertedinde@electronjs.org>
Co-authored-by: Jeremy Rose <japthorp@slack-corp.com>
Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
Co-authored-by: Jeremy Rose <jeremya@chromium.org>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
This commit is contained in:
electron-roller[bot] 2022-05-17 12:48:40 -04:00 committed by GitHub
parent 04b33b319b
commit 61374019c0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
168 changed files with 1009 additions and 873 deletions

View file

@ -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 8d40bbf98d4d58704f118cb42039b0956a9f6639..06196c0fa02012a5faa82471bd39fac087918f54 100644
index 331a084371402b5a2440b5d60feac8f0189e84b9..6755d1f497cef4deea6b83df1d8720dcf54817e9 100644
--- a/chrome/browser/printing/print_job.cc
+++ b/chrome/browser/printing/print_job.cc
@@ -89,6 +89,7 @@ bool PrintWithReducedRasterization(PrefService* prefs) {
@@ -90,6 +90,7 @@ bool PrintWithReducedRasterization(PrefService* prefs) {
return base::FeatureList::IsEnabled(features::kPrintWithReducedRasterization);
}
@ -22,7 +22,7 @@ index 8d40bbf98d4d58704f118cb42039b0956a9f6639..06196c0fa02012a5faa82471bd39fac0
PrefService* GetPrefsForWebContents(content::WebContents* web_contents) {
// TODO(thestig): Figure out why crbug.com/1083911 occurred, which is likely
// because `web_contents` was null. As a result, this section has many more
@@ -97,6 +98,7 @@ PrefService* GetPrefsForWebContents(content::WebContents* web_contents) {
@@ -98,6 +99,7 @@ PrefService* GetPrefsForWebContents(content::WebContents* web_contents) {
web_contents ? web_contents->GetBrowserContext() : nullptr;
return context ? Profile::FromBrowserContext(context)->GetPrefs() : nullptr;
}
@ -30,7 +30,7 @@ index 8d40bbf98d4d58704f118cb42039b0956a9f6639..06196c0fa02012a5faa82471bd39fac0
#endif // BUILDFLAG(IS_WIN)
@@ -356,8 +358,10 @@ void PrintJob::StartPdfToEmfConversion(
@@ -351,8 +353,10 @@ void PrintJob::StartPdfToEmfConversion(
const PrintSettings& settings = document()->settings();
@ -42,7 +42,7 @@ index 8d40bbf98d4d58704f118cb42039b0956a9f6639..06196c0fa02012a5faa82471bd39fac0
using RenderMode = PdfRenderSettings::Mode;
RenderMode mode = print_with_reduced_rasterization
@@ -447,8 +451,10 @@ void PrintJob::StartPdfToPostScriptConversion(
@@ -442,8 +446,10 @@ void PrintJob::StartPdfToPostScriptConversion(
if (ps_level2) {
mode = PdfRenderSettings::Mode::POSTSCRIPT_LEVEL2;
} else {
@ -54,22 +54,8 @@ index 8d40bbf98d4d58704f118cb42039b0956a9f6639..06196c0fa02012a5faa82471bd39fac0
? PdfRenderSettings::Mode::POSTSCRIPT_LEVEL3_WITH_TYPE42_FONTS
: PdfRenderSettings::Mode::POSTSCRIPT_LEVEL3;
}
diff --git a/chrome/browser/printing/print_job.h b/chrome/browser/printing/print_job.h
index 650c78f16c812170aeda99d75300ff88f47347a0..c33ce445a23f97a744db3a4ac30ef471c359553b 100644
--- a/chrome/browser/printing/print_job.h
+++ b/chrome/browser/printing/print_job.h
@@ -261,6 +261,9 @@ class JobEventDetails : public base::RefCountedThreadSafe<JobEventDetails> {
public:
// Event type.
enum Type {
+ // Print... dialog box has been closed with CANCEL button.
+ USER_INIT_CANCELED,
+
// A new document started printing.
NEW_DOC,
diff --git a/chrome/browser/printing/print_job_worker.cc b/chrome/browser/printing/print_job_worker.cc
index f989f040cb9ff6df001225057202fb1653ade9fc..8a7dd2a4c4e9f5c778a8a35658cb55883ea5fae5 100644
index ee713c5686d4ea8a5d73cebf74e67381b685cff6..375ce3294727b84bf0071681c7bc35c772e4e3b9 100644
--- a/chrome/browser/printing/print_job_worker.cc
+++ b/chrome/browser/printing/print_job_worker.cc
@@ -20,7 +20,6 @@
@ -88,7 +74,7 @@ index f989f040cb9ff6df001225057202fb1653ade9fc..8a7dd2a4c4e9f5c778a8a35658cb5588
#include "printing/backend/print_backend.h"
#include "printing/buildflags/buildflags.h"
#include "printing/mojom/print.mojom.h"
@@ -230,16 +230,21 @@ void PrintJobWorker::UpdatePrintSettings(base::Value new_settings,
@@ -229,16 +229,21 @@ void PrintJobWorker::UpdatePrintSettings(base::Value::Dict new_settings,
#endif // BUILDFLAG(IS_LINUX) && defined(USE_CUPS)
}
@ -114,10 +100,10 @@ index f989f040cb9ff6df001225057202fb1653ade9fc..8a7dd2a4c4e9f5c778a8a35658cb5588
#if BUILDFLAG(IS_CHROMEOS)
diff --git a/chrome/browser/printing/print_job_worker_oop.cc b/chrome/browser/printing/print_job_worker_oop.cc
index 02dfcad0c6b208f7df4d2b10112739554f6ab75c..0774aa95ee1521b0e76fe72d8d9e8de4540f0ff1 100644
index dd27bbf387718d6abda5080e7d2c609cd0eaff17..8837cf2aeaa2f87d51be8d00aa356c8a2c5e15c7 100644
--- a/chrome/browser/printing/print_job_worker_oop.cc
+++ b/chrome/browser/printing/print_job_worker_oop.cc
@@ -331,7 +331,7 @@ void PrintJobWorkerOop::OnFailure() {
@@ -345,7 +345,7 @@ void PrintJobWorkerOop::OnFailure() {
}
void PrintJobWorkerOop::ShowErrorDialog() {
@ -127,7 +113,7 @@ index 02dfcad0c6b208f7df4d2b10112739554f6ab75c..0774aa95ee1521b0e76fe72d8d9e8de4
void PrintJobWorkerOop::UnregisterServiceManagerClient() {
diff --git a/chrome/browser/printing/print_view_manager_base.cc b/chrome/browser/printing/print_view_manager_base.cc
index 3a3f733c45e08e461a74d2458172c38ec0e572bf..ae520ae7e671183887a4703c3b1071921e7cabb4 100644
index 3701853ada7f0ffe3cc8a798496f9f48541b4f47..a082dd9ee23b6d4918c194161386b973039d3ff6 100644
--- a/chrome/browser/printing/print_view_manager_base.cc
+++ b/chrome/browser/printing/print_view_manager_base.cc
@@ -30,10 +30,10 @@
@ -143,15 +129,15 @@ index 3a3f733c45e08e461a74d2458172c38ec0e572bf..ae520ae7e671183887a4703c3b107192
#include "components/prefs/pref_service.h"
#include "components/printing/browser/print_composite_client.h"
#include "components/printing/browser/print_manager_utils.h"
@@ -49,6 +49,7 @@
@@ -48,6 +48,7 @@
#include "content/public/browser/render_frame_host.h"
#include "content/public/browser/render_process_host.h"
#include "content/public/browser/render_view_host.h"
#include "content/public/browser/web_contents.h"
+#include "chrome/grit/generated_resources.h"
#include "mojo/public/cpp/system/buffer.h"
#include "printing/buildflags/buildflags.h"
#include "printing/metafile_skia.h"
@@ -88,6 +89,8 @@ using PrintSettingsCallback =
@@ -87,6 +88,8 @@ using PrintSettingsCallback =
base::OnceCallback<void(std::unique_ptr<PrinterQuery>)>;
void ShowWarningMessageBox(const std::u16string& message) {
@ -160,7 +146,7 @@ index 3a3f733c45e08e461a74d2458172c38ec0e572bf..ae520ae7e671183887a4703c3b107192
// Runs always on the UI thread.
static bool is_dialog_shown = false;
if (is_dialog_shown)
@@ -96,6 +99,7 @@ void ShowWarningMessageBox(const std::u16string& message) {
@@ -95,6 +98,7 @@ void ShowWarningMessageBox(const std::u16string& message) {
base::AutoReset<bool> auto_reset(&is_dialog_shown, true);
chrome::ShowWarningMessageBox(nullptr, std::u16string(), message);
@ -168,7 +154,7 @@ index 3a3f733c45e08e461a74d2458172c38ec0e572bf..ae520ae7e671183887a4703c3b107192
}
#if BUILDFLAG(ENABLE_PRINT_PREVIEW)
@@ -193,7 +197,9 @@ void UpdatePrintSettingsReplyOnIO(
@@ -192,7 +196,9 @@ void UpdatePrintSettingsReplyOnIO(
DCHECK_CURRENTLY_ON(content::BrowserThread::IO);
DCHECK(printer_query);
mojom::PrintPagesParamsPtr params = CreateEmptyPrintPagesParamsPtr();
@ -179,7 +165,7 @@ index 3a3f733c45e08e461a74d2458172c38ec0e572bf..ae520ae7e671183887a4703c3b107192
RenderParamsFromPrintSettings(printer_query->settings(),
params->params.get());
params->params->document_cookie = printer_query->cookie();
@@ -246,6 +252,7 @@ void ScriptedPrintReplyOnIO(
@@ -245,6 +251,7 @@ void ScriptedPrintReplyOnIO(
mojom::PrintManagerHost::ScriptedPrintCallback callback) {
DCHECK_CURRENTLY_ON(content::BrowserThread::IO);
mojom::PrintPagesParamsPtr params = CreateEmptyPrintPagesParamsPtr();
@ -187,7 +173,7 @@ index 3a3f733c45e08e461a74d2458172c38ec0e572bf..ae520ae7e671183887a4703c3b107192
if (printer_query->last_status() == mojom::ResultCode::kSuccess &&
printer_query->settings().dpi()) {
RenderParamsFromPrintSettings(printer_query->settings(),
@@ -255,8 +262,9 @@ void ScriptedPrintReplyOnIO(
@@ -254,8 +261,9 @@ void ScriptedPrintReplyOnIO(
}
bool has_valid_cookie = params->params->document_cookie;
bool has_dpi = !params->params->dpi.IsEmpty();
@ -198,7 +184,7 @@ index 3a3f733c45e08e461a74d2458172c38ec0e572bf..ae520ae7e671183887a4703c3b107192
if (has_dpi && has_valid_cookie) {
queue->QueuePrinterQuery(std::move(printer_query));
@@ -294,12 +302,14 @@ PrintViewManagerBase::PrintViewManagerBase(content::WebContents* web_contents)
@@ -293,12 +301,14 @@ PrintViewManagerBase::PrintViewManagerBase(content::WebContents* web_contents)
: PrintManager(web_contents),
queue_(g_browser_process->print_job_manager()->queue()) {
DCHECK(queue_);
@ -213,7 +199,7 @@ index 3a3f733c45e08e461a74d2458172c38ec0e572bf..ae520ae7e671183887a4703c3b107192
}
PrintViewManagerBase::~PrintViewManagerBase() {
@@ -307,7 +317,10 @@ PrintViewManagerBase::~PrintViewManagerBase() {
@@ -306,7 +316,10 @@ PrintViewManagerBase::~PrintViewManagerBase() {
DisconnectFromCurrentPrintJob();
}
@ -225,18 +211,17 @@ index 3a3f733c45e08e461a74d2458172c38ec0e572bf..ae520ae7e671183887a4703c3b107192
// Remember the ID for `rfh`, to enable checking that the `RenderFrameHost`
// is still valid after a possible inner message loop runs in
// `DisconnectFromCurrentPrintJob()`.
@@ -333,7 +346,9 @@ bool PrintViewManagerBase::PrintNow(content::RenderFrameHost* rfh) {
@@ -332,6 +345,9 @@ bool PrintViewManagerBase::PrintNow(content::RenderFrameHost* rfh) {
#endif
SetPrintingRFH(rfh);
- GetPrintRenderFrame(rfh)->PrintRequestedPages();
+ callback_ = std::move(callback);
+
+ GetPrintRenderFrame(rfh)->PrintRequestedPages(silent, std::move(settings));
for (auto& observer : GetObservers())
observer.OnPrintNow(rfh);
@@ -486,7 +501,8 @@ void PrintViewManagerBase::GetDefaultPrintSettingsReply(
#if BUILDFLAG(ENABLE_PRINT_CONTENT_ANALYSIS)
enterprise_connectors::ContentAnalysisDelegate::Data scanning_data;
@@ -500,7 +516,8 @@ void PrintViewManagerBase::GetDefaultPrintSettingsReply(
void PrintViewManagerBase::ScriptedPrintReply(
ScriptedPrintCallback callback,
int process_id,
@ -246,7 +231,7 @@ index 3a3f733c45e08e461a74d2458172c38ec0e572bf..ae520ae7e671183887a4703c3b107192
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
#if BUILDFLAG(ENABLE_OOP_PRINTING)
@@ -499,16 +515,19 @@ void PrintViewManagerBase::ScriptedPrintReply(
@@ -513,16 +530,19 @@ void PrintViewManagerBase::ScriptedPrintReply(
return;
}
@ -270,7 +255,7 @@ index 3a3f733c45e08e461a74d2458172c38ec0e572bf..ae520ae7e671183887a4703c3b107192
}
void PrintViewManagerBase::NavigationStopped() {
@@ -624,11 +643,14 @@ void PrintViewManagerBase::DidPrintDocument(
@@ -638,11 +658,14 @@ void PrintViewManagerBase::DidPrintDocument(
void PrintViewManagerBase::GetDefaultPrintSettings(
GetDefaultPrintSettingsCallback callback) {
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
@ -285,8 +270,8 @@ index 3a3f733c45e08e461a74d2458172c38ec0e572bf..ae520ae7e671183887a4703c3b107192
#if BUILDFLAG(ENABLE_OOP_PRINTING)
if (printing::features::kEnableOopPrintDriversJobPrint.Get() &&
!service_manager_client_id_.has_value()) {
@@ -658,18 +680,20 @@ void PrintViewManagerBase::UpdatePrintSettings(
base::Value job_settings,
@@ -672,18 +695,20 @@ void PrintViewManagerBase::UpdatePrintSettings(
base::Value::Dict job_settings,
UpdatePrintSettingsCallback callback) {
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
+#if 0 // Printing is always enabled.
@ -297,7 +282,7 @@ index 3a3f733c45e08e461a74d2458172c38ec0e572bf..ae520ae7e671183887a4703c3b107192
}
-
+#endif
if (!job_settings.FindIntKey(kSettingPrinterType)) {
if (!job_settings.FindInt(kSettingPrinterType)) {
UpdatePrintSettingsReply(std::move(callback),
CreateEmptyPrintPagesParamsPtr(), false);
return;
@ -307,15 +292,15 @@ index 3a3f733c45e08e461a74d2458172c38ec0e572bf..ae520ae7e671183887a4703c3b107192
content::BrowserContext* context =
web_contents() ? web_contents()->GetBrowserContext() : nullptr;
PrefService* prefs =
@@ -679,6 +703,7 @@ void PrintViewManagerBase::UpdatePrintSettings(
@@ -693,6 +718,7 @@ void PrintViewManagerBase::UpdatePrintSettings(
if (value > 0)
job_settings.SetIntKey(kSettingRasterizePdfDpi, value);
job_settings.Set(kSettingRasterizePdfDpi, value);
}
+#endif
auto callback_wrapper =
base::BindOnce(&PrintViewManagerBase::UpdatePrintSettingsReply,
@@ -704,14 +729,14 @@ void PrintViewManagerBase::ScriptedPrint(mojom::ScriptedPrintParamsPtr params,
@@ -718,14 +744,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);
@ -332,15 +317,15 @@ index 3a3f733c45e08e461a74d2458172c38ec0e572bf..ae520ae7e671183887a4703c3b107192
return;
}
#endif
@@ -734,7 +759,6 @@ void PrintViewManagerBase::PrintingFailed(int32_t cookie) {
PrintManager::PrintingFailed(cookie);
@@ -763,7 +789,6 @@ void PrintViewManagerBase::PrintingFailed(int32_t cookie,
PrintManager::PrintingFailed(cookie, reason);
#if !BUILDFLAG(IS_ANDROID) // Android does not implement this function.
- ShowPrintErrorDialog();
#endif
ReleasePrinterQuery();
@@ -749,6 +773,11 @@ void PrintViewManagerBase::RemoveObserver(Observer& observer) {
@@ -778,6 +803,11 @@ void PrintViewManagerBase::RemoveObserver(Observer& observer) {
}
void PrintViewManagerBase::ShowInvalidPrinterSettingsError() {
@ -352,7 +337,7 @@ index 3a3f733c45e08e461a74d2458172c38ec0e572bf..ae520ae7e671183887a4703c3b107192
base::ThreadTaskRunnerHandle::Get()->PostTask(
FROM_HERE, base::BindOnce(&ShowWarningMessageBox,
l10n_util::GetStringUTF16(
@@ -759,10 +788,12 @@ void PrintViewManagerBase::RenderFrameHostStateChanged(
@@ -788,10 +818,12 @@ void PrintViewManagerBase::RenderFrameHostStateChanged(
content::RenderFrameHost* render_frame_host,
content::RenderFrameHost::LifecycleState /*old_state*/,
content::RenderFrameHost::LifecycleState new_state) {
@ -365,7 +350,7 @@ index 3a3f733c45e08e461a74d2458172c38ec0e572bf..ae520ae7e671183887a4703c3b107192
}
void PrintViewManagerBase::DidStartLoading() {
@@ -822,6 +853,11 @@ void PrintViewManagerBase::OnJobDone() {
@@ -851,6 +883,11 @@ void PrintViewManagerBase::OnJobDone() {
ReleasePrintJob();
}
@ -377,7 +362,7 @@ index 3a3f733c45e08e461a74d2458172c38ec0e572bf..ae520ae7e671183887a4703c3b107192
void PrintViewManagerBase::OnFailed() {
TerminatePrintJob(true);
}
@@ -883,7 +919,10 @@ bool PrintViewManagerBase::CreateNewPrintJob(
@@ -908,7 +945,10 @@ bool PrintViewManagerBase::CreateNewPrintJob(
// Disconnect the current |print_job_|.
auto weak_this = weak_ptr_factory_.GetWeakPtr();
@ -389,7 +374,7 @@ index 3a3f733c45e08e461a74d2458172c38ec0e572bf..ae520ae7e671183887a4703c3b107192
if (!weak_this)
return false;
@@ -965,6 +1004,13 @@ void PrintViewManagerBase::ReleasePrintJob() {
@@ -987,6 +1027,13 @@ void PrintViewManagerBase::ReleasePrintJob() {
UnregisterSystemPrintClient();
#endif
@ -403,7 +388,7 @@ index 3a3f733c45e08e461a74d2458172c38ec0e572bf..ae520ae7e671183887a4703c3b107192
if (!print_job_)
return;
@@ -1014,7 +1060,7 @@ bool PrintViewManagerBase::RunInnerMessageLoop() {
@@ -1036,7 +1083,7 @@ bool PrintViewManagerBase::RunInnerMessageLoop() {
}
bool PrintViewManagerBase::OpportunisticallyCreatePrintJob(int cookie) {
@ -412,11 +397,20 @@ index 3a3f733c45e08e461a74d2458172c38ec0e572bf..ae520ae7e671183887a4703c3b107192
return true;
if (!cookie) {
@@ -1144,7 +1191,7 @@ void PrintViewManagerBase::SendPrintingEnabled(bool enabled,
}
void PrintViewManagerBase::CompletePrintNow(content::RenderFrameHost* rfh) {
- GetPrintRenderFrame(rfh)->PrintRequestedPages();
+ GetPrintRenderFrame(rfh)->PrintRequestedPages(true/*silent*/, base::Value{}/*job_settings*/);
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 3a4cfa1e44d781a94030dec6992ffd6f6391020f..d14804d02cc61b6f75d47893f6dd61ddde6cd552 100644
index 746df417a23f7760818ba265d4a7d589dec8bf34..5566e7dc2929a2542c599fed91fb1eeeb866e7bb 100644
--- a/chrome/browser/printing/print_view_manager_base.h
+++ b/chrome/browser/printing/print_view_manager_base.h
@@ -37,6 +37,8 @@ namespace printing {
@@ -41,6 +41,8 @@ namespace printing {
class PrintQueriesQueue;
class PrinterQuery;
@ -425,7 +419,7 @@ index 3a4cfa1e44d781a94030dec6992ffd6f6391020f..d14804d02cc61b6f75d47893f6dd61dd
// Base class for managing the print commands for a WebContents.
class PrintViewManagerBase : public PrintManager, public PrintJob::Observer {
public:
@@ -58,7 +60,10 @@ class PrintViewManagerBase : public PrintManager, public PrintJob::Observer {
@@ -64,7 +66,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.
@ -437,15 +431,15 @@ index 3a4cfa1e44d781a94030dec6992ffd6f6391020f..d14804d02cc61b6f75d47893f6dd61dd
#if BUILDFLAG(ENABLE_PRINT_PREVIEW)
// Prints the document in `print_data` with settings specified in
@@ -106,6 +111,7 @@ class PrintViewManagerBase : public PrintManager, public PrintJob::Observer {
ScriptedPrintCallback callback) override;
@@ -113,6 +118,7 @@ class PrintViewManagerBase : public PrintManager, public PrintJob::Observer {
void ShowInvalidPrinterSettingsError() override;
void PrintingFailed(int32_t cookie) override;
void PrintingFailed(int32_t cookie,
mojom::PrintFailureReason reason) override;
+ void UserInitCanceled();
// Adds and removes observers for `PrintViewManagerBase` events. The order in
// which notifications are sent to observers is undefined. Observers must be
@@ -207,7 +213,8 @@ class PrintViewManagerBase : public PrintManager, public PrintJob::Observer {
@@ -241,7 +247,8 @@ class PrintViewManagerBase : public PrintManager, public PrintJob::Observer {
// Runs `callback` with `params` to reply to ScriptedPrint().
void ScriptedPrintReply(ScriptedPrintCallback callback,
int process_id,
@ -455,7 +449,7 @@ index 3a4cfa1e44d781a94030dec6992ffd6f6391020f..d14804d02cc61b6f75d47893f6dd61dd
// 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
@@ -262,9 +269,15 @@ class PrintViewManagerBase : public PrintManager, public PrintJob::Observer {
@@ -314,9 +321,15 @@ 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;
@ -472,94 +466,68 @@ index 3a4cfa1e44d781a94030dec6992ffd6f6391020f..d14804d02cc61b6f75d47893f6dd61dd
// 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/ui/webui/print_preview/fake_print_render_frame.cc b/chrome/browser/ui/webui/print_preview/fake_print_render_frame.cc
index 879004c790d57b28e7a816ebf560971876c17168..334509d3ab45af4bb7877f656ca5aca7ee1bce00 100644
index aa727261738698610fab5abd3618d0d0f0d29792..8f95dae637ce25a073872ecdf229f14cc6d0614c 100644
--- a/chrome/browser/ui/webui/print_preview/fake_print_render_frame.cc
+++ b/chrome/browser/ui/webui/print_preview/fake_print_render_frame.cc
@@ -20,7 +20,7 @@ FakePrintRenderFrame::FakePrintRenderFrame(
@@ -21,7 +21,7 @@ FakePrintRenderFrame::FakePrintRenderFrame(
FakePrintRenderFrame::~FakePrintRenderFrame() = default;
-void FakePrintRenderFrame::PrintRequestedPages() {}
+void FakePrintRenderFrame::PrintRequestedPages(bool /*silent*/, ::base::Value /*settings*/) {}
void FakePrintRenderFrame::PrintForSystemDialog() {}
void FakePrintRenderFrame::PrintWithParams(mojom::PrintPagesParamsPtr params) {
NOTREACHED();
diff --git a/chrome/browser/ui/webui/print_preview/fake_print_render_frame.h b/chrome/browser/ui/webui/print_preview/fake_print_render_frame.h
index 10f46664d8337d6be2fac24d9a6933429f3b2c2b..6de833f2da3ae85cf0752284146974f2026ab174 100644
index 5f4d6e314b21351e3e5912e3a43ef87774343085..2a93fe0139025d1a40b3f8e81378ee4213ac27c1 100644
--- a/chrome/browser/ui/webui/print_preview/fake_print_render_frame.h
+++ b/chrome/browser/ui/webui/print_preview/fake_print_render_frame.h
@@ -24,7 +24,7 @@ class FakePrintRenderFrame : public mojom::PrintRenderFrame {
@@ -25,7 +25,7 @@ class FakePrintRenderFrame : public mojom::PrintRenderFrame {
private:
// printing::mojom::PrintRenderFrame:
- void PrintRequestedPages() override;
+ void PrintRequestedPages(bool silent, ::base::Value settings) override;
void PrintWithParams(mojom::PrintPagesParamsPtr params) override;
void PrintForSystemDialog() override;
void SetPrintPreviewUI(
mojo::PendingAssociatedRemote<mojom::PrintPreviewUI> preview) override;
diff --git a/components/printing/browser/print_to_pdf/pdf_print_manager.cc b/components/printing/browser/print_to_pdf/pdf_print_manager.cc
index 66810a2a5f0c77ba107c71d2abaef8692bda0fea..cd6103af4571f82f11652a3c7ecf0e534428dc49 100644
index 82591f8c2abbc1a180ef62f7264a68ca279e9b9c..ad27a15ba3028af1046482192dec789df5dda7b2 100644
--- a/components/printing/browser/print_to_pdf/pdf_print_manager.cc
+++ b/components/printing/browser/print_to_pdf/pdf_print_manager.cc
@@ -116,7 +116,8 @@ void PdfPrintManager::PrintToPdf(
set_cookie(print_pages_params_->params->document_cookie);
@@ -132,7 +132,8 @@ void PdfPrintManager::PrintToPdf(
set_cookie(print_pages_params->params->document_cookie);
callback_ = std::move(callback);
- GetPrintRenderFrame(rfh)->PrintRequestedPages();
- GetPrintRenderFrame(rfh)->PrintWithParams(std::move(print_pages_params));
+ // TODO(electron-maintainers): do something with job_settings here?
+ GetPrintRenderFrame(rfh)->PrintRequestedPages(true/*silent*/, base::Value{}/*job_settings*/);
}
void PdfPrintManager::GetDefaultPrintSettings(
@@ -138,14 +139,14 @@ void PdfPrintManager::ScriptedPrint(
if (!printing_rfh_) {
DLOG(ERROR) << "Unexpected message received before PrintToPdf is "
"called: ScriptedPrint";
- std::move(callback).Run(std::move(default_param));
+ std::move(callback).Run(std::move(default_param), true/*canceled*/);
return;
}
if (params->is_scripted &&
GetCurrentTargetFrame()->IsNestedWithinFencedFrame()) {
DLOG(ERROR) << "Unexpected message received. Script Print is not allowed"
" in a fenced frame.";
- std::move(callback).Run(std::move(default_param));
+ std::move(callback).Run(std::move(default_param), true/*canceled*/);
return;
}
absl::variant<printing::PageRanges, PageRangeError> page_ranges =
@@ -162,7 +163,7 @@ void PdfPrintManager::ScriptedPrint(
break;
}
ReleaseJob(print_result);
- std::move(callback).Run(std::move(default_param));
+ std::move(callback).Run(std::move(default_param), true/*canceled*/);
return;
}
@@ -170,7 +171,7 @@ void PdfPrintManager::ScriptedPrint(
print_pages_params_->pages = printing::PageRange::GetPages(
absl::get<printing::PageRanges>(page_ranges));
- std::move(callback).Run(print_pages_params_->Clone());
+ std::move(callback).Run(print_pages_params_->Clone(), false/*canceled*/);
@@ -147,7 +148,7 @@ void PdfPrintManager::ScriptedPrint(
auto default_param = printing::mojom::PrintPagesParams::New();
default_param->params = printing::mojom::PrintParams::New();
DLOG(ERROR) << "Scripted print is not supported";
- std::move(callback).Run(std::move(default_param));
+ std::move(callback).Run(std::move(default_param), true/*canceled*/);
}
void PdfPrintManager::ShowInvalidPrinterSettingsError() {
diff --git a/components/printing/common/print.mojom b/components/printing/common/print.mojom
index 6cd585d597315940be144506b9bb819137a7981e..8ea9c38a46460edd237f003ddd7362240a02887e 100644
index 8e5c441b3d0a2d35fc5c6f9d43b4a4ca167e09ca..fa53eb1c9dd4e7a6b321bdd4cda2164b95244323 100644
--- a/components/printing/common/print.mojom
+++ b/components/printing/common/print.mojom
@@ -275,7 +275,7 @@ interface PrintPreviewUI {
@@ -280,7 +280,7 @@ enum PrintFailureReason {
interface PrintRenderFrame {
// Tells the RenderFrame to switch the CSS to print media type, render every
// requested page, and then switch back the CSS to display media type.
- PrintRequestedPages();
+ PrintRequestedPages(bool silent, mojo_base.mojom.DeprecatedDictionaryValue settings);
// 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
@@ -342,7 +342,7 @@ interface PrintManagerHost {
// Requests the frame to be printed with specified parameters. This is used
// to programmatically produce PDF by request from the browser (e.g. over
@@ -362,7 +362,7 @@ interface PrintManagerHost {
// Request the print settings from the user. This step is about showing
// UI to the user to select the final print settings.
[Sync]
@ -569,18 +537,18 @@ index 6cd585d597315940be144506b9bb819137a7981e..8ea9c38a46460edd237f003ddd736224
// 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 36852ff8edee8da4ca43cf84c316f1f0eaff9fe0..7be102bae492701cddefc1623af4fe8bdd9963fa 100644
index db8913ae41d46d14fd15c6127e126e4b129dc4b8..64ee08e9091e4d67ff55097bc22177d9567214a1 100644
--- a/components/printing/renderer/print_render_frame_helper.cc
+++ b/components/printing/renderer/print_render_frame_helper.cc
@@ -40,6 +40,7 @@
#include "printing/metafile_skia.h"
@@ -42,6 +42,7 @@
#include "printing/mojom/print.mojom.h"
#include "printing/page_number.h"
#include "printing/print_job_constants.h"
+#include "printing/print_settings.h"
#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"
@@ -1264,7 +1265,8 @@ void PrintRenderFrameHelper::ScriptedPrint(bool user_initiated) {
@@ -1277,7 +1278,8 @@ void PrintRenderFrameHelper::ScriptedPrint(bool user_initiated) {
if (!weak_this)
return;
@ -590,7 +558,7 @@ index 36852ff8edee8da4ca43cf84c316f1f0eaff9fe0..7be102bae492701cddefc1623af4fe8b
if (!weak_this)
return;
@@ -1295,7 +1297,7 @@ void PrintRenderFrameHelper::BindPrintRenderFrameReceiver(
@@ -1308,7 +1310,7 @@ void PrintRenderFrameHelper::BindPrintRenderFrameReceiver(
receivers_.Add(this, std::move(receiver));
}
@ -599,7 +567,7 @@ index 36852ff8edee8da4ca43cf84c316f1f0eaff9fe0..7be102bae492701cddefc1623af4fe8b
ScopedIPC scoped_ipc(weak_ptr_factory_.GetWeakPtr());
if (ipc_nesting_level_ > kAllowedIpcDepthForPrint)
return;
@@ -1310,7 +1312,7 @@ void PrintRenderFrameHelper::PrintRequestedPages() {
@@ -1323,7 +1325,7 @@ void PrintRenderFrameHelper::PrintRequestedPages() {
// plugin node and print that instead.
auto plugin = delegate_->GetPdfElement(frame);
@ -608,7 +576,7 @@ index 36852ff8edee8da4ca43cf84c316f1f0eaff9fe0..7be102bae492701cddefc1623af4fe8b
if (!render_frame_gone_)
frame->DispatchAfterPrintEvent();
@@ -1341,7 +1343,8 @@ void PrintRenderFrameHelper::PrintForSystemDialog() {
@@ -1389,7 +1391,8 @@ void PrintRenderFrameHelper::PrintForSystemDialog() {
}
Print(frame, print_preview_context_.source_node(),
@ -618,7 +586,7 @@ index 36852ff8edee8da4ca43cf84c316f1f0eaff9fe0..7be102bae492701cddefc1623af4fe8b
if (!render_frame_gone_)
print_preview_context_.DispatchAfterPrintEvent();
// WARNING: |this| may be gone at this point. Do not do any more work here and
@@ -1390,6 +1393,8 @@ void PrintRenderFrameHelper::PrintPreview(base::Value settings) {
@@ -1438,6 +1441,8 @@ void PrintRenderFrameHelper::PrintPreview(base::Value settings) {
if (ipc_nesting_level_ > kAllowedIpcDepthForPrint)
return;
@ -627,7 +595,7 @@ index 36852ff8edee8da4ca43cf84c316f1f0eaff9fe0..7be102bae492701cddefc1623af4fe8b
print_preview_context_.OnPrintPreview();
#if BUILDFLAG(IS_CHROMEOS_ASH)
@@ -1942,7 +1947,8 @@ void PrintRenderFrameHelper::PrintNode(const blink::WebNode& node) {
@@ -2051,7 +2056,8 @@ void PrintRenderFrameHelper::PrintNode(const blink::WebNode& node) {
return;
Print(duplicate_node.GetDocument().GetFrame(), duplicate_node,
@ -637,7 +605,7 @@ index 36852ff8edee8da4ca43cf84c316f1f0eaff9fe0..7be102bae492701cddefc1623af4fe8b
// Check if |this| is still valid.
if (!weak_this)
return;
@@ -1957,7 +1963,9 @@ void PrintRenderFrameHelper::PrintNode(const blink::WebNode& node) {
@@ -2066,7 +2072,9 @@ void PrintRenderFrameHelper::PrintNode(const blink::WebNode& node) {
void PrintRenderFrameHelper::Print(blink::WebLocalFrame* frame,
const blink::WebNode& node,
@ -648,7 +616,7 @@ index 36852ff8edee8da4ca43cf84c316f1f0eaff9fe0..7be102bae492701cddefc1623af4fe8b
// If still not finished with earlier print request simply ignore.
if (prep_frame_view_)
return;
@@ -1965,7 +1973,7 @@ void PrintRenderFrameHelper::Print(blink::WebLocalFrame* frame,
@@ -2074,7 +2082,7 @@ void PrintRenderFrameHelper::Print(blink::WebLocalFrame* frame,
FrameReference frame_ref(frame);
uint32_t expected_page_count = 0;
@ -657,7 +625,7 @@ index 36852ff8edee8da4ca43cf84c316f1f0eaff9fe0..7be102bae492701cddefc1623af4fe8b
DidFinishPrinting(FAIL_PRINT_INIT);
return; // Failed to init print page settings.
}
@@ -1984,8 +1992,15 @@ void PrintRenderFrameHelper::Print(blink::WebLocalFrame* frame,
@@ -2093,8 +2101,15 @@ void PrintRenderFrameHelper::Print(blink::WebLocalFrame* frame,
print_pages_params_->params->print_scaling_option;
auto self = weak_ptr_factory_.GetWeakPtr();
@ -674,7 +642,7 @@ index 36852ff8edee8da4ca43cf84c316f1f0eaff9fe0..7be102bae492701cddefc1623af4fe8b
// Check if |this| is still valid.
if (!self)
return;
@@ -2233,36 +2248,51 @@ void PrintRenderFrameHelper::IPCProcessed() {
@@ -2327,36 +2342,52 @@ void PrintRenderFrameHelper::IPCProcessed() {
}
}
@ -695,7 +663,8 @@ index 36852ff8edee8da4ca43cf84c316f1f0eaff9fe0..7be102bae492701cddefc1623af4fe8b
+ bool canceled = false;
+ int cookie =
+ print_pages_params_ ? print_pages_params_->params->document_cookie : 0;
+ GetPrintManagerHost()->UpdatePrintSettings(cookie, new_settings.Clone(), &settings, &canceled);
+ GetPrintManagerHost()->UpdatePrintSettings(
+ cookie, new_settings.GetDict().Clone(), &settings, &canceled);
+ if (canceled)
+ return false;
+ }
@ -738,7 +707,7 @@ index 36852ff8edee8da4ca43cf84c316f1f0eaff9fe0..7be102bae492701cddefc1623af4fe8b
notify_browser_of_print_failure_ = false;
GetPrintManagerHost()->ShowInvalidPrinterSettingsError();
return false;
@@ -2406,7 +2436,7 @@ mojom::PrintPagesParamsPtr PrintRenderFrameHelper::GetPrintSettingsFromUser(
@@ -2481,7 +2512,7 @@ mojom::PrintPagesParamsPtr PrintRenderFrameHelper::GetPrintSettingsFromUser(
std::move(params),
base::BindOnce(
[](base::OnceClosure quit_closure, mojom::PrintPagesParamsPtr* output,
@ -747,7 +716,7 @@ index 36852ff8edee8da4ca43cf84c316f1f0eaff9fe0..7be102bae492701cddefc1623af4fe8b
*output = std::move(input);
std::move(quit_closure).Run();
},
@@ -2657,18 +2687,7 @@ void PrintRenderFrameHelper::RequestPrintPreview(PrintPreviewRequestType type,
@@ -2725,18 +2756,7 @@ void PrintRenderFrameHelper::RequestPrintPreview(PrintPreviewRequestType type,
}
bool PrintRenderFrameHelper::CheckForCancel() {
@ -768,19 +737,19 @@ index 36852ff8edee8da4ca43cf84c316f1f0eaff9fe0..7be102bae492701cddefc1623af4fe8b
bool PrintRenderFrameHelper::PreviewPageRendered(
diff --git a/components/printing/renderer/print_render_frame_helper.h b/components/printing/renderer/print_render_frame_helper.h
index cd26f9ecf888c2a321890edd378ee0f8843a7f6c..958794f95fe8830b7e494340fbd53b0e92a498e3 100644
index 220b28a7e63625fe8b76290f0d2f40dd32cae255..72801431a5d19f31c1a7db785b0cbaee8e65cca3 100644
--- a/components/printing/renderer/print_render_frame_helper.h
+++ b/components/printing/renderer/print_render_frame_helper.h
@@ -257,7 +257,7 @@ class PrintRenderFrameHelper
@@ -255,7 +255,7 @@ class PrintRenderFrameHelper
mojo::PendingAssociatedReceiver<mojom::PrintRenderFrame> receiver);
// printing::mojom::PrintRenderFrame:
- void PrintRequestedPages() override;
+ void PrintRequestedPages(bool silent, base::Value settings) override;
void PrintWithParams(mojom::PrintPagesParamsPtr params) override;
#if BUILDFLAG(ENABLE_PRINT_PREVIEW)
void PrintForSystemDialog() override;
void SetPrintPreviewUI(
@@ -324,7 +324,9 @@ class PrintRenderFrameHelper
@@ -327,7 +327,9 @@ class PrintRenderFrameHelper
// WARNING: |this| may be gone after this method returns.
void Print(blink::WebLocalFrame* frame,
const blink::WebNode& node,
@ -791,7 +760,7 @@ index cd26f9ecf888c2a321890edd378ee0f8843a7f6c..958794f95fe8830b7e494340fbd53b0e
// Notification when printing is done - signal tear-down/free resources.
void DidFinishPrinting(PrintingResult result);
@@ -333,12 +335,14 @@ class PrintRenderFrameHelper
@@ -336,12 +338,14 @@ class PrintRenderFrameHelper
// Initialize print page settings with default settings.
// Used only for native printing workflow.
@ -809,19 +778,19 @@ index cd26f9ecf888c2a321890edd378ee0f8843a7f6c..958794f95fe8830b7e494340fbd53b0e
#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 d0ef2181c649afe110c3c466a565a01cf6ae63a9..2daf9f02d41e04930fc4dad6d36ccbf3006dc175 100644
index 8a8fcefa9da92a044f5bdf6a2f242048b325d442..6dae33514675d6843736b2c9a767a4b72cb103fa 100644
--- a/printing/printing_context.cc
+++ b/printing/printing_context.cc
@@ -119,7 +119,6 @@ mojom::ResultCode PrintingContext::UsePdfSettings() {
@@ -117,7 +117,6 @@ mojom::ResultCode PrintingContext::UsePdfSettings() {
mojom::ResultCode PrintingContext::UpdatePrintSettings(
base::Value job_settings) {
base::Value::Dict job_settings) {
- ResetSettings();
{
std::unique_ptr<PrintSettings> settings =
PrintSettingsFromJobSettings(job_settings.GetDict());
PrintSettingsFromJobSettings(job_settings);
diff --git a/printing/printing_context.h b/printing/printing_context.h
index 3f36303105b7979a1a771bf26b42596abe5b3cce..52f740bb832db4a8d76431d9bc77cab10bb7e0c7 100644
index 2c8ef23f7cb75a743fa18e3c613f7c719988028c..265005d6d51f861aa7ccd7e0eba7809b3c652dae 100644
--- a/printing/printing_context.h
+++ b/printing/printing_context.h
@@ -170,6 +170,9 @@ class COMPONENT_EXPORT(PRINTING) PrintingContext {