Bug 1409972 - Part 4. Merge mac printingui. r=mconley
authorMantaroh Yoshinaga <mantaroh@gmail.com>
Fri, 10 Nov 2017 11:00:54 +0900
changeset 391646 1d8e9cd8df19cc4e6decc12aee007f559ed2cbbf
parent 391645 fb5f9d6a7772fd99f362a8a9d50d03af849d508f
child 391647 614c8b4d4a0d77f973ca370cd0a6f3cdd490d0d9
push id55288
push usermantaroh@gmail.com
push dateTue, 14 Nov 2017 01:30:51 +0000
treeherderautoland@854a8759f855 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmconley
bugs1409972
milestone59.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1409972 - Part 4. Merge mac printingui. r=mconley This patch will merge mac printingui implementation to common code. Primary differences are: * Remove progress implementation if build target is macOS. MozReview-Commit-ID: 8qoxgmzhqnM
toolkit/components/printingui/nsPrintingPromptService.cpp
toolkit/components/printingui/nsPrintingPromptService.h
--- a/toolkit/components/printingui/nsPrintingPromptService.cpp
+++ b/toolkit/components/printingui/nsPrintingPromptService.cpp
@@ -5,40 +5,47 @@
 
 #include "nsPrintingPromptService.h"
 
 #include "nsIDOMWindow.h"
 #include "nsIServiceManager.h"
 #include "nsISupportsUtils.h"
 #include "nsString.h"
 #include "nsIPrintDialogService.h"
+#include "nsPIDOMWindow.h"
 
 // Printing Progress Includes
+#if !defined(XP_MACOSX)
 #include "nsPrintProgress.h"
 #include "nsPrintProgressParams.h"
 
 static const char* kPrintProgressDialogURL =
   "chrome://global/content/printProgress.xul";
 static const char* kPrtPrvProgressDialogURL =
   "chrome://global/content/printPreviewProgress.xul";
