widget/gtk/nsDeviceContextSpecG.h

Thu, 15 Jan 2015 15:59:08 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 15 Jan 2015 15:59:08 +0100
branch
TOR_BUG_9701
changeset 10
ac0c01689b40
permissions
-rw-r--r--

Implement a real Private Browsing Mode condition by changing the API/ABI;
This solves Tor bug #9701, complying with disk avoidance documented in
https://www.torproject.org/projects/torbrowser/design/#disk-avoidance.

michael@0 1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
michael@0 2 /* This Source Code Form is subject to the terms of the Mozilla Public
michael@0 3 * License, v. 2.0. If a copy of the MPL was not distributed with this
michael@0 4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
michael@0 5
michael@0 6 #ifndef nsDeviceContextSpecGTK_h___
michael@0 7 #define nsDeviceContextSpecGTK_h___
michael@0 8
michael@0 9 #include "nsIDeviceContextSpec.h"
michael@0 10 #include "nsIPrintSettings.h"
michael@0 11 #include "nsIPrintOptions.h"
michael@0 12 #include "nsCOMPtr.h"
michael@0 13 #include "nsString.h"
michael@0 14 #include "mozilla/Attributes.h"
michael@0 15
michael@0 16 #include "nsCRT.h" /* should be <limits.h>? */
michael@0 17
michael@0 18 #include <gtk/gtk.h>
michael@0 19 #if (MOZ_WIDGET_GTK == 2)
michael@0 20 #include <gtk/gtkprinter.h>
michael@0 21 #include <gtk/gtkprintjob.h>
michael@0 22 #else
michael@0 23 #include <gtk/gtkunixprint.h>
michael@0 24 #endif
michael@0 25
michael@0 26 #define NS_PORTRAIT 0
michael@0 27 #define NS_LANDSCAPE 1
michael@0 28
michael@0 29 typedef enum
michael@0 30 {
michael@0 31 pmInvalid = 0,
michael@0 32 pmPostScript
michael@0 33 } PrintMethod;
michael@0 34
michael@0 35 class nsDeviceContextSpecGTK : public nsIDeviceContextSpec
michael@0 36 {
michael@0 37 public:
michael@0 38 nsDeviceContextSpecGTK();
michael@0 39
michael@0 40 NS_DECL_ISUPPORTS
michael@0 41
michael@0 42 NS_IMETHOD GetSurfaceForPrinter(gfxASurface **surface);
michael@0 43
michael@0 44 NS_IMETHOD Init(nsIWidget *aWidget, nsIPrintSettings* aPS, bool aIsPrintPreview);
michael@0 45 NS_IMETHOD BeginDocument(const nsAString& aTitle, char16_t * aPrintToFileName, int32_t aStartPage, int32_t aEndPage);
michael@0 46 NS_IMETHOD EndDocument();
michael@0 47 NS_IMETHOD BeginPage() { return NS_OK; }
michael@0 48 NS_IMETHOD EndPage() { return NS_OK; }
michael@0 49
michael@0 50 NS_IMETHOD GetPath (const char **aPath);
michael@0 51 static nsresult GetPrintMethod(const char *aPrinter, PrintMethod &aMethod);
michael@0 52 virtual ~nsDeviceContextSpecGTK();
michael@0 53
michael@0 54 protected:
michael@0 55 nsCOMPtr<nsIPrintSettings> mPrintSettings;
michael@0 56 bool mToPrinter : 1; /* If true, print to printer */
michael@0 57 bool mIsPPreview : 1; /* If true, is print preview */
michael@0 58 char mPath[PATH_MAX]; /* If toPrinter = false, dest file */
michael@0 59 char mPrinter[256]; /* Printer name */
michael@0 60 GtkPrintJob* mPrintJob;
michael@0 61 GtkPrinter* mGtkPrinter;
michael@0 62 GtkPrintSettings* mGtkPrintSettings;
michael@0 63 GtkPageSetup* mGtkPageSetup;
michael@0 64
michael@0 65 nsCString mSpoolName;
michael@0 66 nsCOMPtr<nsIFile> mSpoolFile;
michael@0 67
michael@0 68 };
michael@0 69
michael@0 70 //-------------------------------------------------------------------------
michael@0 71 // Printer Enumerator
michael@0 72 //-------------------------------------------------------------------------
michael@0 73 class nsPrinterEnumeratorGTK MOZ_FINAL : public nsIPrinterEnumerator
michael@0 74 {
michael@0 75 public:
michael@0 76 nsPrinterEnumeratorGTK();
michael@0 77 NS_DECL_ISUPPORTS
michael@0 78 NS_DECL_NSIPRINTERENUMERATOR
michael@0 79 };
michael@0 80
michael@0 81 #endif /* !nsDeviceContextSpecGTK_h___ */

mercurial