Bug 1769547 - Do not MOZ_CRASH() on missing process r=nika
[gecko.git] / widget / nsDeviceContextSpecProxy.h
blob4bb8010a11e508d2845f4a2f477b2229f6d12784
1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
3 /* This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
7 #ifndef nsDeviceContextSpecProxy_h
8 #define nsDeviceContextSpecProxy_h
10 #include "nsIDeviceContextSpec.h"
11 #include "nsCOMPtr.h"
12 #include "nsString.h"
13 #include "mozilla/layout/printing/DrawEventRecorder.h"
15 class nsIFile;
16 class nsIUUIDGenerator;
18 namespace mozilla {
19 namespace layout {
20 class RemotePrintJobChild;
22 } // namespace mozilla
24 class nsDeviceContextSpecProxy final : public nsIDeviceContextSpec {
25 public:
26 using RemotePrintJobChild = mozilla::layout::RemotePrintJobChild;
28 explicit nsDeviceContextSpecProxy(RemotePrintJobChild* aRemotePrintJob);
30 NS_DECL_ISUPPORTS
32 NS_IMETHOD Init(nsIWidget* aWidget, nsIPrintSettings* aPrintSettings,
33 bool aIsPrintPreview) final;
35 already_AddRefed<PrintTarget> MakePrintTarget() final;
37 NS_IMETHOD GetDrawEventRecorder(
38 mozilla::gfx::DrawEventRecorder** aDrawEventRecorder) final;
40 float GetDPI() final;
42 float GetPrintingScale() final;
44 gfxPoint GetPrintingTranslate() final;
46 NS_IMETHOD BeginDocument(const nsAString& aTitle,
47 const nsAString& aPrintToFileName,
48 int32_t aStartPage, int32_t aEndPage) final;
50 NS_IMETHOD EndDocument() final;
52 NS_IMETHOD AbortDocument() final;
54 NS_IMETHOD BeginPage() final;
56 NS_IMETHOD EndPage() final;
58 private:
59 ~nsDeviceContextSpecProxy();
61 nsCOMPtr<nsIPrintSettings> mPrintSettings;
62 nsCOMPtr<nsIDeviceContextSpec> mRealDeviceContextSpec;
63 RefPtr<RemotePrintJobChild> mRemotePrintJob;
64 RefPtr<mozilla::layout::DrawEventRecorderPRFileDesc> mRecorder;
67 #endif // nsDeviceContextSpecProxy_h