--- a/toolkit/components/printingui/mac/nsPrintingPromptService.cpp
+++ b/toolkit/components/printingui/mac/nsPrintingPromptService.cpp
@@ -12,101 +12,123 @@
#include "nsIFactory.h"
#include "nsIPrintDialogService.h"
#include "nsPIDOMWindow.h"
//*****************************************************************************
// nsPrintingPromptService
//*****************************************************************************
-NS_IMPL_ISUPPORTS(nsPrintingPromptService, nsIPrintingPromptService, nsIWebProgressListener)
+NS_IMPL_ISUPPORTS(nsPrintingPromptService,
+ nsIPrintingPromptService,
+ nsIWebProgressListener)
-nsPrintingPromptService::nsPrintingPromptService()
-{
-}
+nsPrintingPromptService::nsPrintingPromptService() = default;
nsPrintingPromptService::~nsPrintingPromptService() = default;
-nsresult nsPrintingPromptService::Init()
+nsresult
+nsPrintingPromptService::Init()
{
- return NS_OK;
+ return NS_OK;
}
//*****************************************************************************
// nsPrintingPromptService::nsIPrintingPromptService
//*****************************************************************************
NS_IMETHODIMP
-nsPrintingPromptService::ShowPrintDialog(mozIDOMWindowProxy *parent, nsIWebBrowserPrint *webBrowserPrint, nsIPrintSettings *printSettings)
+nsPrintingPromptService::ShowPrintDialog(mozIDOMWindowProxy* parent,
+ nsIWebBrowserPrint* webBrowserPrint,
+ nsIPrintSettings* printSettings)
{
- nsCOMPtr<nsIPrintDialogService> dlgPrint(do_GetService(
- NS_PRINTDIALOGSERVICE_CONTRACTID));
+ nsCOMPtr<nsIPrintDialogService> dlgPrint(
+ do_GetService(NS_PRINTDIALOGSERVICE_CONTRACTID));
if (dlgPrint) {
- return dlgPrint->Show(nsPIDOMWindowOuter::From(parent), printSettings,
- webBrowserPrint);
+ return dlgPrint->Show(
+ nsPIDOMWindowOuter::From(parent), printSettings, webBrowserPrint);
}
return NS_ERROR_FAILURE;
}
NS_IMETHODIMP
-nsPrintingPromptService::ShowProgress(mozIDOMWindowProxy* parent,
- nsIWebBrowserPrint* webBrowserPrint, // ok to be null
- nsIPrintSettings* printSettings, // ok to be null
- nsIObserver* openDialogObserver, // ok to be null
- bool isForPrinting,
- nsIWebProgressListener** webProgressListener,
- nsIPrintProgressParams** printProgressParams,
- bool* notifyOnOpen)
+nsPrintingPromptService::ShowProgress(
+ mozIDOMWindowProxy* parent,
+ nsIWebBrowserPrint* webBrowserPrint, // ok to be null
+ nsIPrintSettings* printSettings, // ok to be null
+ nsIObserver* openDialogObserver, // ok to be null
+ bool isForPrinting,
+ nsIWebProgressListener** webProgressListener,
+ nsIPrintProgressParams** printProgressParams,
+ bool* notifyOnOpen)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
-nsPrintingPromptService::ShowPageSetup(mozIDOMWindowProxy *parent, nsIPrintSettings *printSettings, nsIObserver *aObs)
+nsPrintingPromptService::ShowPageSetup(mozIDOMWindowProxy* parent,
+ nsIPrintSettings* printSettings,
+ nsIObserver* aObs)
{
- nsCOMPtr<nsIPrintDialogService> dlgPrint(do_GetService(
- NS_PRINTDIALOGSERVICE_CONTRACTID));
+ nsCOMPtr<nsIPrintDialogService> dlgPrint(
+ do_GetService(NS_PRINTDIALOGSERVICE_CONTRACTID));
if (dlgPrint) {
- return dlgPrint->ShowPageSetup(nsPIDOMWindowOuter::From(parent), printSettings);
+ return dlgPrint->ShowPageSetup(nsPIDOMWindowOuter::From(parent),
+ printSettings);
}
return NS_ERROR_FAILURE;
}
-
//*****************************************************************************
// nsPrintingPromptService::nsIWebProgressListener
//*****************************************************************************
NS_IMETHODIMP
-nsPrintingPromptService::OnStateChange(nsIWebProgress *aWebProgress, nsIRequest *aRequest, uint32_t aStateFlags, nsresult aStatus)
+nsPrintingPromptService::OnStateChange(nsIWebProgress* aWebProgress,
+ nsIRequest* aRequest,
+ uint32_t aStateFlags,
+ nsresult aStatus)
{
- return NS_OK;
+ return NS_OK;
}
/* void onProgressChange (in nsIWebProgress aWebProgress, in nsIRequest aRequest, in long aCurSelfProgress, in long aMaxSelfProgress, in long aCurTotalProgress, in long aMaxTotalProgress); */
NS_IMETHODIMP
-nsPrintingPromptService::OnProgressChange(nsIWebProgress *aWebProgress, nsIRequest *aRequest, int32_t aCurSelfProgress, int32_t aMaxSelfProgress, int32_t aCurTotalProgress, int32_t aMaxTotalProgress)
+nsPrintingPromptService::OnProgressChange(nsIWebProgress* aWebProgress,
+ nsIRequest* aRequest,
+ int32_t aCurSelfProgress,
+ int32_t aMaxSelfProgress,
+ int32_t aCurTotalProgress,
+ int32_t aMaxTotalProgress)
{
- return NS_OK;
+ return NS_OK;
}
/* void onLocationChange (in nsIWebProgress aWebProgress, in nsIRequest aRequest, in nsIURI location, in unsigned long aFlags); */
NS_IMETHODIMP
-nsPrintingPromptService::OnLocationChange(nsIWebProgress *aWebProgress, nsIRequest *aRequest, nsIURI *location, uint32_t aFlags)
+nsPrintingPromptService::OnLocationChange(nsIWebProgress* aWebProgress,
+ nsIRequest* aRequest,
+ nsIURI* location,
+ uint32_t aFlags)
{
- return NS_OK;
+ return NS_OK;
}
/* void onStatusChange (in nsIWebProgress aWebProgress, in nsIRequest aRequest, in nsresult aStatus, in wstring aMessage); */
NS_IMETHODIMP
-nsPrintingPromptService::OnStatusChange(nsIWebProgress *aWebProgress, nsIRequest *aRequest, nsresult aStatus, const char16_t *aMessage)
+nsPrintingPromptService::OnStatusChange(nsIWebProgress* aWebProgress,
+ nsIRequest* aRequest,
+ nsresult aStatus,
+ const char16_t* aMessage)
{
- return NS_OK;
+ return NS_OK;
}
/* void onSecurityChange (in nsIWebProgress aWebProgress, in nsIRequest aRequest, in unsigned long state); */
NS_IMETHODIMP
-nsPrintingPromptService::OnSecurityChange(nsIWebProgress *aWebProgress, nsIRequest *aRequest, uint32_t state)
+nsPrintingPromptService::OnSecurityChange(nsIWebProgress* aWebProgress,
+ nsIRequest* aRequest,
+ uint32_t state)
{
- return NS_OK;
+ return NS_OK;
}
--- a/toolkit/components/printingui/mac/nsPrintingPromptService.h
+++ b/toolkit/components/printingui/mac/nsPrintingPromptService.h
@@ -2,31 +2,37 @@
/* 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 __nsPrintingPromptService_h
#define __nsPrintingPromptService_h
// {E042570C-62DE-4bb6-A6E0-798E3C07B4DF}
-#define NS_PRINTINGPROMPTSERVICE_CID \
- {0xe042570c, 0x62de, 0x4bb6, { 0xa6, 0xe0, 0x79, 0x8e, 0x3c, 0x7, 0xb4, 0xdf}}
-#define NS_PRINTINGPROMPTSERVICE_CONTRACTID \
- "@mozilla.org/embedcomp/printingprompt-service;1"
+#define NS_PRINTINGPROMPTSERVICE_CID \
+ { \
+ 0xe042570c, 0x62de, 0x4bb6, \
+ { \
+ 0xa6, 0xe0, 0x79, 0x8e, 0x3c, 0x7, 0xb4, 0xdf \
+ } \
+ }
+#define NS_PRINTINGPROMPTSERVICE_CONTRACTID \
+ "@mozilla.org/embedcomp/printingprompt-service;1"
#include "nsCOMPtr.h"
#include "nsIPrintingPromptService.h"
#include "nsPIPromptService.h"
#include "nsIWindowWatcher.h"
// Printing Progress Includes
#include "nsIWebProgressListener.h"
-class nsPrintingPromptService: public nsIPrintingPromptService,
- public nsIWebProgressListener
+class nsPrintingPromptService
+ : public nsIPrintingPromptService
+ , public nsIWebProgressListener
{
public:
nsPrintingPromptService();
nsresult Init();
NS_DECL_NSIPRINTINGPROMPTSERVICE
NS_DECL_NSIWEBPROGRESSLISTENER
--- a/toolkit/components/printingui/unixshared/nsPrintingPromptService.cpp
+++ b/toolkit/components/printingui/unixshared/nsPrintingPromptService.cpp
@@ -10,151 +10,181 @@
#include "nsISupportsUtils.h"
#include "nsString.h"
#include "nsIPrintDialogService.h"
// Printing Progress Includes
#include "nsPrintProgress.h"
#include "nsPrintProgressParams.h"
-static const char *kPrintProgressDialogURL = "chrome://global/content/printProgress.xul";
-static const char *kPrtPrvProgressDialogURL = "chrome://global/content/printPreviewProgress.xul";
-
-NS_IMPL_ISUPPORTS(nsPrintingPromptService, nsIPrintingPromptService, nsIWebProgressListener)
+static const char* kPrintProgressDialogURL =
+ "chrome://global/content/printProgress.xul";
+static const char* kPrtPrvProgressDialogURL =
+ "chrome://global/content/printPreviewProgress.xul";
-nsPrintingPromptService::nsPrintingPromptService()
-{
-}
+NS_IMPL_ISUPPORTS(nsPrintingPromptService,
+ nsIPrintingPromptService,
+ nsIWebProgressListener)
-nsPrintingPromptService::~nsPrintingPromptService()
-{
-}
+nsPrintingPromptService::nsPrintingPromptService() = default;
+
+nsPrintingPromptService::~nsPrintingPromptService() = default;
nsresult
nsPrintingPromptService::Init()
{
- nsresult rv;
- mWatcher = do_GetService(NS_WINDOWWATCHER_CONTRACTID, &rv);
- return rv;
+ nsresult rv;
+ mWatcher = do_GetService(NS_WINDOWWATCHER_CONTRACTID, &rv);
+ return rv;
}
NS_IMETHODIMP
-nsPrintingPromptService::ShowPrintDialog(mozIDOMWindowProxy *parent,
- nsIWebBrowserPrint *webBrowserPrint,
- nsIPrintSettings *printSettings)
+nsPrintingPromptService::ShowPrintDialog(mozIDOMWindowProxy* parent,
+ nsIWebBrowserPrint* webBrowserPrint,
+ nsIPrintSettings* printSettings)
{
- NS_ENSURE_ARG(webBrowserPrint);
- NS_ENSURE_ARG(printSettings);
+ NS_ENSURE_ARG(webBrowserPrint);
+ NS_ENSURE_ARG(printSettings);
- nsCOMPtr<nsIPrintDialogService> dlgPrint(do_GetService(
- NS_PRINTDIALOGSERVICE_CONTRACTID));
- if (dlgPrint)
- return dlgPrint->Show(nsPIDOMWindowOuter::From(parent),
- printSettings, webBrowserPrint);
+ nsCOMPtr<nsIPrintDialogService> dlgPrint(
+ do_GetService(NS_PRINTDIALOGSERVICE_CONTRACTID));
+ if (dlgPrint)
+ return dlgPrint->Show(
+ nsPIDOMWindowOuter::From(parent), printSettings, webBrowserPrint);
- return NS_ERROR_FAILURE;
+ return NS_ERROR_FAILURE;
}
NS_IMETHODIMP
-nsPrintingPromptService::ShowProgress(mozIDOMWindowProxy* parent,
- nsIWebBrowserPrint* webBrowserPrint, // ok to be null
- nsIPrintSettings* printSettings, // ok to be null
- nsIObserver* openDialogObserver, // ok to be null
- bool isForPrinting,
- nsIWebProgressListener** webProgressListener,
- nsIPrintProgressParams** printProgressParams,
- bool* notifyOnOpen)
+nsPrintingPromptService::ShowProgress(
+ mozIDOMWindowProxy* parent,
+ nsIWebBrowserPrint* webBrowserPrint, // ok to be null
+ nsIPrintSettings* printSettings, // ok to be null
+ nsIObserver* openDialogObserver, // ok to be null
+ bool isForPrinting,
+ nsIWebProgressListener** webProgressListener,
+ nsIPrintProgressParams** printProgressParams,
+ bool* notifyOnOpen)
{
- NS_ENSURE_ARG(webProgressListener);
- NS_ENSURE_ARG(printProgressParams);
- NS_ENSURE_ARG(notifyOnOpen);
+ NS_ENSURE_ARG(webProgressListener);
+ NS_ENSURE_ARG(printProgressParams);
+ NS_ENSURE_ARG(notifyOnOpen);
- *notifyOnOpen = false;
+ *notifyOnOpen = false;
- nsPrintProgress* prtProgress = new nsPrintProgress(printSettings);
- mPrintProgress = prtProgress;
- mWebProgressListener = prtProgress;
+ nsPrintProgress* prtProgress = new nsPrintProgress(printSettings);
+ mPrintProgress = prtProgress;
+ mWebProgressListener = prtProgress;
- nsCOMPtr<nsIPrintProgressParams> prtProgressParams = new nsPrintProgressParams();
-
- nsCOMPtr<mozIDOMWindowProxy> parentWindow = parent;
+ nsCOMPtr<nsIPrintProgressParams> prtProgressParams =
+ new nsPrintProgressParams();
- if (mWatcher && !parentWindow) {
- mWatcher->GetActiveWindow(getter_AddRefs(parentWindow));
- }
+ nsCOMPtr<mozIDOMWindowProxy> parentWindow = parent;
+
+ if (mWatcher && !parentWindow) {
+ mWatcher->GetActiveWindow(getter_AddRefs(parentWindow));
+ }
- if (parentWindow) {
- mPrintProgress->OpenProgressDialog(parentWindow,
- isForPrinting ? kPrintProgressDialogURL : kPrtPrvProgressDialogURL,
- prtProgressParams, openDialogObserver, notifyOnOpen);
- }
+ if (parentWindow) {
+ mPrintProgress->OpenProgressDialog(parentWindow,
+ isForPrinting ? kPrintProgressDialogURL
+ : kPrtPrvProgressDialogURL,
+ prtProgressParams,
+ openDialogObserver,
+ notifyOnOpen);
+ }
- prtProgressParams.forget(printProgressParams);
- NS_ADDREF(*webProgressListener = this);
+ prtProgressParams.forget(printProgressParams);
+ NS_ADDREF(*webProgressListener = this);
- return NS_OK;
+ return NS_OK;
}
NS_IMETHODIMP
-nsPrintingPromptService::ShowPageSetup(mozIDOMWindowProxy *parent,
- nsIPrintSettings *printSettings,
- nsIObserver *aObs)
+nsPrintingPromptService::ShowPageSetup(mozIDOMWindowProxy* parent,
+ nsIPrintSettings* printSettings,
+ nsIObserver* aObs)
{
- NS_ENSURE_ARG(printSettings);
+ NS_ENSURE_ARG(printSettings);
- nsCOMPtr<nsIPrintDialogService> dlgPrint(do_GetService(
- NS_PRINTDIALOGSERVICE_CONTRACTID));
- if (dlgPrint)
- return dlgPrint->ShowPageSetup(nsPIDOMWindowOuter::From(parent),
- printSettings);
+ nsCOMPtr<nsIPrintDialogService> dlgPrint(
+ do_GetService(NS_PRINTDIALOGSERVICE_CONTRACTID));
+ if (dlgPrint)
+ return dlgPrint->ShowPageSetup(nsPIDOMWindowOuter::From(parent),
+ printSettings);
- return NS_ERROR_FAILURE;
+ return NS_ERROR_FAILURE;
}
NS_IMETHODIMP
-nsPrintingPromptService::OnStateChange(nsIWebProgress *aWebProgress, nsIRequest *aRequest, uint32_t aStateFlags, nsresult aStatus)
+nsPrintingPromptService::OnStateChange(nsIWebProgress* aWebProgress,
+ nsIRequest* aRequest,
+ uint32_t aStateFlags,
+ nsresult aStatus)
{
if ((aStateFlags & STATE_STOP) && mWebProgressListener) {
- mWebProgressListener->OnStateChange(aWebProgress, aRequest, aStateFlags, aStatus);
+ mWebProgressListener->OnStateChange(
+ aWebProgress, aRequest, aStateFlags, aStatus);
if (mPrintProgress) {
mPrintProgress->CloseProgressDialog(true);
}
- mPrintProgress = nullptr;
+ mPrintProgress = nullptr;
mWebProgressListener = nullptr;
}
return NS_OK;
}
NS_IMETHODIMP
-nsPrintingPromptService::OnProgressChange(nsIWebProgress *aWebProgress, nsIRequest *aRequest, int32_t aCurSelfProgress, int32_t aMaxSelfProgress, int32_t aCurTotalProgress, int32_t aMaxTotalProgress)
+nsPrintingPromptService::OnProgressChange(nsIWebProgress* aWebProgress,
+ nsIRequest* aRequest,
+ int32_t aCurSelfProgress,
+ int32_t aMaxSelfProgress,
+ int32_t aCurTotalProgress,
+ int32_t aMaxTotalProgress)
{
if (mWebProgressListener) {
- return mWebProgressListener->OnProgressChange(aWebProgress, aRequest, aCurSelfProgress, aMaxSelfProgress, aCurTotalProgress, aMaxTotalProgress);
+ return mWebProgressListener->OnProgressChange(aWebProgress,
+ aRequest,
+ aCurSelfProgress,
+ aMaxSelfProgress,
+ aCurTotalProgress,
+ aMaxTotalProgress);
}
return NS_OK;
}
NS_IMETHODIMP
-nsPrintingPromptService::OnLocationChange(nsIWebProgress *aWebProgress, nsIRequest *aRequest, nsIURI *location, uint32_t aFlags)
+nsPrintingPromptService::OnLocationChange(nsIWebProgress* aWebProgress,
+ nsIRequest* aRequest,
+ nsIURI* location,
+ uint32_t aFlags)
{
if (mWebProgressListener) {
- return mWebProgressListener->OnLocationChange(aWebProgress, aRequest, location, aFlags);
+ return mWebProgressListener->OnLocationChange(
+ aWebProgress, aRequest, location, aFlags);
}
return NS_OK;
}
NS_IMETHODIMP
-nsPrintingPromptService::OnStatusChange(nsIWebProgress *aWebProgress, nsIRequest *aRequest, nsresult aStatus, const char16_t *aMessage)
+nsPrintingPromptService::OnStatusChange(nsIWebProgress* aWebProgress,
+ nsIRequest* aRequest,
+ nsresult aStatus,
+ const char16_t* aMessage)
{
if (mWebProgressListener) {
- return mWebProgressListener->OnStatusChange(aWebProgress, aRequest, aStatus, aMessage);
+ return mWebProgressListener->OnStatusChange(
+ aWebProgress, aRequest, aStatus, aMessage);
}
return NS_OK;
}
NS_IMETHODIMP
-nsPrintingPromptService::OnSecurityChange(nsIWebProgress *aWebProgress, nsIRequest *aRequest, uint32_t state)
+nsPrintingPromptService::OnSecurityChange(nsIWebProgress* aWebProgress,
+ nsIRequest* aRequest,
+ uint32_t state)
{
if (mWebProgressListener) {
- return mWebProgressListener->OnSecurityChange(aWebProgress, aRequest, state);
+ return mWebProgressListener->OnSecurityChange(
+ aWebProgress, aRequest, state);
}
return NS_OK;
}
--- a/toolkit/components/printingui/unixshared/nsPrintingPromptService.h
+++ b/toolkit/components/printingui/unixshared/nsPrintingPromptService.h
@@ -2,39 +2,44 @@
/* 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 __nsPrintingPromptService_h
#define __nsPrintingPromptService_h
// {E042570C-62DE-4bb6-A6E0-798E3C07B4DF}
-#define NS_PRINTINGPROMPTSERVICE_CID \
- {0xe042570c, 0x62de, 0x4bb6, { 0xa6, 0xe0, 0x79, 0x8e, 0x3c, 0x7, 0xb4, 0xdf}}
-#define NS_PRINTINGPROMPTSERVICE_CONTRACTID \
- "@mozilla.org/embedcomp/printingprompt-service;1"
+#define NS_PRINTINGPROMPTSERVICE_CID \
+ { \
+ 0xe042570c, 0x62de, 0x4bb6, \
+ { \
+ 0xa6, 0xe0, 0x79, 0x8e, 0x3c, 0x7, 0xb4, 0xdf \
+ } \
+ }
+#define NS_PRINTINGPROMPTSERVICE_CONTRACTID \
+ "@mozilla.org/embedcomp/printingprompt-service;1"
#include "nsCOMPtr.h"
#include "nsIPrintingPromptService.h"
#include "nsPIPromptService.h"
#include "nsIWindowWatcher.h"
// Printing Progress Includes
#include "nsPrintProgress.h"
#include "nsIWebProgressListener.h"
class nsIDOMWindow;
class nsIDialogParamBlock;
-class nsPrintingPromptService: public nsIPrintingPromptService,
- public nsIWebProgressListener
+class nsPrintingPromptService
+ : public nsIPrintingPromptService
+ , public nsIWebProgressListener
{
public:
-
nsPrintingPromptService();
nsresult Init();
NS_DECL_NSIPRINTINGPROMPTSERVICE
NS_DECL_NSIWEBPROGRESSLISTENER
NS_DECL_ISUPPORTS
@@ -43,9 +48,8 @@ protected:
private:
nsCOMPtr<nsIWindowWatcher> mWatcher;
nsCOMPtr<nsIPrintProgress> mPrintProgress;
nsCOMPtr<nsIWebProgressListener> mWebProgressListener;
};
#endif
-
--- a/toolkit/components/printingui/win/nsPrintingPromptService.cpp
+++ b/toolkit/components/printingui/win/nsPrintingPromptService.cpp
@@ -10,170 +10,195 @@
#include "nsIServiceManager.h"
#include "nsIPrintDialogService.h"
// Printing Progress Includes
#include "nsPrintProgress.h"
#include "nsPrintProgressParams.h"
#include "nsIWebProgressListener.h"
-static const char *kPrintProgressDialogURL = "chrome://global/content/printProgress.xul";
-static const char *kPrtPrvProgressDialogURL = "chrome://global/content/printPreviewProgress.xul";
+static const char* kPrintProgressDialogURL =
+ "chrome://global/content/printProgress.xul";
+static const char* kPrtPrvProgressDialogURL =
+ "chrome://global/content/printPreviewProgress.xul";
-NS_IMPL_ISUPPORTS(nsPrintingPromptService, nsIPrintingPromptService, nsIWebProgressListener)
+NS_IMPL_ISUPPORTS(nsPrintingPromptService,
+ nsIPrintingPromptService,
+ nsIWebProgressListener)
-nsPrintingPromptService::nsPrintingPromptService()
-{
-}
+nsPrintingPromptService::nsPrintingPromptService() = default;
//-----------------------------------------------------------
-nsPrintingPromptService::~nsPrintingPromptService()
-{
-}
+nsPrintingPromptService::~nsPrintingPromptService() = default;
//-----------------------------------------------------------
nsresult
nsPrintingPromptService::Init()
{
- nsresult rv;
- mWatcher = do_GetService(NS_WINDOWWATCHER_CONTRACTID, &rv);
- return rv;
+ nsresult rv;
+ mWatcher = do_GetService(NS_WINDOWWATCHER_CONTRACTID, &rv);
+ return rv;
}
///////////////////////////////////////////////////////////////////////////////
// nsIPrintingPromptService
//-----------------------------------------------------------
NS_IMETHODIMP
-nsPrintingPromptService::ShowPrintDialog(mozIDOMWindowProxy *parent, nsIWebBrowserPrint *webBrowserPrint, nsIPrintSettings *printSettings)
+nsPrintingPromptService::ShowPrintDialog(mozIDOMWindowProxy* parent,
+ nsIWebBrowserPrint* webBrowserPrint,
+ nsIPrintSettings* printSettings)
{
- NS_ENSURE_ARG(parent);
-
- nsCOMPtr<nsIPrintDialogService> dlgPrint(do_GetService(
- NS_PRINTDIALOGSERVICE_CONTRACTID));
- if (dlgPrint)
- return dlgPrint->Show(nsPIDOMWindowOuter::From(parent),
- printSettings, webBrowserPrint);
-
- return NS_ERROR_FAILURE;
-}
-
-
-NS_IMETHODIMP
-nsPrintingPromptService::ShowProgress(mozIDOMWindowProxy* parent,
- nsIWebBrowserPrint* webBrowserPrint, // ok to be null
- nsIPrintSettings* printSettings, // ok to be null
- nsIObserver* openDialogObserver, // ok to be null
- bool isForPrinting,
- nsIWebProgressListener** webProgressListener,
- nsIPrintProgressParams** printProgressParams,
- bool* notifyOnOpen)
-{
- NS_ENSURE_ARG(webProgressListener);
- NS_ENSURE_ARG(printProgressParams);
- NS_ENSURE_ARG(notifyOnOpen);
+ NS_ENSURE_ARG(parent);
- *notifyOnOpen = false;
- if (mPrintProgress) {
- *webProgressListener = nullptr;
- *printProgressParams = nullptr;
- return NS_ERROR_FAILURE;
- }
-
- nsPrintProgress* prtProgress = new nsPrintProgress();
- mPrintProgress = prtProgress;
- mWebProgressListener = prtProgress;
-
- nsCOMPtr<nsIPrintProgressParams> prtProgressParams = new nsPrintProgressParams();
-
- nsCOMPtr<mozIDOMWindowProxy> parentWindow = parent;
+ nsCOMPtr<nsIPrintDialogService> dlgPrint(
+ do_GetService(NS_PRINTDIALOGSERVICE_CONTRACTID));
+ if (dlgPrint)
+ return dlgPrint->Show(
+ nsPIDOMWindowOuter::From(parent), printSettings, webBrowserPrint);
- if (mWatcher && !parentWindow) {
- mWatcher->GetActiveWindow(getter_AddRefs(parentWindow));
- }
-
- if (parentWindow) {
- mPrintProgress->OpenProgressDialog(parentWindow,
- isForPrinting ? kPrintProgressDialogURL : kPrtPrvProgressDialogURL,
- prtProgressParams, openDialogObserver, notifyOnOpen);
- }
-
- prtProgressParams.forget(printProgressParams);
- NS_ADDREF(*webProgressListener = this);
-
- return NS_OK;
+ return NS_ERROR_FAILURE;
}
NS_IMETHODIMP
-nsPrintingPromptService::ShowPageSetup(mozIDOMWindowProxy *parent, nsIPrintSettings *printSettings, nsIObserver *aObs)
+nsPrintingPromptService::ShowProgress(
+ mozIDOMWindowProxy* parent,
+ nsIWebBrowserPrint* webBrowserPrint, // ok to be null
+ nsIPrintSettings* printSettings, // ok to be null
+ nsIObserver* openDialogObserver, // ok to be null
+ bool isForPrinting,
+ nsIWebProgressListener** webProgressListener,
+ nsIPrintProgressParams** printProgressParams,
+ bool* notifyOnOpen)
{
- NS_ENSURE_ARG(printSettings);
+ NS_ENSURE_ARG(webProgressListener);
+ NS_ENSURE_ARG(printProgressParams);
+ NS_ENSURE_ARG(notifyOnOpen);
+
+ *notifyOnOpen = false;
+ if (mPrintProgress) {
+ *webProgressListener = nullptr;
+ *printProgressParams = nullptr;
+ return NS_ERROR_FAILURE;
+ }
+
+ nsPrintProgress* prtProgress = new nsPrintProgress();
+ mPrintProgress = prtProgress;
+ mWebProgressListener = prtProgress;
+
+ nsCOMPtr<nsIPrintProgressParams> prtProgressParams =
+ new nsPrintProgressParams();
+
+ nsCOMPtr<mozIDOMWindowProxy> parentWindow = parent;
- nsCOMPtr<nsIPrintDialogService> dlgPrint(do_GetService(
- NS_PRINTDIALOGSERVICE_CONTRACTID));
- if (dlgPrint)
- return dlgPrint->ShowPageSetup(nsPIDOMWindowOuter::From(parent),
- printSettings);
+ if (mWatcher && !parentWindow) {
+ mWatcher->GetActiveWindow(getter_AddRefs(parentWindow));
+ }
+
+ if (parentWindow) {
+ mPrintProgress->OpenProgressDialog(parentWindow,
+ isForPrinting ? kPrintProgressDialogURL
+ : kPrtPrvProgressDialogURL,
+ prtProgressParams,
+ openDialogObserver,
+ notifyOnOpen);
+ }
+
+ prtProgressParams.forget(printProgressParams);
+ NS_ADDREF(*webProgressListener = this);
- return NS_ERROR_FAILURE;
+ return NS_OK;
+}
+
+NS_IMETHODIMP
+nsPrintingPromptService::ShowPageSetup(mozIDOMWindowProxy* parent,
+ nsIPrintSettings* printSettings,
+ nsIObserver* aObs)
+{
+ NS_ENSURE_ARG(printSettings);
+
+ nsCOMPtr<nsIPrintDialogService> dlgPrint(
+ do_GetService(NS_PRINTDIALOGSERVICE_CONTRACTID));
+ if (dlgPrint)
+ return dlgPrint->ShowPageSetup(nsPIDOMWindowOuter::From(parent),
+ printSettings);
+
+ return NS_ERROR_FAILURE;
}
//////////////////////////////////////////////////////////////////////
// nsIWebProgressListener
//////////////////////////////////////////////////////////////////////
NS_IMETHODIMP
-nsPrintingPromptService::OnStateChange(nsIWebProgress *aWebProgress, nsIRequest *aRequest, uint32_t aStateFlags, nsresult aStatus)
+nsPrintingPromptService::OnStateChange(nsIWebProgress* aWebProgress,
+ nsIRequest* aRequest,
+ uint32_t aStateFlags,
+ nsresult aStatus)
{
- if ((aStateFlags & STATE_STOP) && mWebProgressListener)
- {
- mWebProgressListener->OnStateChange(aWebProgress, aRequest, aStateFlags, aStatus);
- if (mPrintProgress)
- {
- mPrintProgress->CloseProgressDialog(true);
- }
- mPrintProgress = nullptr;
- mWebProgressListener = nullptr;
+ if ((aStateFlags & STATE_STOP) && mWebProgressListener) {
+ mWebProgressListener->OnStateChange(
+ aWebProgress, aRequest, aStateFlags, aStatus);
+ if (mPrintProgress) {
+ mPrintProgress->CloseProgressDialog(true);
}
- return NS_OK;
+ mPrintProgress = nullptr;
+ mWebProgressListener = nullptr;
+ }
+ return NS_OK;
}
NS_IMETHODIMP
-nsPrintingPromptService::OnProgressChange(nsIWebProgress *aWebProgress, nsIRequest *aRequest, int32_t aCurSelfProgress, int32_t aMaxSelfProgress, int32_t aCurTotalProgress, int32_t aMaxTotalProgress)
+nsPrintingPromptService::OnProgressChange(nsIWebProgress* aWebProgress,
+ nsIRequest* aRequest,
+ int32_t aCurSelfProgress,
+ int32_t aMaxSelfProgress,
+ int32_t aCurTotalProgress,
+ int32_t aMaxTotalProgress)
{
- if (mWebProgressListener)
- {
- return mWebProgressListener->OnProgressChange(aWebProgress, aRequest, aCurSelfProgress, aMaxSelfProgress, aCurTotalProgress, aMaxTotalProgress);
+ if (mWebProgressListener) {
+ return mWebProgressListener->OnProgressChange(aWebProgress,
+ aRequest,
+ aCurSelfProgress,
+ aMaxSelfProgress,
+ aCurTotalProgress,
+ aMaxTotalProgress);
}
return NS_ERROR_FAILURE;
}
NS_IMETHODIMP
-nsPrintingPromptService::OnLocationChange(nsIWebProgress *aWebProgress, nsIRequest *aRequest, nsIURI *location, uint32_t aFlags)
+nsPrintingPromptService::OnLocationChange(nsIWebProgress* aWebProgress,
+ nsIRequest* aRequest,
+ nsIURI* location,
+ uint32_t aFlags)
{
- if (mWebProgressListener)
- {
- return mWebProgressListener->OnLocationChange(aWebProgress, aRequest, location, aFlags);
+ if (mWebProgressListener) {
+ return mWebProgressListener->OnLocationChange(
+ aWebProgress, aRequest, location, aFlags);
}
return NS_ERROR_FAILURE;
}
NS_IMETHODIMP
-nsPrintingPromptService::OnStatusChange(nsIWebProgress *aWebProgress, nsIRequest *aRequest, nsresult aStatus, const char16_t *aMessage)
+nsPrintingPromptService::OnStatusChange(nsIWebProgress* aWebProgress,
+ nsIRequest* aRequest,
+ nsresult aStatus,
+ const char16_t* aMessage)
{
- if (mWebProgressListener)
- {
- return mWebProgressListener->OnStatusChange(aWebProgress, aRequest, aStatus, aMessage);
+ if (mWebProgressListener) {
+ return mWebProgressListener->OnStatusChange(
+ aWebProgress, aRequest, aStatus, aMessage);
}
return NS_ERROR_FAILURE;
}
NS_IMETHODIMP
-nsPrintingPromptService::OnSecurityChange(nsIWebProgress *aWebProgress, nsIRequest *aRequest, uint32_t state)
+nsPrintingPromptService::OnSecurityChange(nsIWebProgress* aWebProgress,
+ nsIRequest* aRequest,
+ uint32_t state)
{
- if (mWebProgressListener)
- {
- return mWebProgressListener->OnSecurityChange(aWebProgress, aRequest, state);
+ if (mWebProgressListener) {
+ return mWebProgressListener->OnSecurityChange(
+ aWebProgress, aRequest, state);
}
return NS_ERROR_FAILURE;
}
-
-
--- a/toolkit/components/printingui/win/nsPrintingPromptService.h
+++ b/toolkit/components/printingui/win/nsPrintingPromptService.h
@@ -4,49 +4,53 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef __nsPrintingPromptService_h
#define __nsPrintingPromptService_h
#include <windows.h>
// {E042570C-62DE-4bb6-A6E0-798E3C07B4DF}
-#define NS_PRINTINGPROMPTSERVICE_CID \
- {0xe042570c, 0x62de, 0x4bb6, { 0xa6, 0xe0, 0x79, 0x8e, 0x3c, 0x7, 0xb4, 0xdf}}
-#define NS_PRINTINGPROMPTSERVICE_CONTRACTID \
- "@mozilla.org/embedcomp/printingprompt-service;1"
+#define NS_PRINTINGPROMPTSERVICE_CID \
+ { \
+ 0xe042570c, 0x62de, 0x4bb6, \
+ { \
+ 0xa6, 0xe0, 0x79, 0x8e, 0x3c, 0x7, 0xb4, 0xdf \
+ } \
+ }
+#define NS_PRINTINGPROMPTSERVICE_CONTRACTID \
+ "@mozilla.org/embedcomp/printingprompt-service;1"
#include "nsCOMPtr.h"
#include "nsIPrintingPromptService.h"
#include "nsPIPromptService.h"
#include "nsIWindowWatcher.h"
// Printing Progress Includes
#include "nsPrintProgress.h"
#include "nsPrintProgressParams.h"
#include "nsIWebProgressListener.h"
class nsIDOMWindow;
class nsIDialogParamBlock;
-class nsPrintingPromptService: public nsIPrintingPromptService,
- public nsIWebProgressListener
+class nsPrintingPromptService
+ : public nsIPrintingPromptService
+ , public nsIWebProgressListener
{
- virtual ~nsPrintingPromptService();
+ virtual ~nsPrintingPromptService();
public:
- nsPrintingPromptService();
+ nsPrintingPromptService();
- nsresult Init();
+ nsresult Init();
- NS_DECL_ISUPPORTS
- NS_DECL_NSIPRINTINGPROMPTSERVICE
- NS_DECL_NSIWEBPROGRESSLISTENER
+ NS_DECL_ISUPPORTS
+ NS_DECL_NSIPRINTINGPROMPTSERVICE
+ NS_DECL_NSIWEBPROGRESSLISTENER
private:
- nsCOMPtr<nsIWindowWatcher> mWatcher;
- nsCOMPtr<nsIPrintProgress> mPrintProgress;
- nsCOMPtr<nsIWebProgressListener> mWebProgressListener;
-
+ nsCOMPtr<nsIWindowWatcher> mWatcher;
+ nsCOMPtr<nsIPrintProgress> mPrintProgress;
+ nsCOMPtr<nsIWebProgressListener> mWebProgressListener;
};
#endif
-