widget/android/nsPrintSettingsServiceAndroid.cpp
author Jonathan Watt <jwatt@jwatt.org>
Tue, 19 Dec 2017 10:42:15 +0000
changeset 453511 2453d0c0d5acc940b6aacef3d32d9b120b80d36f
parent 453510 d7a4884fbc25e2cc2895b5e115960d26b927201b
child 508163 6f3709b3878117466168c40affa7bca0b60cf75b
permissions -rw-r--r--
Bug 144114 part 2 - Rename nsPrintOptions and its subclasses to nsPrintSettingsService*. r=bobowen MozReview-Commit-ID: HQSmyrMBdS8

/* -*- 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/. */
#include "nsPrintSettingsServiceAndroid.h"

#include "nsPrintSettingsImpl.h"

class nsPrintSettingsAndroid : public nsPrintSettings {
public:
  nsPrintSettingsAndroid()
  {
    // The aim here is to set up the objects enough that silent printing works
    SetOutputFormat(nsIPrintSettings::kOutputFormatPDF);
    SetPrinterName(NS_LITERAL_STRING("PDF printer"));
  }
};

nsresult
nsPrintSettingsServiceAndroid::_CreatePrintSettings(nsIPrintSettings** _retval)
{
  nsPrintSettings * printSettings = new nsPrintSettingsAndroid();
  NS_ENSURE_TRUE(printSettings, NS_ERROR_OUT_OF_MEMORY);
  NS_ADDREF(*_retval = printSettings);
  (void)InitPrintSettingsFromPrefs(*_retval, false,
                                   nsIPrintSettings::kInitSaveAll);
  return NS_OK;
}