+#endif
 
 NS_IMPL_ISUPPORTS(nsPrintingPromptService,
                   nsIPrintingPromptService,
                   nsIWebProgressListener)
 
 nsPrintingPromptService::nsPrintingPromptService() = default;
 
 nsPrintingPromptService::~nsPrintingPromptService() = default;
 
 nsresult
 nsPrintingPromptService::Init()
 {
+#if !defined(XP_MACOSX)
   nsresult rv;
   mWatcher = do_GetService(NS_WINDOWWATCHER_CONTRACTID, &rv);
   return rv;
+#else
+  return NS_OK;
+#endif
 }
 
 NS_IMETHODIMP
 nsPrintingPromptService::ShowPrintDialog(mozIDOMWindowProxy* parent,
                                          nsIWebBrowserPrint* webBrowserPrint,
                                          nsIPrintSettings* printSettings)
 {
   NS_ENSURE_ARG(webBrowserPrint);
@@ -59,16 +66,17 @@ nsPrintingPromptService::ShowProgress(
   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)
 {
+#if !defined(XP_MACOSX)
   NS_ENSURE_ARG(webProgressListener);
   NS_ENSURE_ARG(printProgressParams);
   NS_ENSURE_ARG(notifyOnOpen);
 
   *notifyOnOpen = false;
   if (mPrintProgress) {
     *webProgressListener = nullptr;
     *printProgressParams = nullptr;
@@ -96,16 +104,19 @@ nsPrintingPromptService::ShowProgress(
                                        openDialogObserver,
                                        notifyOnOpen);
   }
 
   prtProgressParams.forget(printProgressParams);
   NS_ADDREF(*webProgressListener = this);
 
   return NS_OK;
+#else
+  return NS_ERROR_NOT_IMPLEMENTED;
+#endif
 }
 
 NS_IMETHODIMP
 nsPrintingPromptService::ShowPageSetup(mozIDOMWindowProxy* parent,
                                        nsIPrintSettings* printSettings,
                                        nsIObserver* aObs)
 {
   NS_ENSURE_ARG(printSettings);
@@ -120,76 +131,86 @@ nsPrintingPromptService::ShowPageSetup(m
 }
 
 NS_IMETHODIMP
 nsPrintingPromptService::OnStateChange(nsIWebProgress* aWebProgress,
                                        nsIRequest* aRequest,
                                        uint32_t aStateFlags,
                                        nsresult aStatus)
 {
+#if !defined(XP_MACOSX)
   if ((aStateFlags & STATE_STOP) && mWebProgressListener) {
     mWebProgressListener->OnStateChange(
       aWebProgress, aRequest, aStateFlags, aStatus);
     if (mPrintProgress) {
       mPrintProgress->CloseProgressDialog(true);
     }
     mPrintProgress = nullptr;
     mWebProgressListener = nullptr;
   }
+#endif
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsPrintingPromptService::OnProgressChange(nsIWebProgress* aWebProgress,
                                           nsIRequest* aRequest,
                                           int32_t aCurSelfProgress,
                                           int32_t aMaxSelfProgress,
                                           int32_t aCurTotalProgress,
                                           int32_t aMaxTotalProgress)
 {
+#if !defined(XP_MACOSX)
   if (mWebProgressListener) {
     return mWebProgressListener->OnProgressChange(aWebProgress,
                                                   aRequest,
                                                   aCurSelfProgress,
                                                   aMaxSelfProgress,
                                                   aCurTotalProgress,
                                                   aMaxTotalProgress);
   }
+#endif
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsPrintingPromptService::OnLocationChange(nsIWebProgress* aWebProgress,
                                           nsIRequest* aRequest,
                                           nsIURI* location,
                                           uint32_t aFlags)
 {
+#if !defined(XP_MACOSX)
   if (mWebProgressListener) {
     return mWebProgressListener->OnLocationChange(
       aWebProgress, aRequest, location, aFlags);
   }
+#endif
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsPrintingPromptService::OnStatusChange(nsIWebProgress* aWebProgress,
                                         nsIRequest* aRequest,
                                         nsresult aStatus,
                                         const char16_t* aMessage)
 {
+#if !defined(XP_MACOSX)
   if (mWebProgressListener) {
     return mWebProgressListener->OnStatusChange(
       aWebProgress, aRequest, aStatus, aMessage);
   }
+#endif
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsPrintingPromptService::OnSecurityChange(nsIWebProgress* aWebProgress,
                                           nsIRequest* aRequest,
                                           uint32_t state)
 {
+#if !defined(XP_MACOSX)
   if (mWebProgressListener) {
     return mWebProgressListener->OnSecurityChange(
       aWebProgress, aRequest, state);
   }
+#endif
   return NS_OK;
 }
--- a/toolkit/components/printingui/nsPrintingPromptService.h
+++ b/toolkit/components/printingui/nsPrintingPromptService.h
@@ -18,21 +18,23 @@
   "@mozilla.org/embedcomp/printingprompt-service;1"
 
 #include "nsCOMPtr.h"
 #include "nsIPrintingPromptService.h"
 #include "nsPIPromptService.h"
 #include "nsIWindowWatcher.h"
 
 // Printing Progress Includes
+#include "nsIWebProgressListener.h"
+#if !defined(XP_MACOSX)
 #include "nsPrintProgress.h"
-#include "nsIWebProgressListener.h"
 
 class nsIDOMWindow;
 class nsIDialogParamBlock;
+#endif
 
 class nsPrintingPromptService
   : public nsIPrintingPromptService
   , public nsIWebProgressListener
 {
 
 public:
   nsPrintingPromptService();
@@ -42,14 +44,16 @@ public:
   NS_DECL_NSIPRINTINGPROMPTSERVICE
   NS_DECL_NSIWEBPROGRESSLISTENER
   NS_DECL_ISUPPORTS
 
 protected:
   virtual ~nsPrintingPromptService();
 
 private:
+#if !defined(XP_MACOSX)
   nsCOMPtr<nsIWindowWatcher> mWatcher;
   nsCOMPtr<nsIPrintProgress> mPrintProgress;
   nsCOMPtr<nsIWebProgressListener> mWebProgressListener;
+#endif
 };
 
 #endif