Bug 1405210 - Part 1: Add PrintDialogService to windows widget. r=jimm,mshal

In order to move print native dialog code to windows widget, this patch will
create skeleton of PrintDialogService to windows widget.
Toolkit code(i.e. nsIPrintingPrompotService) will call this PrintDialogService.

Note that this PrintingDialogService suppose running on main process, so we
should call this interface from main process(i.e. nsPrintingPromptService, not
nsPrintingProxy).

MozReview-Commit-ID: 3P6kac9I9W4

--HG--
extra : rebase_source : 5b5ecd104cf4cecd1b68a3d6d4b33aca9fea9548
This commit is contained in:
Mantaroh Yoshinaga 2017-10-19 11:04:13 +09:00
parent 88c4f8f959
commit bcd8f8c970
6 changed files with 81 additions and 2 deletions

View File

@ -38,8 +38,6 @@ toolkit = CONFIG['MOZ_WIDGET_TOOLKIT']
if toolkit in ('cocoa', 'android', 'uikit'):
DIRS += [toolkit]
if toolkit in ('android', 'cocoa', 'gtk2', 'gtk3'):
EXPORTS += ['nsIPrintDialogService.h']
if toolkit == 'windows':
DIRS += ['windows']
@ -127,6 +125,7 @@ EXPORTS += [
'nsIDeviceContextSpec.h',
'nsIKeyEventInPluginCallback.h',
'nsIPluginWidget.h',
'nsIPrintDialogService.h',
'nsIRollupListener.h',
'nsIWidget.h',
'nsIWidgetListener.h',

View File

@ -95,6 +95,7 @@ if CONFIG['MOZ_CRASHREPORTER']:
if CONFIG['NS_PRINTING']:
UNIFIED_SOURCES += [
'nsDeviceContextSpecWin.cpp',
'nsPrintDialogWin.cpp',
'nsPrintOptionsWin.cpp',
'nsPrintSettingsWin.cpp',
]

View File

@ -0,0 +1,43 @@
/* -*- 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 "nsPrintDialogWin.h"
#include "nsIBaseWindow.h"
#include "nsIPrintSettings.h"
#include "nsIWebBrowserChrome.h"
using namespace mozilla;
NS_IMPL_ISUPPORTS(nsPrintDialogServiceWin, nsIPrintDialogService)
nsPrintDialogServiceWin::nsPrintDialogServiceWin()
{
}
nsPrintDialogServiceWin::~nsPrintDialogServiceWin()
{
}
NS_IMETHODIMP
nsPrintDialogServiceWin::Init()
{
return NS_OK;
}
NS_IMETHODIMP
nsPrintDialogServiceWin::Show(nsPIDOMWindowOuter *aParent,
nsIPrintSettings *aSettings,
nsIWebBrowserPrint *aWebBrowserPrint)
{
return NS_OK;
}
NS_IMETHODIMP
nsPrintDialogServiceWin::ShowPageSetup(nsPIDOMWindowOuter *aParent,
nsIPrintSettings *aNSSettings)
{
return NS_OK;
}

View File

@ -0,0 +1,30 @@
/* -*- 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 nsPrintDialog_h__
#define nsPrintDialog_h__
#include "nsIPrintDialogService.h"
class nsIPrintSettings;
class nsPrintDialogServiceWin : public nsIPrintDialogService
{
virtual ~nsPrintDialogServiceWin();
public:
nsPrintDialogServiceWin();
NS_DECL_ISUPPORTS
NS_IMETHOD Init() override;
NS_IMETHOD Show(nsPIDOMWindowOuter *aParent, nsIPrintSettings *aSettings,
nsIWebBrowserPrint *aWebBrowserPrint) override;
NS_IMETHOD ShowPageSetup(nsPIDOMWindowOuter *aParent,
nsIPrintSettings *aSettings) override;
};
#endif

View File

@ -49,6 +49,7 @@
#ifdef NS_PRINTING
#include "nsDeviceContextSpecWin.h"
#include "nsPrintDialogWin.h"
#include "nsPrintOptionsWin.h"
#include "nsPrintSession.h"
#endif
@ -138,6 +139,7 @@ NS_GENERIC_FACTORY_CONSTRUCTOR(nsDragService)
NS_GENERIC_FACTORY_CONSTRUCTOR(nsBidiKeyboard)
NS_GENERIC_FACTORY_CONSTRUCTOR(TaskbarPreviewCallback)
#ifdef NS_PRINTING
NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsPrintDialogServiceWin, Init)
NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsPrintOptionsWin, Init)
NS_GENERIC_FACTORY_CONSTRUCTOR(nsPrinterEnumeratorWin)
NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsPrintSession, Init)
@ -176,6 +178,7 @@ NS_DEFINE_NAMED_CID(NS_DRAGSERVICE_CID);
NS_DEFINE_NAMED_CID(NS_BIDIKEYBOARD_CID);
NS_DEFINE_NAMED_CID(NS_TASKBARPREVIEWCALLBACK_CID);
#ifdef NS_PRINTING
NS_DEFINE_NAMED_CID(NS_PRINTDIALOGSERVICE_CID);
NS_DEFINE_NAMED_CID(NS_PRINTSETTINGSSERVICE_CID);
NS_DEFINE_NAMED_CID(NS_PRINTER_ENUMERATOR_CID);
NS_DEFINE_NAMED_CID(NS_PRINTSESSION_CID);
@ -210,6 +213,7 @@ static const mozilla::Module::CIDEntry kWidgetCIDs[] = {
{ &kNS_BIDIKEYBOARD_CID, false, nullptr, nsBidiKeyboardConstructor, Module::MAIN_PROCESS_ONLY },
{ &kNS_TASKBARPREVIEWCALLBACK_CID, false, nullptr, TaskbarPreviewCallbackConstructor },
#ifdef NS_PRINTING
{ &kNS_PRINTDIALOGSERVICE_CID, false, nullptr, nsPrintDialogServiceWinConstructor, Module::MAIN_PROCESS_ONLY },
{ &kNS_PRINTSETTINGSSERVICE_CID, false, nullptr, nsPrintOptionsWinConstructor },
{ &kNS_PRINTER_ENUMERATOR_CID, false, nullptr, nsPrinterEnumeratorWinConstructor },
{ &kNS_PRINTSESSION_CID, false, nullptr, nsPrintSessionConstructor },
@ -244,6 +248,7 @@ static const mozilla::Module::ContractIDEntry kWidgetContracts[] = {
{ "@mozilla.org/widget/bidikeyboard;1", &kNS_BIDIKEYBOARD_CID, Module::MAIN_PROCESS_ONLY },
{ "@mozilla.org/widget/taskbar-preview-callback;1", &kNS_TASKBARPREVIEWCALLBACK_CID },
#ifdef NS_PRINTING
{ NS_PRINTDIALOGSERVICE_CONTRACTID, &kNS_PRINTDIALOGSERVICE_CID },
{ "@mozilla.org/gfx/printsettings-service;1", &kNS_PRINTSETTINGSSERVICE_CID },
{ "@mozilla.org/gfx/printerenumerator;1", &kNS_PRINTER_ENUMERATOR_CID },
{ "@mozilla.org/gfx/printsession;1", &kNS_PRINTSESSION_CID },

View File

@ -11,6 +11,7 @@
#include "WinUtils.h"
#include "npapi.h"
#include "nsAutoPtr.h"
#include "nsIPresShell.h"
using namespace mozilla;
using namespace mozilla::widget;