From ec10fd3044af32e2daccb24254f0437a2ace18e7 Mon Sep 17 00:00:00 2001 From: Shelley Vohr Date: Wed, 12 Jun 2019 12:34:07 -0700 Subject: [PATCH] fix: callback values for printing cancellation and success (#17400) Callback false when disconnecting from the print job if the current printing job has not completed, and true if printing is triggered successfully. --- ...ink-worker-enable-csp-in-file-scheme.patch | 4 +- patches/chromium/blink_local_frame.patch | 2 +- patches/chromium/blink_world_context.patch | 2 +- .../build_add_electron_tracing_category.patch | 2 +- patches/chromium/can_create_window.patch | 8 +- ...cross_site_document_resource_handler.patch | 4 +- patches/chromium/desktop_media_list.patch | 2 +- ...requirement_for_beforeunload_dialogs.patch | 2 +- .../exclude-a-few-test-files-from-build.patch | 4 +- patches/chromium/frame_host_manager.patch | 4 +- patches/chromium/printing.patch | 112 ++++++++++++++---- 11 files changed, 109 insertions(+), 37 deletions(-) diff --git a/patches/chromium/blink-worker-enable-csp-in-file-scheme.patch b/patches/chromium/blink-worker-enable-csp-in-file-scheme.patch index 2f81b519ec86..eaeec5d3dc50 100644 --- a/patches/chromium/blink-worker-enable-csp-in-file-scheme.patch +++ b/patches/chromium/blink-worker-enable-csp-in-file-scheme.patch @@ -5,10 +5,10 @@ Subject: blink-worker-enable-csp-in-file-scheme.patch diff --git a/third_party/blink/renderer/core/workers/worker_classic_script_loader.cc b/third_party/blink/renderer/core/workers/worker_classic_script_loader.cc -index eeeaa47777df0cab00e1c14f60a0d1e26432c538..608ba10174a9c313bb17ab6d5f68053ce37a0435 100644 +index c51ae1141e62ec69a3d3da8e285d89c3b0e04722..57bfcd4c22347f0f4bb9a59598414d50410666a2 100644 --- a/third_party/blink/renderer/core/workers/worker_classic_script_loader.cc +++ b/third_party/blink/renderer/core/workers/worker_classic_script_loader.cc -@@ -307,7 +307,6 @@ void WorkerClassicScriptLoader::ProcessContentSecurityPolicy( +@@ -308,7 +308,6 @@ void WorkerClassicScriptLoader::ProcessContentSecurityPolicy( // document (which is implemented in WorkerMessagingProxy, and // m_contentSecurityPolicy should be left as nullptr to inherit the policy). if (!response.CurrentRequestUrl().ProtocolIs("blob") && diff --git a/patches/chromium/blink_local_frame.patch b/patches/chromium/blink_local_frame.patch index 2aef302f4b69..9f07dafd84f4 100644 --- a/patches/chromium/blink_local_frame.patch +++ b/patches/chromium/blink_local_frame.patch @@ -14,7 +14,7 @@ when there is code doing that. This patch reverts the change to fix the crash in Electron. diff --git a/third_party/blink/renderer/core/frame/local_frame.cc b/third_party/blink/renderer/core/frame/local_frame.cc -index 06f9c9f62dc94bd093942d9ee523a4279203a177..3ee1caa9ad92cfedd326b364817ce9b5e8db800e 100644 +index d1922a486fb0143d688a26f954462e3a915af2b5..b1e800f51e44a7a5d3fabd66563d5bdb6a7aa280 100644 --- a/third_party/blink/renderer/core/frame/local_frame.cc +++ b/third_party/blink/renderer/core/frame/local_frame.cc @@ -393,10 +393,6 @@ void LocalFrame::DetachImpl(FrameDetachType type) { diff --git a/patches/chromium/blink_world_context.patch b/patches/chromium/blink_world_context.patch index 546c84e36c7c..c4a35160bf46 100644 --- a/patches/chromium/blink_world_context.patch +++ b/patches/chromium/blink_world_context.patch @@ -19,7 +19,7 @@ index 82fb3fdfe6bfa8c8d885ee133270b6f2564325a8..f3bad71eab608d3b9ac0e08446c9e520 // that the script evaluated to with callback. Script execution can be // suspend. diff --git a/third_party/blink/renderer/core/frame/web_local_frame_impl.cc b/third_party/blink/renderer/core/frame/web_local_frame_impl.cc -index ce93c3ba0fc4255999fed2bb01dfbb4161faa0dd..305ed843db5dd095a4cd9e8784e3025a1370a491 100644 +index e12642b4703474840a490f426b90c61141f9881e..2610245d88af53e116faa825df264fd9d9babc05 100644 --- a/third_party/blink/renderer/core/frame/web_local_frame_impl.cc +++ b/third_party/blink/renderer/core/frame/web_local_frame_impl.cc @@ -873,6 +873,13 @@ v8::Local WebLocalFrameImpl::GlobalProxy() const { diff --git a/patches/chromium/build_add_electron_tracing_category.patch b/patches/chromium/build_add_electron_tracing_category.patch index 8f70f10b724d..9c545ec36872 100644 --- a/patches/chromium/build_add_electron_tracing_category.patch +++ b/patches/chromium/build_add_electron_tracing_category.patch @@ -8,7 +8,7 @@ categories in use are known / declared. This patch is required for us to introduce a new Electron category. diff --git a/base/trace_event/builtin_categories.h b/base/trace_event/builtin_categories.h -index 97055b4bdaf0dc38b8d248fefddfcf8c68c123b9..6dbe407151dfc5a9168df77f42932e51b802377f 100644 +index 2225bfcbb9a2bf8ee0082304adf6528522964e65..151f7fe91fc53b3069ce892607e4e6f9c91b40f7 100644 --- a/base/trace_event/builtin_categories.h +++ b/base/trace_event/builtin_categories.h @@ -61,6 +61,7 @@ diff --git a/patches/chromium/can_create_window.patch b/patches/chromium/can_create_window.patch index 37a60f0d0792..4cd45cdf0055 100644 --- a/patches/chromium/can_create_window.patch +++ b/patches/chromium/can_create_window.patch @@ -5,10 +5,10 @@ Subject: can_create_window.patch diff --git a/content/browser/frame_host/render_frame_host_impl.cc b/content/browser/frame_host/render_frame_host_impl.cc -index 387831a4615746339f4fe16b2b1bf405f7364b54..37d8be6076b9e98ca68acb5f7dc024b0d018879e 100644 +index 0334ac0cfb75a9d99f841aea388c9a3fc960141b..c341ea17c13ec6f63936c1b4d4faba9bc40362d1 100644 --- a/content/browser/frame_host/render_frame_host_impl.cc +++ b/content/browser/frame_host/render_frame_host_impl.cc -@@ -3719,6 +3719,7 @@ void RenderFrameHostImpl::CreateNewWindow( +@@ -3722,6 +3722,7 @@ void RenderFrameHostImpl::CreateNewWindow( last_committed_origin_, params->window_container_type, params->target_url, params->referrer.To(), params->frame_name, params->disposition, *params->features, @@ -32,7 +32,7 @@ index 82882159b0bac6d47d678c485de0aacc7db06c2d..dd2299094b79d82da7ec1cd8f559050b // Operation result when the renderer asks the browser to create a new window. diff --git a/content/public/browser/content_browser_client.cc b/content/public/browser/content_browser_client.cc -index f4c61acba134daf907a1b9afaaf0327a183287e4..d15061de5254fd4f248fed92f47a1b1fcf34cd68 100644 +index 53e67715469ce47147b66393ecc6a20d0d657977..2dd31166cc52ccb528b338b63fde7d2fb4bbf63d 100644 --- a/content/public/browser/content_browser_client.cc +++ b/content/public/browser/content_browser_client.cc @@ -519,6 +519,8 @@ bool ContentBrowserClient::CanCreateWindow( @@ -45,7 +45,7 @@ index f4c61acba134daf907a1b9afaaf0327a183287e4..d15061de5254fd4f248fed92f47a1b1f bool opener_suppressed, bool* no_javascript_access) { diff --git a/content/public/browser/content_browser_client.h b/content/public/browser/content_browser_client.h -index 6ab15079fe2e1234aca140dfebd5287d8701c147..8ceccd96c4e143921ace8db69685a9631e168dd2 100644 +index 2b4c2c1004fb98da76eb244db4c35dba84085f45..04bfc1a4a804d1f5aa28f894e2feb816bbe80ffc 100644 --- a/content/public/browser/content_browser_client.h +++ b/content/public/browser/content_browser_client.h @@ -177,6 +177,7 @@ class RenderFrameHost; diff --git a/patches/chromium/cross_site_document_resource_handler.patch b/patches/chromium/cross_site_document_resource_handler.patch index d9b2332b9ddc..36c9c73fac0f 100644 --- a/patches/chromium/cross_site_document_resource_handler.patch +++ b/patches/chromium/cross_site_document_resource_handler.patch @@ -22,7 +22,7 @@ index d514c10160dd12f225c42e927977660cacbc9c43..49345f1d4d75c8b96efe485202d89774 } diff --git a/content/public/browser/content_browser_client.cc b/content/public/browser/content_browser_client.cc -index 62d5e17f0599a78d679495d6fa674939d237602e..f40a4ff5f08e906e62dd838eb5af63ade92037d2 100644 +index ce64276225d5b0acf684e9e70c600a64a56fe96e..2a9661d877fbc09904eb469191523b5cd59eaeda 100644 --- a/content/public/browser/content_browser_client.cc +++ b/content/public/browser/content_browser_client.cc @@ -71,6 +71,10 @@ std::unique_ptr ContentBrowserClient::CreateBrowserMainParts( @@ -37,7 +37,7 @@ index 62d5e17f0599a78d679495d6fa674939d237602e..f40a4ff5f08e906e62dd838eb5af63ad const base::Location& from_here, const scoped_refptr& task_runner, diff --git a/content/public/browser/content_browser_client.h b/content/public/browser/content_browser_client.h -index 136df7edaaaaaa1eb121ef7cf80aebc47969dc8d..5b889fec05ee9017f5f149fab70c4feab39c86dc 100644 +index 5bf7340b106bd3ce826ff3322106ef94cbe19d29..ba27455e1c0934f77ed2871ee585361807ab701a 100644 --- a/content/public/browser/content_browser_client.h +++ b/content/public/browser/content_browser_client.h @@ -252,6 +252,9 @@ class CONTENT_EXPORT ContentBrowserClient { diff --git a/patches/chromium/desktop_media_list.patch b/patches/chromium/desktop_media_list.patch index c8fcf0e6452f..d3abeffbadfe 100644 --- a/patches/chromium/desktop_media_list.patch +++ b/patches/chromium/desktop_media_list.patch @@ -133,7 +133,7 @@ index 47401abc984e6fe26c7f4c5399aa565c687060b0..ca6a527ffac877c27aac94337ec5a7b5 protected: virtual ~DesktopMediaListObserver() {} diff --git a/chrome/browser/media/webrtc/native_desktop_media_list.cc b/chrome/browser/media/webrtc/native_desktop_media_list.cc -index b060eb31d194e44c6c89e2cbf990323802c1aa5f..514325c3d6cb11b69b0d43e72d851c49f0ef6824 100644 +index e8f454aa3ae7f5646a2158b84c2281f5bbfdca4a..01ffcc13ff0bdc626e7518aeb4993f0403ab41e8 100644 --- a/chrome/browser/media/webrtc/native_desktop_media_list.cc +++ b/chrome/browser/media/webrtc/native_desktop_media_list.cc @@ -7,14 +7,15 @@ diff --git a/patches/chromium/disable_user_gesture_requirement_for_beforeunload_dialogs.patch b/patches/chromium/disable_user_gesture_requirement_for_beforeunload_dialogs.patch index f894e68d212a..a7d839ea2704 100644 --- a/patches/chromium/disable_user_gesture_requirement_for_beforeunload_dialogs.patch +++ b/patches/chromium/disable_user_gesture_requirement_for_beforeunload_dialogs.patch @@ -6,7 +6,7 @@ Subject: disable_user_gesture_requirement_for_beforeunload_dialogs.patch See https://github.com/electron/electron/issues/10754 diff --git a/third_party/blink/renderer/core/dom/document.cc b/third_party/blink/renderer/core/dom/document.cc -index 7be135720a40d819bf19afddce77670d721cfe59..1ceaf378636e16d5e93f5acc6ff42019fc87f680 100644 +index b29cd849621a012e06955fdef4970f8d85976002..39ab0f7988c3b8aa16fbc747f0a5b3200fcbb227 100644 --- a/third_party/blink/renderer/core/dom/document.cc +++ b/third_party/blink/renderer/core/dom/document.cc @@ -3653,7 +3653,9 @@ bool Document::DispatchBeforeUnloadEvent(ChromeClient* chrome_client, diff --git a/patches/chromium/exclude-a-few-test-files-from-build.patch b/patches/chromium/exclude-a-few-test-files-from-build.patch index b69ba84fb937..e86402a355a1 100644 --- a/patches/chromium/exclude-a-few-test-files-from-build.patch +++ b/patches/chromium/exclude-a-few-test-files-from-build.patch @@ -7,10 +7,10 @@ Compilation of those files fails with the Chromium 68. Remove the patch during the Chromium 69 upgrade. diff --git a/third_party/blink/renderer/platform/BUILD.gn b/third_party/blink/renderer/platform/BUILD.gn -index 070fd58b25aee470a861bd79c27f66470e80a271..ae07383907664394544bf4643044b2b43171a029 100644 +index 64ae02a700342c446aec62756180e25434eea46d..b1da69c1810fc502334dfc26130afec02a1c85db 100644 --- a/third_party/blink/renderer/platform/BUILD.gn +++ b/third_party/blink/renderer/platform/BUILD.gn -@@ -1713,7 +1713,7 @@ jumbo_source_set("blink_platform_unittests_sources") { +@@ -1715,7 +1715,7 @@ jumbo_source_set("blink_platform_unittests_sources") { "graphics/paint/drawing_display_item_test.cc", "graphics/paint/drawing_recorder_test.cc", "graphics/paint/float_clip_rect_test.cc", diff --git a/patches/chromium/frame_host_manager.patch b/patches/chromium/frame_host_manager.patch index 0c30394c90a7..060ed069d078 100644 --- a/patches/chromium/frame_host_manager.patch +++ b/patches/chromium/frame_host_manager.patch @@ -179,7 +179,7 @@ index a46901055bdf17b6b0dab14edf753b234dc04a12..113660b6eeff81d56a0415b0fa16211e size_t GetRelatedActiveContentsCount() override; bool RequiresDedicatedProcess() override; diff --git a/content/public/browser/content_browser_client.cc b/content/public/browser/content_browser_client.cc -index d15061de5254fd4f248fed92f47a1b1fcf34cd68..62d5e17f0599a78d679495d6fa674939d237602e 100644 +index 2dd31166cc52ccb528b338b63fde7d2fb4bbf63d..ce64276225d5b0acf684e9e70c600a64a56fe96e 100644 --- a/content/public/browser/content_browser_client.cc +++ b/content/public/browser/content_browser_client.cc @@ -52,6 +52,20 @@ void OverrideOnBindInterface(const service_manager::BindSourceInfo& remote_info, @@ -204,7 +204,7 @@ index d15061de5254fd4f248fed92f47a1b1fcf34cd68..62d5e17f0599a78d679495d6fa674939 const MainFunctionParams& parameters) { return nullptr; diff --git a/content/public/browser/content_browser_client.h b/content/public/browser/content_browser_client.h -index 8ceccd96c4e143921ace8db69685a9631e168dd2..136df7edaaaaaa1eb121ef7cf80aebc47969dc8d 100644 +index 04bfc1a4a804d1f5aa28f894e2feb816bbe80ffc..5bf7340b106bd3ce826ff3322106ef94cbe19d29 100644 --- a/content/public/browser/content_browser_client.h +++ b/content/public/browser/content_browser_client.h @@ -211,8 +211,41 @@ CONTENT_EXPORT void OverrideOnBindInterface( diff --git a/patches/chromium/printing.patch b/patches/chromium/printing.patch index 16ffd1f3ac90..5f140b98a545 100644 --- a/patches/chromium/printing.patch +++ b/patches/chromium/printing.patch @@ -1,15 +1,17 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Heilig Benedek -Date: Thu, 18 Oct 2018 17:08:18 -0700 -Subject: printing.patch +From: Shelley Vohr +Date: Fri, 7 Jun 2019 13:59:37 -0700 +Subject: fix: printing Add changeset that was previously applied to sources in chromium_src. The majority of changes originally come from these PRs: * https://github.com/electron/electron/pull/1835 * https://github.com/electron/electron/pull/8596 +This patch also fixes callback for manual user cancellation and success. + diff --git a/chrome/browser/printing/print_job_worker.cc b/chrome/browser/printing/print_job_worker.cc -index 88a6142eea4c7a219c08fe3463c44711f5c9fada..a1ec557f54cea6e976d357032328f2e10cc30054 100644 +index 88a6142eea4c7a219c08fe3463c44711f5c9fada..81db315a0036a123658697aa677e2356d1e56dfb 100644 --- a/chrome/browser/printing/print_job_worker.cc +++ b/chrome/browser/printing/print_job_worker.cc @@ -21,12 +21,12 @@ @@ -26,8 +28,25 @@ index 88a6142eea4c7a219c08fe3463c44711f5c9fada..a1ec557f54cea6e976d357032328f2e1 #include "printing/print_job_constants.h" #include "printing/printed_document.h" #include "printing/printing_utils.h" +@@ -225,7 +225,15 @@ void PrintJobWorker::UpdatePrintSettingsFromPOD( + + void PrintJobWorker::GetSettingsDone(SettingsCallback callback, + PrintingContext::Result result) { +- std::move(callback).Run(printing_context_->settings(), result); ++ if (result == PrintingContext::CANCEL) { ++ print_job_->PostTask( ++ FROM_HERE, ++ base::BindOnce(&NotificationCallback, base::RetainedRef(print_job_), ++ JobEventDetails::USER_INIT_CANCELED, 0, ++ base::RetainedRef(document_))); ++ } else { ++ std::move(callback).Run(printing_context_->settings(), result); ++ } + } + + void PrintJobWorker::GetSettingsWithUI(int document_page_count, diff --git a/chrome/browser/printing/print_view_manager_base.cc b/chrome/browser/printing/print_view_manager_base.cc -index 7ba43aada1ac44827cca264d6f37814e4a91f458..db011ba8370423723ff9d21be30cbf25db1e7537 100644 +index 7ba43aada1ac44827cca264d6f37814e4a91f458..c41b0c24974147e847baa21b9b48926158311aa0 100644 --- a/chrome/browser/printing/print_view_manager_base.cc +++ b/chrome/browser/printing/print_view_manager_base.cc @@ -27,10 +27,7 @@ @@ -62,7 +81,7 @@ index 7ba43aada1ac44827cca264d6f37814e4a91f458..db011ba8370423723ff9d21be30cbf25 base::AutoReset auto_reset(&is_dialog_shown, true); chrome::ShowWarningMessageBox(nullptr, base::string16(), message); -+#endif ++ #endif } #if BUILDFLAG(ENABLE_PRINT_PREVIEW) @@ -70,14 +89,14 @@ index 7ba43aada1ac44827cca264d6f37814e4a91f458..db011ba8370423723ff9d21be30cbf25 queue_(g_browser_process->print_job_manager()->queue()), weak_ptr_factory_(this) { DCHECK(queue_); -+#if 0 ++ #if 0 Profile* profile = Profile::FromBrowserContext(web_contents->GetBrowserContext()); printing_enabled_.Init( prefs::kPrintingEnabled, profile->GetPrefs(), base::Bind(&PrintViewManagerBase::UpdatePrintingEnabled, weak_ptr_factory_.GetWeakPtr())); -+#endif ++ #endif } PrintViewManagerBase::~PrintViewManagerBase() { @@ -121,7 +140,41 @@ index 7ba43aada1ac44827cca264d6f37814e4a91f458..db011ba8370423723ff9d21be30cbf25 #endif ReleasePrinterQuery(); -@@ -594,6 +599,9 @@ void PrintViewManagerBase::ReleasePrintJob() { +@@ -436,9 +441,12 @@ void PrintViewManagerBase::OnNotifyPrintJobEvent( + content::NotificationService::NoDetails()); + break; + } +- case JobEventDetails::USER_INIT_DONE: +- case JobEventDetails::DEFAULT_INIT_DONE: + case JobEventDetails::USER_INIT_CANCELED: { ++ ReleasePrintJob(); ++ break; ++ } ++ case JobEventDetails::USER_INIT_DONE: ++ case JobEventDetails::DEFAULT_INIT_DONE: { + NOTREACHED(); + break; + } +@@ -532,9 +540,6 @@ bool PrintViewManagerBase::CreateNewPrintJob(PrinterQuery* query) { + DCHECK(!quit_inner_loop_); + DCHECK(query); + +- // Disconnect the current |print_job_|. +- DisconnectFromCurrentPrintJob(); +- + // We can't print if there is no renderer. + if (!web_contents()->GetRenderViewHost() || + !web_contents()->GetRenderViewHost()->IsRenderViewLive()) { +@@ -544,8 +549,6 @@ bool PrintViewManagerBase::CreateNewPrintJob(PrinterQuery* query) { + DCHECK(!print_job_); + print_job_ = base::MakeRefCounted(); + print_job_->Initialize(query, RenderSourceName(), number_pages_); +- registrar_.Add(this, chrome::NOTIFICATION_PRINT_JOB_EVENT, +- content::Source(print_job_.get())); + printing_succeeded_ = false; + return true; + } +@@ -594,6 +597,9 @@ void PrintViewManagerBase::ReleasePrintJob() { content::RenderFrameHost* rfh = printing_rfh_; printing_rfh_ = nullptr; @@ -131,8 +184,27 @@ index 7ba43aada1ac44827cca264d6f37814e4a91f458..db011ba8370423723ff9d21be30cbf25 if (!print_job_) return; +@@ -604,7 +610,7 @@ void PrintViewManagerBase::ReleasePrintJob() { + } + + registrar_.Remove(this, chrome::NOTIFICATION_PRINT_JOB_EVENT, +- content::Source(print_job_.get())); ++ content::NotificationService::AllSources()); + // Don't close the worker thread. + print_job_ = nullptr; + } +@@ -674,6 +680,9 @@ bool PrintViewManagerBase::PrintNowInternal( + // Don't print / print preview interstitials or crashed tabs. + if (web_contents()->ShowingInterstitialPage() || web_contents()->IsCrashed()) + return false; ++ ++ registrar_.Add(this, chrome::NOTIFICATION_PRINT_JOB_EVENT, ++ content::NotificationService::AllSources()); + return rfh->Send(message.release()); + } + diff --git a/chrome/browser/printing/print_view_manager_base.h b/chrome/browser/printing/print_view_manager_base.h -index cf074791d0e2e17bbf8cf0b000b8d63e235b7deb..0838041cfe45d26dca65b549452535820191ae44 100644 +index cf074791d0e2e17bbf8cf0b000b8d63e235b7deb..c12107d0af1291c113e05bc1a9cc87e2466c8610 100644 --- a/chrome/browser/printing/print_view_manager_base.h +++ b/chrome/browser/printing/print_view_manager_base.h @@ -39,6 +39,8 @@ class PrintJob; @@ -159,14 +231,14 @@ index cf074791d0e2e17bbf8cf0b000b8d63e235b7deb..0838041cfe45d26dca65b54945253582 // The current RFH that is printing with a system printing dialog. content::RenderFrameHost* printing_rfh_; -+ // Responded with success of the print job. ++ // Respond with success of the print job. + CompletionCallback callback_; + // Indication of success of the print job. bool printing_succeeded_; diff --git a/chrome/browser/printing/printing_message_filter.cc b/chrome/browser/printing/printing_message_filter.cc -index 1f79e7b127f35e2eaef923af5c4a5f0a7e5250a5..b93d8f59850b59f74271233440d1a3b2d0aded46 100644 +index 1f79e7b127f35e2eaef923af5c4a5f0a7e5250a5..327b37dfbb84c60d7f0e339c3c4cb8ca3b3c9b26 100644 --- a/chrome/browser/printing/printing_message_filter.cc +++ b/chrome/browser/printing/printing_message_filter.cc @@ -21,6 +21,7 @@ @@ -196,11 +268,11 @@ index 1f79e7b127f35e2eaef923af5c4a5f0a7e5250a5..b93d8f59850b59f74271233440d1a3b2 + ->Get(browser_context) ->Subscribe(base::Bind(&PrintingMessageFilter::ShutdownOnUIThread, base::Unretained(this))); -+#if 0 ++ #if 0 is_printing_enabled_.Init(prefs::kPrintingEnabled, profile->GetPrefs()); is_printing_enabled_.MoveToThread( base::CreateSingleThreadTaskRunnerWithTraits({BrowserThread::IO})); -+#endif ++ #endif } PrintingMessageFilter::~PrintingMessageFilter() { @@ -208,13 +280,13 @@ index 1f79e7b127f35e2eaef923af5c4a5f0a7e5250a5..b93d8f59850b59f74271233440d1a3b2 void PrintingMessageFilter::OnGetDefaultPrintSettings(IPC::Message* reply_msg) { DCHECK_CURRENTLY_ON(BrowserThread::IO); scoped_refptr printer_query; -+#if 0 ++ #if 0 if (!is_printing_enabled_.GetValue()) { // Reply with NULL query. OnGetDefaultPrintSettingsReply(printer_query, reply_msg); return; } -+#endif ++ #endif printer_query = queue_->PopPrinterQuery(0); if (!printer_query.get()) { printer_query = @@ -222,13 +294,13 @@ index 1f79e7b127f35e2eaef923af5c4a5f0a7e5250a5..b93d8f59850b59f74271233440d1a3b2 base::Value job_settings, IPC::Message* reply_msg) { scoped_refptr printer_query; -+#if 0 ++ #if 0 if (!is_printing_enabled_.GetValue()) { // Reply with NULL query. OnUpdatePrintSettingsReply(printer_query, reply_msg); return; } -+#endif ++ #endif printer_query = queue_->PopPrinterQuery(document_cookie); if (!printer_query.get()) { printer_query = queue_->CreatePrinterQuery( @@ -283,7 +355,7 @@ index 1802034a6e15a6ad8b0d9591cfb79ba5873dc982..a827091facdb4f6b1d74ce826c3492ce // Like PrintMsg_PrintPages, but using the print preview document's frame/node. IPC_MESSAGE_ROUTED0(PrintMsg_PrintForSystemDialog) diff --git a/components/printing/renderer/print_render_frame_helper.cc b/components/printing/renderer/print_render_frame_helper.cc -index 74f26daa76a22c749007f06a7f4eeeafb8bb297b..5c54aad4e874d723dd4b9e5733449d2af6d9e047 100644 +index 74f26daa76a22c749007f06a7f4eeeafb8bb297b..2910edeefff446c2f178123185ee01c199df80be 100644 --- a/components/printing/renderer/print_render_frame_helper.cc +++ b/components/printing/renderer/print_render_frame_helper.cc @@ -1115,7 +1115,9 @@ void PrintRenderFrameHelper::ScriptedPrint(bool user_initiated) { @@ -378,7 +450,7 @@ index 74f26daa76a22c749007f06a7f4eeeafb8bb297b..5c54aad4e874d723dd4b9e5733449d2a - print_request_type, &print_settings); + if (!silent) + GetPrintSettingsFromUser(frame_ref.GetFrame(), node, expected_page_count, -+ print_request_type, &print_settings); ++ print_request_type, &print_settings); // Check if |this| is still valid. if (!self) return;