summaryrefslogtreecommitdiffstats
path: root/toolkit/components/printingui/ipc/nsPrintingProxy.h
blob: ba99b35139524f49eef01c3aa50d018ffb065f45 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
/* -*- 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 nsIPrintingPromptService,
                              public mozilla::embedding::PPrintingChild {
  friend class mozilla::embedding::PPrintingChild;

 public:
  static already_AddRefed<nsPrintingProxy> GetInstance();

  NS_DECL_ISUPPORTS
  NS_DECL_NSIPRINTINGPROMPTSERVICE

  /**
   * Used to proxy nsIPrintSettings.savePrintSettingsToPrefs calls to the
   * parent process.
   *
   * @param aFlags - kInitSave* flags from nsIPrintSettings's to specify
   *          which settings to save.
   */
  nsresult SavePrintSettings(nsIPrintSettings* aPS, bool aUsePrinterNamePrefix,
                             uint32_t aFlags);

 protected:
  PPrintProgressDialogChild* AllocPPrintProgressDialogChild() final;

  bool DeallocPPrintProgressDialogChild(
      PPrintProgressDialogChild* aActor) final;

  PPrintSettingsDialogChild* AllocPPrintSettingsDialogChild() final;

  bool DeallocPPrintSettingsDialogChild(
      PPrintSettingsDialogChild* aActor) final;

  already_AddRefed<PRemotePrintJobChild> AllocPRemotePrintJobChild() final;

 private:
  nsPrintingProxy();

  ~nsPrintingProxy() final;

  nsresult Init();
};

#endif