Merge mozilla-central to autoland. CLOSED TREE
[gecko.git] / widget / nsDeviceContextSpecProxy.h
blob843811c34bd5897d7a5d0c31cca68c35698952f5
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"
14 #include "mozilla/gfx/PrintPromise.h"
16 class nsIFile;
17 class nsIUUIDGenerator;
19 namespace mozilla {
20 namespace layout {
21 class RemotePrintJobChild;
23 } // namespace mozilla
25 class nsDeviceContextSpecProxy final : public nsIDeviceContextSpec {
26 public:
27 using IntSize = mozilla::gfx::IntSize;
28 using RemotePrintJobChild = mozilla::layout::RemotePrintJobChild;
30 explicit nsDeviceContextSpecProxy(RemotePrintJobChild* aRemotePrintJob);
32 NS_DECL_ISUPPORTS
34 NS_IMETHOD Init(nsIPrintSettings* aPrintSettings, bool aIsPrintPreview) final;
36 already_AddRefed<PrintTarget> MakePrintTarget() final;
38 NS_IMETHOD GetDrawEventRecorder(
39 mozilla::gfx::DrawEventRecorder** aDrawEventRecorder) final;
41 NS_IMETHOD BeginDocument(const nsAString& aTitle,
42 const nsAString& aPrintToFileName,
43 int32_t aStartPage, int32_t aEndPage) final;
45 RefPtr<mozilla::gfx::PrintEndDocumentPromise> EndDocument() final;
47 NS_IMETHOD BeginPage(const IntSize& aSizeInPoints) final;
49 NS_IMETHOD EndPage() final;
51 private:
52 ~nsDeviceContextSpecProxy();
54 RefPtr<RemotePrintJobChild> mRemotePrintJob;
55 RefPtr<mozilla::layout::DrawEventRecorderPRFileDesc> mRecorder;
56 IntSize mCurrentPageSizeInPoints;
59 #endif // nsDeviceContextSpecProxy_h