michael@0: /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #include "nsPrintingPromptService.h" michael@0: michael@0: #include "nsCOMPtr.h" michael@0: #include "nsServiceManagerUtils.h" michael@0: #include "nsObjCExceptions.h" michael@0: michael@0: #include "nsIPrintingPromptService.h" michael@0: #include "nsIFactory.h" michael@0: #include "nsIPrintDialogService.h" michael@0: michael@0: //***************************************************************************** michael@0: // nsPrintingPromptService michael@0: //***************************************************************************** michael@0: michael@0: NS_IMPL_ISUPPORTS(nsPrintingPromptService, nsIPrintingPromptService, nsIWebProgressListener) michael@0: michael@0: nsPrintingPromptService::nsPrintingPromptService() michael@0: { michael@0: } michael@0: michael@0: nsPrintingPromptService::~nsPrintingPromptService() michael@0: { michael@0: } michael@0: michael@0: nsresult nsPrintingPromptService::Init() michael@0: { michael@0: return NS_OK; michael@0: } michael@0: michael@0: //***************************************************************************** michael@0: // nsPrintingPromptService::nsIPrintingPromptService michael@0: //***************************************************************************** michael@0: michael@0: NS_IMETHODIMP michael@0: nsPrintingPromptService::ShowPrintDialog(nsIDOMWindow *parent, nsIWebBrowserPrint *webBrowserPrint, nsIPrintSettings *printSettings) michael@0: { michael@0: NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NSRESULT; michael@0: michael@0: nsCOMPtr dlgPrint(do_GetService( michael@0: NS_PRINTDIALOGSERVICE_CONTRACTID)); michael@0: if (dlgPrint) michael@0: return dlgPrint->Show(parent, printSettings, webBrowserPrint); michael@0: michael@0: return NS_ERROR_FAILURE; michael@0: michael@0: NS_OBJC_END_TRY_ABORT_BLOCK_NSRESULT; michael@0: } michael@0: michael@0: NS_IMETHODIMP michael@0: nsPrintingPromptService::ShowProgress(nsIDOMWindow* parent, michael@0: nsIWebBrowserPrint* webBrowserPrint, // ok to be null michael@0: nsIPrintSettings* printSettings, // ok to be null michael@0: nsIObserver* openDialogObserver, // ok to be null michael@0: bool isForPrinting, michael@0: nsIWebProgressListener** webProgressListener, michael@0: nsIPrintProgressParams** printProgressParams, michael@0: bool* notifyOnOpen) michael@0: { michael@0: return NS_ERROR_NOT_IMPLEMENTED; michael@0: } michael@0: michael@0: NS_IMETHODIMP michael@0: nsPrintingPromptService::ShowPageSetup(nsIDOMWindow *parent, nsIPrintSettings *printSettings, nsIObserver *aObs) michael@0: { michael@0: NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NSRESULT; michael@0: nsCOMPtr dlgPrint(do_GetService( michael@0: NS_PRINTDIALOGSERVICE_CONTRACTID)); michael@0: if (dlgPrint) michael@0: return dlgPrint->ShowPageSetup(parent, printSettings); michael@0: michael@0: return NS_ERROR_FAILURE; michael@0: michael@0: NS_OBJC_END_TRY_ABORT_BLOCK_NSRESULT; michael@0: } michael@0: michael@0: NS_IMETHODIMP michael@0: nsPrintingPromptService::ShowPrinterProperties(nsIDOMWindow *parent, const char16_t *printerName, nsIPrintSettings *printSettings) michael@0: { michael@0: return NS_ERROR_NOT_IMPLEMENTED; michael@0: } michael@0: michael@0: michael@0: //***************************************************************************** michael@0: // nsPrintingPromptService::nsIWebProgressListener michael@0: //***************************************************************************** michael@0: michael@0: NS_IMETHODIMP michael@0: nsPrintingPromptService::OnStateChange(nsIWebProgress *aWebProgress, nsIRequest *aRequest, uint32_t aStateFlags, nsresult aStatus) michael@0: { michael@0: return NS_OK; michael@0: } michael@0: michael@0: /* void onProgressChange (in nsIWebProgress aWebProgress, in nsIRequest aRequest, in long aCurSelfProgress, in long aMaxSelfProgress, in long aCurTotalProgress, in long aMaxTotalProgress); */ michael@0: NS_IMETHODIMP michael@0: nsPrintingPromptService::OnProgressChange(nsIWebProgress *aWebProgress, nsIRequest *aRequest, int32_t aCurSelfProgress, int32_t aMaxSelfProgress, int32_t aCurTotalProgress, int32_t aMaxTotalProgress) michael@0: { michael@0: return NS_OK; michael@0: } michael@0: michael@0: /* void onLocationChange (in nsIWebProgress aWebProgress, in nsIRequest aRequest, in nsIURI location, in unsigned long aFlags); */ michael@0: NS_IMETHODIMP michael@0: nsPrintingPromptService::OnLocationChange(nsIWebProgress *aWebProgress, nsIRequest *aRequest, nsIURI *location, uint32_t aFlags) michael@0: { michael@0: return NS_OK; michael@0: } michael@0: michael@0: /* void onStatusChange (in nsIWebProgress aWebProgress, in nsIRequest aRequest, in nsresult aStatus, in wstring aMessage); */ michael@0: NS_IMETHODIMP michael@0: nsPrintingPromptService::OnStatusChange(nsIWebProgress *aWebProgress, nsIRequest *aRequest, nsresult aStatus, const char16_t *aMessage) michael@0: { michael@0: return NS_OK; michael@0: } michael@0: michael@0: /* void onSecurityChange (in nsIWebProgress aWebProgress, in nsIRequest aRequest, in unsigned long state); */ michael@0: NS_IMETHODIMP michael@0: nsPrintingPromptService::OnSecurityChange(nsIWebProgress *aWebProgress, nsIRequest *aRequest, uint32_t state) michael@0: { michael@0: return NS_OK; michael@0: }