mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-23 12:51:06 +00:00
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
This commit is contained in:
parent
2d67c93b0d
commit
ea773f7d3c
@ -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<Promise> CanonicalBrowsingContext::Print(
|
||||
return promise.forget();
|
||||
}
|
||||
|
||||
RefPtr<embedding::PrintingParent> printingParent =
|
||||
browserParent->Manager()->GetPrintingParent();
|
||||
nsCOMPtr<nsIPrintSettingsService> 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<nsIPrintSettings> 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));
|
||||
}
|
||||
|
@ -136,7 +136,6 @@
|
||||
#include "nsXULPopupManager.h"
|
||||
|
||||
#ifdef NS_PRINTING
|
||||
# include "mozilla/embedding/printingui/PrintingParent.h"
|
||||
# include "nsIWebBrowserPrint.h"
|
||||
#endif
|
||||
|
||||
|
@ -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<nsPrintingProxy> 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(
|
||||
|
@ -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*);
|
||||
|
@ -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<PNeckoParent> 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<PrintingParent*>(printing)->Release();
|
||||
|
||||
mPrintingParent = nullptr;
|
||||
#else
|
||||
MOZ_ASSERT_UNREACHABLE("Should never have been created if no printing.");
|
||||
#endif
|
||||
return true;
|
||||
}
|
||||
|
||||
#ifdef NS_PRINTING
|
||||
already_AddRefed<embedding::PrintingParent> ContentParent::GetPrintingParent() {
|
||||
MOZ_ASSERT(mPrintingParent);
|
||||
|
||||
RefPtr<embedding::PrintingParent> printingParent = mPrintingParent;
|
||||
return printingParent.forget();
|
||||
}
|
||||
#endif
|
||||
|
||||
mozilla::ipc::IPCResult ContentParent::RecvInitStreamFilter(
|
||||
const uint64_t& aChannelId, const nsString& aAddonId,
|
||||
InitStreamFilterResolver&& aResolver) {
|
||||
|
@ -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<embedding::PrintingParent> 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<embedding::PrintingParent> mPrintingParent;
|
||||
#endif
|
||||
|
||||
// This hashtable is used to run GetFilesHelper objects in the parent process.
|
||||
// GetFilesHelper can be aborted by receiving RecvDeleteGetFilesRequest.
|
||||
nsRefPtrHashtable<nsIDHashKey, GetFilesHelper> mGetFilesPendingRequests;
|
||||
|
@ -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
|
||||
|
@ -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.
|
||||
|
@ -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
|
@ -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<nsIPrintSettings> 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
|
@ -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<nsIPrintSettingsService> mPrintSettingsSvc;
|
||||
};
|
||||
|
||||
} // namespace embedding
|
||||
} // namespace mozilla
|
||||
|
||||
#endif
|
@ -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",
|
||||
]
|
||||
|
||||
|
@ -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<nsPrintingProxy> sPrintingProxyInstance;
|
||||
|
||||
NS_IMPL_ISUPPORTS0(nsPrintingProxy)
|
||||
|
||||
nsPrintingProxy::nsPrintingProxy() = default;
|
||||
|
||||
nsPrintingProxy::~nsPrintingProxy() = default;
|
||||
|
||||
/* static */
|
||||
already_AddRefed<nsPrintingProxy> 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<nsPrintingProxy> inst = sPrintingProxyInstance.get();
|
||||
return inst.forget();
|
||||
}
|
||||
|
||||
nsresult nsPrintingProxy::Init() {
|
||||
mozilla::Unused << ContentChild::GetSingleton()->SendPPrintingConstructor(
|
||||
this);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
already_AddRefed<PRemotePrintJobChild>
|
||||
nsPrintingProxy::AllocPRemotePrintJobChild() {
|
||||
RefPtr<RemotePrintJobChild> remotePrintJob = new RemotePrintJobChild();
|
||||
return remotePrintJob.forget();
|
||||
}
|
@ -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<nsPrintingProxy> GetInstance();
|
||||
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
protected:
|
||||
already_AddRefed<PRemotePrintJobChild> AllocPRemotePrintJobChild() final;
|
||||
|
||||
private:
|
||||
nsPrintingProxy();
|
||||
|
||||
~nsPrintingProxy() final;
|
||||
|
||||
nsresult Init();
|
||||
};
|
||||
|
||||
#endif
|
@ -25,7 +25,7 @@ StaticRefPtr<nsPrintingPromptService> sSingleton;
|
||||
already_AddRefed<nsPrintingPromptService>
|
||||
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();
|
||||
|
@ -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}};
|
||||
|
||||
|
@ -5,6 +5,7 @@
|
||||
|
||||
#include "nsPrintSettingsServiceX.h"
|
||||
|
||||
#include "mozilla/embedding/PPrintingTypes.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsQueryObject.h"
|
||||
#include "nsPrintSettingsX.h"
|
||||
|
@ -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"
|
||||
|
@ -7,7 +7,6 @@
|
||||
#ifndef nsPrintSettingsService_h
|
||||
#define nsPrintSettingsService_h
|
||||
|
||||
#include "mozilla/embedding/PPrinting.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsIPrintSettings.h"
|
||||
#include "nsIPrintSettingsService.h"
|
||||
|
@ -7,7 +7,6 @@
|
||||
#ifndef nsPrintSettingsServiceWin_h
|
||||
#define nsPrintSettingsServiceWin_h
|
||||
|
||||
#include "mozilla/embedding/PPrinting.h"
|
||||
#include "nsPrintSettingsService.h"
|
||||
|
||||
class nsIPrintSettings;
|
||||
|
Loading…
Reference in New Issue
Block a user