Line data Source code
1 : /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /* vim: set sw=4 ts=8 et 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/. */
6 :
7 : #ifndef mozilla_embedding_PrintingParent_h
8 : #define mozilla_embedding_PrintingParent_h
9 :
10 : #include "mozilla/dom/PBrowserParent.h"
11 : #include "mozilla/embedding/PPrintingParent.h"
12 :
13 : class nsIPrintSettingsService;
14 : class nsIWebProgressListener;
15 : class nsPIDOMWindowOuter;
16 : class PPrintProgressDialogParent;
17 : class PPrintSettingsDialogParent;
18 :
19 : namespace mozilla {
20 : namespace layout {
21 : class PRemotePrintJobParent;
22 : class RemotePrintJobParent;
23 : }
24 :
25 : namespace embedding {
26 :
27 : class PrintingParent final : public PPrintingParent
28 : {
29 : public:
30 1 : NS_INLINE_DECL_REFCOUNTING(PrintingParent)
31 :
32 : virtual mozilla::ipc::IPCResult
33 : RecvShowProgress(PBrowserParent* parent,
34 : PPrintProgressDialogParent* printProgressDialog,
35 : PRemotePrintJobParent* remotePrintJob,
36 : const bool& isForPrinting);
37 : virtual mozilla::ipc::IPCResult
38 : RecvShowPrintDialog(PPrintSettingsDialogParent* aDialog,
39 : PBrowserParent* aParent,
40 : const PrintData& aData);
41 :
42 : virtual mozilla::ipc::IPCResult
43 : RecvSavePrintSettings(const PrintData& data,
44 : const bool& usePrinterNamePrefix,
45 : const uint32_t& flags,
46 : nsresult* rv);
47 :
48 : virtual PPrintProgressDialogParent*
49 : AllocPPrintProgressDialogParent();
50 :
51 : virtual bool
52 : DeallocPPrintProgressDialogParent(PPrintProgressDialogParent* aActor);
53 :
54 : virtual PPrintSettingsDialogParent*
55 : AllocPPrintSettingsDialogParent();
56 :
57 : virtual bool
58 : DeallocPPrintSettingsDialogParent(PPrintSettingsDialogParent* aActor);
59 :
60 : virtual PRemotePrintJobParent*
61 : AllocPRemotePrintJobParent();
62 :
63 : virtual bool
64 : DeallocPRemotePrintJobParent(PRemotePrintJobParent* aActor);
65 :
66 : virtual void
67 : ActorDestroy(ActorDestroyReason aWhy);
68 :
69 : MOZ_IMPLICIT PrintingParent();
70 :
71 : /**
72 : * Serialize nsIPrintSettings to PrintData ready for sending to a child
73 : * process. A RemotePrintJob will be created and added to the PrintData.
74 : * An optional progress listener can be given, which will be registered
75 : * with the RemotePrintJob, so that progress can be tracked in the parent.
76 : *
77 : * @param aPrintSettings optional print settings to serialize, otherwise a
78 : * default print settings will be used.
79 : * @param aProgressListener optional print progress listener.
80 : * @param aRemotePrintJob optional remote print job, so that an existing
81 : * one can be used.
82 : * @param aPrintData PrintData to populate.
83 : */
84 : nsresult
85 : SerializeAndEnsureRemotePrintJob(nsIPrintSettings* aPrintSettings,
86 : nsIWebProgressListener* aListener,
87 : layout::RemotePrintJobParent* aRemotePrintJob,
88 : PrintData* aPrintData);
89 :
90 : private:
91 : virtual ~PrintingParent();
92 :
93 : nsPIDOMWindowOuter*
94 : DOMWindowFromBrowserParent(PBrowserParent* parent);
95 :
96 : nsresult
97 : ShowPrintDialog(PBrowserParent* parent,
98 : const PrintData& data,
99 : PrintData* result);
100 :
101 : nsCOMPtr<nsIPrintSettingsService> mPrintSettingsSvc;
102 : };
103 :
104 : } // namespace embedding
105 : } // namespace mozilla
106 :
107 : #endif
|