From ea773f7d3cd71da81df359f6f713453d5fc35a34 Mon Sep 17 00:00:00 2001 From: Jonathan Watt Date: Tue, 26 Apr 2022 14:30:29 +0000 Subject: [PATCH] Bug 1763989. Remove the PPrinting and nsPrintingProxy code. r=bobowen Bug 1757395 basically removed the reason for PPrinting to exist. What remained essentially just added an unnecessary layer of complexity/indirection to the creation of PRmotePrintJob actors. Differential Revision: https://phabricator.services.mozilla.com/D143330 --- docshell/base/CanonicalBrowsingContext.cpp | 37 ++++++++-- dom/base/nsFrameLoader.cpp | 1 - dom/ipc/ContentChild.cpp | 23 +----- dom/ipc/ContentChild.h | 4 +- dom/ipc/ContentParent.cpp | 46 ------------ dom/ipc/ContentParent.h | 19 ----- dom/ipc/PContent.ipdl | 8 +- layout/printing/ipc/PRemotePrintJob.ipdl | 4 +- .../components/printingui/ipc/PPrinting.ipdl | 26 ------- .../printingui/ipc/PrintingParent.cpp | 73 ------------------- .../printingui/ipc/PrintingParent.h | 59 --------------- toolkit/components/printingui/ipc/moz.build | 15 ---- .../printingui/ipc/nsPrintingProxy.cpp | 64 ---------------- .../printingui/ipc/nsPrintingProxy.h | 38 ---------- .../printingui/nsPrintingPromptService.cpp | 2 +- toolkit/xre/nsEmbeddingModule.cpp | 17 ++--- widget/cocoa/nsPrintSettingsServiceX.mm | 1 + widget/nsPrintSettingsService.cpp | 3 +- widget/nsPrintSettingsService.h | 1 - widget/windows/nsPrintSettingsServiceWin.h | 1 - 20 files changed, 47 insertions(+), 395 deletions(-) delete mode 100644 toolkit/components/printingui/ipc/PPrinting.ipdl delete mode 100644 toolkit/components/printingui/ipc/PrintingParent.cpp delete mode 100644 toolkit/components/printingui/ipc/PrintingParent.h delete mode 100644 toolkit/components/printingui/ipc/nsPrintingProxy.cpp delete mode 100644 toolkit/components/printingui/ipc/nsPrintingProxy.h diff --git a/docshell/base/CanonicalBrowsingContext.cpp b/docshell/base/CanonicalBrowsingContext.cpp index 7a4f93535dc9..c744d4c02a8c 100644 --- a/docshell/base/CanonicalBrowsingContext.cpp +++ b/docshell/base/CanonicalBrowsingContext.cpp @@ -25,11 +25,14 @@ #include "mozilla/dom/ContentPlaybackController.h" #include "mozilla/dom/SessionStorageManager.h" #include "mozilla/ipc/ProtocolUtils.h" +#include "mozilla/layout/RemotePrintJobParent.h" #include "mozilla/net/DocumentLoadListener.h" #include "mozilla/NullPrincipal.h" #include "mozilla/StaticPrefs_docshell.h" #include "mozilla/StaticPrefs_fission.h" #include "mozilla/Telemetry.h" +#include "nsIPrintSettings.h" +#include "nsIPrintSettingsService.h" #include "nsISupports.h" #include "nsIWebNavigation.h" #include "mozilla/MozPromiseInlines.h" @@ -51,10 +54,6 @@ #include "nsImportModule.h" #include "UnitTransforms.h" -#ifdef NS_PRINTING -# include "mozilla/embedding/printingui/PrintingParent.h" -#endif - using namespace mozilla::ipc; extern mozilla::LazyLogModule gAutoplayPermissionLog; @@ -708,17 +707,39 @@ already_AddRefed CanonicalBrowsingContext::Print( return promise.forget(); } - RefPtr printingParent = - browserParent->Manager()->GetPrintingParent(); + nsCOMPtr printSettingsSvc = + do_GetService("@mozilla.org/gfx/printsettings-service;1"); + if (NS_WARN_IF(!printSettingsSvc)) { + promise->MaybeReject(ErrorResult(NS_ERROR_FAILURE)); + return promise.forget(); + } + + nsresult rv; + nsCOMPtr printSettings = aPrintSettings; + if (!printSettings) { + rv = printSettingsSvc->GetNewPrintSettings(getter_AddRefs(printSettings)); + if (NS_WARN_IF(NS_FAILED(rv))) { + promise->MaybeReject(ErrorResult(rv)); + return promise.forget(); + } + } embedding::PrintData printData; - nsresult rv = printingParent->SerializeAndEnsureRemotePrintJob( - aPrintSettings, listener, nullptr, &printData); + rv = printSettingsSvc->SerializeToPrintData(printSettings, &printData); if (NS_WARN_IF(NS_FAILED(rv))) { promise->MaybeReject(ErrorResult(rv)); return promise.forget(); } + layout::RemotePrintJobParent* remotePrintJob = + new layout::RemotePrintJobParent(printSettings); + printData.remotePrintJobParent() = + browserParent->Manager()->SendPRemotePrintJobConstructor(remotePrintJob); + + if (listener) { + remotePrintJob->RegisterListener(listener); + } + if (NS_WARN_IF(!browserParent->SendPrint(this, printData))) { promise->MaybeReject(ErrorResult(NS_ERROR_FAILURE)); } diff --git a/dom/base/nsFrameLoader.cpp b/dom/base/nsFrameLoader.cpp index c2f3b2cac39d..879816241b0b 100644 --- a/dom/base/nsFrameLoader.cpp +++ b/dom/base/nsFrameLoader.cpp @@ -136,7 +136,6 @@ #include "nsXULPopupManager.h" #ifdef NS_PRINTING -# include "mozilla/embedding/printingui/PrintingParent.h" # include "nsIWebBrowserPrint.h" #endif diff --git a/dom/ipc/ContentChild.cpp b/dom/ipc/ContentChild.cpp index 9a091dc4164f..c31932b06e9d 100644 --- a/dom/ipc/ContentChild.cpp +++ b/dom/ipc/ContentChild.cpp @@ -109,6 +109,7 @@ #include "mozilla/layers/CompositorManagerChild.h" #include "mozilla/layers/ContentProcessController.h" #include "mozilla/layers/ImageBridgeChild.h" +#include "mozilla/layout/RemotePrintJobChild.h" #include "mozilla/loader/ScriptCacheActors.h" #include "mozilla/media/MediaChild.h" #include "mozilla/net/CaptivePortalService.h" @@ -194,9 +195,6 @@ #include "nsThreadManager.h" #include "nsVariant.h" #include "nsXULAppAPI.h" -#ifdef NS_PRINTING -# include "nsPrintingProxy.h" -#endif #include "IHistory.h" #include "ReferrerInfo.h" #include "base/message_loop.h" @@ -801,12 +799,6 @@ void ContentChild::Init(base::ProcessId aParentPid, const char* aParentBuildID, mID = aChildID; mIsForBrowser = aIsForBrowser; -#ifdef NS_PRINTING - // Force the creation of the nsPrintingProxy so that it's IPC counterpart, - // PrintingParent, is always available for printing initiated from the parent. - RefPtr printingProxy = nsPrintingProxy::GetInstance(); -#endif - SetProcessName("Web Content"_ns); #ifdef NIGHTLY_BUILD @@ -2025,17 +2017,8 @@ mozilla::ipc::IPCResult ContentChild::RecvSocketProcessCrashed() { return IPC_OK(); } -PPrintingChild* ContentChild::AllocPPrintingChild() { - // The ContentParent should never attempt to allocate the nsPrintingProxy, - // which implements PPrintingChild. Instead, the nsPrintingProxy service is - // requested and instantiated via XPCOM, and the constructor of - // nsPrintingProxy sets up the IPC connection. - MOZ_CRASH("Should never get here!"); - return nullptr; -} - -bool ContentChild::DeallocPPrintingChild(PPrintingChild* printing) { - return true; +PRemotePrintJobChild* ContentChild::AllocPRemotePrintJobChild() { + return new RemotePrintJobChild(); } PChildToParentStreamChild* ContentChild::SendPChildToParentStreamConstructor( diff --git a/dom/ipc/ContentChild.h b/dom/ipc/ContentChild.h index e6cf72443c24..2987b634e29a 100644 --- a/dom/ipc/ContentChild.h +++ b/dom/ipc/ContentChild.h @@ -230,9 +230,7 @@ class ContentChild final : public PContentChild, PScriptCacheChild*, const FileDescOrError& cacheFile, const bool& wantCacheData) override; - PPrintingChild* AllocPPrintingChild(); - - bool DeallocPPrintingChild(PPrintingChild*); + PRemotePrintJobChild* AllocPRemotePrintJobChild(); PChildToParentStreamChild* AllocPChildToParentStreamChild(); bool DeallocPChildToParentStreamChild(PChildToParentStreamChild*); diff --git a/dom/ipc/ContentParent.cpp b/dom/ipc/ContentParent.cpp index 2598f980aadc..bda1a5ad1c5e 100644 --- a/dom/ipc/ContentParent.cpp +++ b/dom/ipc/ContentParent.cpp @@ -134,7 +134,6 @@ #include "mozilla/dom/nsMixedContentBlocker.h" #include "mozilla/dom/power/PowerManagerService.h" #include "mozilla/dom/quota/QuotaManagerService.h" -#include "mozilla/embedding/printingui/PrintingParent.h" #include "mozilla/extensions/ExtensionsParent.h" #include "mozilla/extensions/StreamFilterParent.h" #include "mozilla/gfx/GPUProcessManager.h" @@ -4328,51 +4327,6 @@ already_AddRefed ContentParent::AllocPNeckoParent() { return actor.forget(); } -PPrintingParent* ContentParent::AllocPPrintingParent() { -#ifdef NS_PRINTING - if (mPrintingParent) { - // Only one PrintingParent should be created per process. - return nullptr; - } - - // Create the printing singleton for this process. - mPrintingParent = new PrintingParent(); - - // Take another reference for IPDL code. - mPrintingParent.get()->AddRef(); - - return mPrintingParent.get(); -#else - MOZ_ASSERT_UNREACHABLE("Should never be created if no printing."); - return nullptr; -#endif -} - -bool ContentParent::DeallocPPrintingParent(PPrintingParent* printing) { -#ifdef NS_PRINTING - MOZ_RELEASE_ASSERT( - mPrintingParent == printing, - "Only one PrintingParent should have been created per process."); - - // Release reference taken for IPDL code. - static_cast(printing)->Release(); - - mPrintingParent = nullptr; -#else - MOZ_ASSERT_UNREACHABLE("Should never have been created if no printing."); -#endif - return true; -} - -#ifdef NS_PRINTING -already_AddRefed ContentParent::GetPrintingParent() { - MOZ_ASSERT(mPrintingParent); - - RefPtr printingParent = mPrintingParent; - return printingParent.forget(); -} -#endif - mozilla::ipc::IPCResult ContentParent::RecvInitStreamFilter( const uint64_t& aChannelId, const nsString& aAddonId, InitStreamFilterResolver&& aResolver) { diff --git a/dom/ipc/ContentParent.h b/dom/ipc/ContentParent.h index b6276ef19df0..c8ea333249b6 100644 --- a/dom/ipc/ContentParent.h +++ b/dom/ipc/ContentParent.h @@ -74,10 +74,6 @@ class BenchmarkStorageParent; using mozilla::loader::PScriptCacheParent; -namespace embedding { -class PrintingParent; -} - namespace ipc { class CrashReporterHost; class PFileDescriptorSetParent; @@ -450,17 +446,6 @@ class ContentParent final return PContentParent::RecvPNeckoConstructor(aActor); } - PPrintingParent* AllocPPrintingParent(); - - bool DeallocPPrintingParent(PPrintingParent* aActor); - -#if defined(NS_PRINTING) - /** - * @return the PrintingParent for this ContentParent. - */ - already_AddRefed GetPrintingParent(); -#endif - mozilla::ipc::IPCResult RecvInitStreamFilter( const uint64_t& aChannelId, const nsString& aAddonId, InitStreamFilterResolver&& aResolver); @@ -1615,10 +1600,6 @@ class ContentParent final sSandboxBrokerPolicyFactory; #endif -#ifdef NS_PRINTING - RefPtr mPrintingParent; -#endif - // This hashtable is used to run GetFilesHelper objects in the parent process. // GetFilesHelper can be aborted by receiving RecvDeleteGetFilesRequest. nsRefPtrHashtable mGetFilesPendingRequests; diff --git a/dom/ipc/PContent.ipdl b/dom/ipc/PContent.ipdl index 85bc9c2a7b9b..63225d45e854 100644 --- a/dom/ipc/PContent.ipdl +++ b/dom/ipc/PContent.ipdl @@ -19,6 +19,7 @@ include protocol PHeapSnapshotTempFileHelper; include protocol PProcessHangMonitor; include protocol PImageBridge; include protocol PRemoteLazyInputStream; +include protocol PRemotePrintJob; include protocol PLoginReputation; include protocol PMedia; include protocol PNecko; @@ -26,7 +27,6 @@ include protocol PStreamFilter; include protocol PGMPContent; include protocol PGMPService; include protocol PGMP; -include protocol PPrinting; include protocol PChildToParentStream; include protocol PParentToChildStream; #ifdef MOZ_WEBSPEECH @@ -468,9 +468,9 @@ sync protocol PContent manages PHandlerService; manages PHeapSnapshotTempFileHelper; manages PRemoteLazyInputStream; + manages PRemotePrintJob; manages PMedia; manages PNecko; - manages PPrinting; manages PChildToParentStream; manages PParentToChildStream; #ifdef MOZ_WEBSPEECH @@ -1035,6 +1035,8 @@ child: // details. async InitNextGenLocalStorageEnabled(bool enabled); + async PRemotePrintJob(); + parent: async SynchronizeLayoutHistoryState(MaybeDiscardedBrowsingContext aContext, @@ -1085,8 +1087,6 @@ parent: async PNecko(); - async PPrinting(); - async PChildToParentStream(); #ifdef MOZ_WEBSPEECH diff --git a/layout/printing/ipc/PRemotePrintJob.ipdl b/layout/printing/ipc/PRemotePrintJob.ipdl index e90da7aab430..d8a250516a6c 100644 --- a/layout/printing/ipc/PRemotePrintJob.ipdl +++ b/layout/printing/ipc/PRemotePrintJob.ipdl @@ -4,7 +4,7 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -include protocol PPrinting; +include protocol PContent; namespace mozilla { namespace layout { @@ -12,7 +12,7 @@ namespace layout { [ChildImpl=virtual, ParentImpl=virtual] async protocol PRemotePrintJob { - manager PPrinting; + manager PContent; both: // Tell either side to abort printing and clean up. diff --git a/toolkit/components/printingui/ipc/PPrinting.ipdl b/toolkit/components/printingui/ipc/PPrinting.ipdl deleted file mode 100644 index d09fbae2d247..000000000000 --- a/toolkit/components/printingui/ipc/PPrinting.ipdl +++ /dev/null @@ -1,26 +0,0 @@ -/* -*- Mode: C++; c-basic-offset: 2; indent-tabs-mode: nil; tab-width: 8 -*- */ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -include PPrintingTypes; -include protocol PContent; -include protocol PBrowser; -include protocol PRemotePrintJob; - -namespace mozilla { -namespace embedding { - -[ManualDealloc, ChildImpl=virtual, ParentImpl=virtual] -sync protocol PPrinting -{ - manager PContent; - manages PRemotePrintJob; - -child: - async PRemotePrintJob(); - async __delete__(); -}; - -} // namespace embedding -} // namespace mozilla diff --git a/toolkit/components/printingui/ipc/PrintingParent.cpp b/toolkit/components/printingui/ipc/PrintingParent.cpp deleted file mode 100644 index cbb9205ad04d..000000000000 --- a/toolkit/components/printingui/ipc/PrintingParent.cpp +++ /dev/null @@ -1,73 +0,0 @@ -/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* vim: set ts=8 sts=2 et sw=2 tw=80: */ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -#include "mozilla/dom/Element.h" -#include "mozilla/dom/BrowserParent.h" -#include "mozilla/Preferences.h" -#include "mozilla/Unused.h" -#include "nsIContent.h" -#include "mozilla/dom/Document.h" -#include "nsIPrintingPromptService.h" -#include "nsIPrintSettingsService.h" -#include "nsServiceManagerUtils.h" -#include "PrintingParent.h" -#include "mozilla/layout/RemotePrintJobParent.h" -#include "mozilla/StaticPrefs_print.h" - -using namespace mozilla; -using namespace mozilla::dom; -using namespace mozilla::layout; - -namespace mozilla { -namespace embedding { -void PrintingParent::ActorDestroy(ActorDestroyReason aWhy) {} - -nsresult PrintingParent::SerializeAndEnsureRemotePrintJob( - nsIPrintSettings* aPrintSettings, nsIWebProgressListener* aListener, - layout::RemotePrintJobParent* aRemotePrintJob, PrintData* aPrintData) { - MOZ_ASSERT(aPrintData); - - nsresult rv; - nsCOMPtr printSettings; - if (aPrintSettings) { - printSettings = aPrintSettings; - } else { - rv = mPrintSettingsSvc->GetNewPrintSettings(getter_AddRefs(printSettings)); - if (NS_WARN_IF(NS_FAILED(rv))) { - return rv; - } - } - - rv = mPrintSettingsSvc->SerializeToPrintData(printSettings, aPrintData); - if (NS_WARN_IF(NS_FAILED(rv))) { - return rv; - } - - RemotePrintJobParent* remotePrintJob; - if (aRemotePrintJob) { - remotePrintJob = aRemotePrintJob; - aPrintData->remotePrintJobParent() = remotePrintJob; - } else { - remotePrintJob = new RemotePrintJobParent(aPrintSettings); - aPrintData->remotePrintJobParent() = - SendPRemotePrintJobConstructor(remotePrintJob); - } - if (aListener) { - remotePrintJob->RegisterListener(aListener); - } - - return NS_OK; -} - -PrintingParent::PrintingParent() { - mPrintSettingsSvc = do_GetService("@mozilla.org/gfx/printsettings-service;1"); - MOZ_ASSERT(mPrintSettingsSvc); -} - -PrintingParent::~PrintingParent() = default; - -} // namespace embedding -} // namespace mozilla diff --git a/toolkit/components/printingui/ipc/PrintingParent.h b/toolkit/components/printingui/ipc/PrintingParent.h deleted file mode 100644 index f42aa2b0dbb0..000000000000 --- a/toolkit/components/printingui/ipc/PrintingParent.h +++ /dev/null @@ -1,59 +0,0 @@ -/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* vim: set sw=2 ts=8 et tw=80 : */ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -#ifndef mozilla_embedding_PrintingParent_h -#define mozilla_embedding_PrintingParent_h - -#include "mozilla/dom/PBrowserParent.h" -#include "mozilla/embedding/PPrintingParent.h" - -class nsIPrintSettingsService; -class nsIWebProgressListener; -class nsPIDOMWindowOuter; - -namespace mozilla { -namespace layout { -class PRemotePrintJobParent; -class RemotePrintJobParent; -} // namespace layout - -namespace embedding { - -class PrintingParent final : public PPrintingParent { - public: - NS_INLINE_DECL_REFCOUNTING(PrintingParent) - - void ActorDestroy(ActorDestroyReason aWhy) final; - - MOZ_IMPLICIT PrintingParent(); - - /** - * Serialize nsIPrintSettings to PrintData ready for sending to a child - * process. A RemotePrintJob will be created and added to the PrintData. - * An optional progress listener can be given, which will be registered - * with the RemotePrintJob, so that progress can be tracked in the parent. - * - * @param aPrintSettings optional print settings to serialize, otherwise a - * default print settings will be used. - * @param aProgressListener optional print progress listener. - * @param aRemotePrintJob optional remote print job, so that an existing - * one can be used. - * @param aPrintData PrintData to populate. - */ - nsresult SerializeAndEnsureRemotePrintJob( - nsIPrintSettings* aPrintSettings, nsIWebProgressListener* aListener, - layout::RemotePrintJobParent* aRemotePrintJob, PrintData* aPrintData); - - private: - ~PrintingParent() final; - - nsCOMPtr mPrintSettingsSvc; -}; - -} // namespace embedding -} // namespace mozilla - -#endif diff --git a/toolkit/components/printingui/ipc/moz.build b/toolkit/components/printingui/ipc/moz.build index fdef0f2fe830..a2aaeae1e532 100644 --- a/toolkit/components/printingui/ipc/moz.build +++ b/toolkit/components/printingui/ipc/moz.build @@ -4,22 +4,7 @@ # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. -EXPORTS += [ - "nsPrintingProxy.h", -] - -EXPORTS.mozilla.embedding.printingui += [ - "PrintingParent.h", -] - -if CONFIG["NS_PRINTING"]: - UNIFIED_SOURCES += [ - "nsPrintingProxy.cpp", - "PrintingParent.cpp", - ] - IPDL_SOURCES += [ - "PPrinting.ipdl", "PPrintingTypes.ipdlh", ] diff --git a/toolkit/components/printingui/ipc/nsPrintingProxy.cpp b/toolkit/components/printingui/ipc/nsPrintingProxy.cpp deleted file mode 100644 index 9edcb2a1bb68..000000000000 --- a/toolkit/components/printingui/ipc/nsPrintingProxy.cpp +++ /dev/null @@ -1,64 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -#include "nsPrintingProxy.h" - -#include "mozilla/ClearOnShutdown.h" -#include "mozilla/dom/ContentChild.h" -#include "mozilla/dom/BrowserChild.h" -#include "mozilla/layout/RemotePrintJobChild.h" -#include "mozilla/SpinEventLoopUntil.h" -#include "mozilla/Unused.h" -#include "nsIDocShell.h" -#include "nsIPrintingPromptService.h" -#include "nsIPrintSession.h" -#include "nsPIDOMWindow.h" -#include "nsPrintSettingsService.h" -#include "nsServiceManagerUtils.h" - -using namespace mozilla; -using namespace mozilla::dom; -using namespace mozilla::embedding; -using namespace mozilla::layout; - -static StaticRefPtr sPrintingProxyInstance; - -NS_IMPL_ISUPPORTS0(nsPrintingProxy) - -nsPrintingProxy::nsPrintingProxy() = default; - -nsPrintingProxy::~nsPrintingProxy() = default; - -/* static */ -already_AddRefed nsPrintingProxy::GetInstance() { - if (!sPrintingProxyInstance) { - sPrintingProxyInstance = new nsPrintingProxy(); - if (!sPrintingProxyInstance) { - return nullptr; - } - nsresult rv = sPrintingProxyInstance->Init(); - if (NS_FAILED(rv)) { - sPrintingProxyInstance = nullptr; - return nullptr; - } - ClearOnShutdown(&sPrintingProxyInstance); - } - - RefPtr inst = sPrintingProxyInstance.get(); - return inst.forget(); -} - -nsresult nsPrintingProxy::Init() { - mozilla::Unused << ContentChild::GetSingleton()->SendPPrintingConstructor( - this); - return NS_OK; -} - -already_AddRefed -nsPrintingProxy::AllocPRemotePrintJobChild() { - RefPtr remotePrintJob = new RemotePrintJobChild(); - return remotePrintJob.forget(); -} diff --git a/toolkit/components/printingui/ipc/nsPrintingProxy.h b/toolkit/components/printingui/ipc/nsPrintingProxy.h deleted file mode 100644 index e51fd9c95f95..000000000000 --- a/toolkit/components/printingui/ipc/nsPrintingProxy.h +++ /dev/null @@ -1,38 +0,0 @@ -/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -#ifndef __nsPrintingProxy_h -#define __nsPrintingProxy_h - -#include "nsIPrintingPromptService.h" -#include "mozilla/embedding/PPrintingChild.h" - -namespace mozilla { -namespace layout { -class PRemotePrintJobChild; -} -} // namespace mozilla - -class nsPrintingProxy final : public nsISupports, - public mozilla::embedding::PPrintingChild { - friend class mozilla::embedding::PPrintingChild; - - public: - static already_AddRefed GetInstance(); - - NS_DECL_ISUPPORTS - - protected: - already_AddRefed AllocPRemotePrintJobChild() final; - - private: - nsPrintingProxy(); - - ~nsPrintingProxy() final; - - nsresult Init(); -}; - -#endif diff --git a/toolkit/components/printingui/nsPrintingPromptService.cpp b/toolkit/components/printingui/nsPrintingPromptService.cpp index 75f25c9cf841..a263e51e0857 100644 --- a/toolkit/components/printingui/nsPrintingPromptService.cpp +++ b/toolkit/components/printingui/nsPrintingPromptService.cpp @@ -25,7 +25,7 @@ StaticRefPtr sSingleton; already_AddRefed nsPrintingPromptService::GetSingleton() { MOZ_ASSERT(XRE_IsParentProcess(), - "The content process must use nsPrintingProxy"); + "The content process must not try to open printing prompts"); if (!sSingleton) { sSingleton = new nsPrintingPromptService(); diff --git a/toolkit/xre/nsEmbeddingModule.cpp b/toolkit/xre/nsEmbeddingModule.cpp index 8a384f65a3f5..59c5da42f317 100644 --- a/toolkit/xre/nsEmbeddingModule.cpp +++ b/toolkit/xre/nsEmbeddingModule.cpp @@ -7,29 +7,22 @@ #if defined(NS_PRINTING) # include "nsPrintingPromptService.h" -# include "nsPrintingProxy.h" NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(nsPrintingPromptService, nsPrintingPromptService::GetSingleton) -# ifdef PROXY_PRINTING -NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(nsPrintingProxy, - nsPrintingProxy::GetInstance) -# endif NS_DEFINE_NAMED_CID(NS_PRINTINGPROMPTSERVICE_CID); #endif static const mozilla::Module::CIDEntry kEmbeddingCIDs[] = { #if defined(NS_PRINTING) + {&kNS_PRINTINGPROMPTSERVICE_CID, false, nullptr, + nsPrintingPromptServiceConstructor # ifdef PROXY_PRINTING - {&kNS_PRINTINGPROMPTSERVICE_CID, false, nullptr, - nsPrintingPromptServiceConstructor, mozilla::Module::MAIN_PROCESS_ONLY}, - {&kNS_PRINTINGPROMPTSERVICE_CID, false, nullptr, nsPrintingProxyConstructor, - mozilla::Module::CONTENT_PROCESS_ONLY}, -# else - {&kNS_PRINTINGPROMPTSERVICE_CID, false, nullptr, - nsPrintingPromptServiceConstructor}, + , + mozilla::Module::MAIN_PROCESS_ONLY # endif + }, #endif {nullptr}}; diff --git a/widget/cocoa/nsPrintSettingsServiceX.mm b/widget/cocoa/nsPrintSettingsServiceX.mm index 4be66dddeb7e..75987800860c 100644 --- a/widget/cocoa/nsPrintSettingsServiceX.mm +++ b/widget/cocoa/nsPrintSettingsServiceX.mm @@ -5,6 +5,7 @@ #include "nsPrintSettingsServiceX.h" +#include "mozilla/embedding/PPrintingTypes.h" #include "nsCOMPtr.h" #include "nsQueryObject.h" #include "nsPrintSettingsX.h" diff --git a/widget/nsPrintSettingsService.cpp b/widget/nsPrintSettingsService.cpp index 2af0b2ff7b21..d6360d612892 100644 --- a/widget/nsPrintSettingsService.cpp +++ b/widget/nsPrintSettingsService.cpp @@ -5,12 +5,11 @@ #include "nsPrintSettingsService.h" -#include "mozilla/embedding/PPrinting.h" +#include "mozilla/embedding/PPrintingTypes.h" #include "mozilla/layout/RemotePrintJobChild.h" #include "mozilla/RefPtr.h" #include "nsCoord.h" #include "nsIPrinterList.h" -#include "nsPrintingProxy.h" #include "nsReadableUtils.h" #include "nsPrintSettingsImpl.h" #include "nsIPrintSession.h" diff --git a/widget/nsPrintSettingsService.h b/widget/nsPrintSettingsService.h index 5370075d0475..43965455a12f 100644 --- a/widget/nsPrintSettingsService.h +++ b/widget/nsPrintSettingsService.h @@ -7,7 +7,6 @@ #ifndef nsPrintSettingsService_h #define nsPrintSettingsService_h -#include "mozilla/embedding/PPrinting.h" #include "nsCOMPtr.h" #include "nsIPrintSettings.h" #include "nsIPrintSettingsService.h" diff --git a/widget/windows/nsPrintSettingsServiceWin.h b/widget/windows/nsPrintSettingsServiceWin.h index 88a5b22b51c0..e11d307a8b2d 100644 --- a/widget/windows/nsPrintSettingsServiceWin.h +++ b/widget/windows/nsPrintSettingsServiceWin.h @@ -7,7 +7,6 @@ #ifndef nsPrintSettingsServiceWin_h #define nsPrintSettingsServiceWin_h -#include "mozilla/embedding/PPrinting.h" #include "nsPrintSettingsService.h" class nsIPrintSettings;