Bug 1331236 - Make nsPrintingPromptServiceX.mm cpp file instead of Objective-C++. r=mstange
authorMakoto Kato <m_kato@ga2.so-net.ne.jp>
Sun, 15 Jan 2017 16:47:36 +0900
changeset 329531 224be03d946cbc71ae3b667e4b40b43cefb01656
parent 329530 b706ca522fdd409bbc055512fa52d27e0118a3ac
child 329532 e54b0201b2000bc83bef7f5334114d13b0fbdd7c
push id36077
push userm_kato@ga2.so-net.ne.jp
push dateMon, 16 Jan 2017 05:26:08 +0000
treeherderautoland@224be03d946c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmstange
bugs1331236
milestone53.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 1331236 - Make nsPrintingPromptServiceX.mm cpp file instead of Objective-C++. r=mstange nsPrintingPromptServiceX doesn't use Objective-C, so we should change to C++ instead. Also, nsPrintDialogServiceX::ShowPageSetup should have NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NSRESULT. MozReview-Commit-ID: 33LfNFmiUTQ
toolkit/components/printingui/mac/moz.build
toolkit/components/printingui/mac/nsPrintingPromptService.cpp
toolkit/components/printingui/mac/nsPrintingPromptServiceX.mm
widget/cocoa/nsPrintDialogX.mm
widget/moz.build
--- a/toolkit/components/printingui/mac/moz.build
+++ b/toolkit/components/printingui/mac/moz.build
@@ -1,16 +1,13 @@
 # -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
 # vim: set filetype=python:
 # 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/.
 
 UNIFIED_SOURCES += [
+    'nsPrintingPromptService.cpp',
     'nsPrintProgress.cpp',
     'nsPrintProgressParams.cpp',
 ]
 
-SOURCES += [
-    'nsPrintingPromptServiceX.mm',
-]
-
 FINAL_LIBRARY = 'xul'
rename from toolkit/components/printingui/mac/nsPrintingPromptServiceX.mm
rename to toolkit/components/printingui/mac/nsPrintingPromptService.cpp
--- a/toolkit/components/printingui/mac/nsPrintingPromptServiceX.mm
+++ b/toolkit/components/printingui/mac/nsPrintingPromptService.cpp
@@ -2,17 +2,16 @@
 /* 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 "nsPrintingPromptService.h"
 
 #include "nsCOMPtr.h"
 #include "nsServiceManagerUtils.h"
-#include "nsObjCExceptions.h"
 
 #include "nsIPrintingPromptService.h"
 #include "nsIFactory.h"
 #include "nsIPrintDialogService.h"
 #include "nsPIDOMWindow.h"
 
 //*****************************************************************************
 // nsPrintingPromptService
@@ -33,28 +32,24 @@ nsresult nsPrintingPromptService::Init()
 
 //*****************************************************************************
 // nsPrintingPromptService::nsIPrintingPromptService
 //*****************************************************************************   
 
 NS_IMETHODIMP 
 nsPrintingPromptService::ShowPrintDialog(mozIDOMWindowProxy *parent, nsIWebBrowserPrint *webBrowserPrint, nsIPrintSettings *printSettings)
 {
-  NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NSRESULT;
-
   nsCOMPtr<nsIPrintDialogService> dlgPrint(do_GetService(
                                            NS_PRINTDIALOGSERVICE_CONTRACTID));
   if (dlgPrint) {
     return dlgPrint->Show(nsPIDOMWindowOuter::From(parent), printSettings,
                           webBrowserPrint);
   }
 
   return NS_ERROR_FAILURE;
-
-  NS_OBJC_END_TRY_ABORT_BLOCK_NSRESULT;
 }
 
 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,
@@ -63,26 +58,23 @@ nsPrintingPromptService::ShowProgress(mo
                                       bool*                  notifyOnOpen)
 {
   return NS_ERROR_NOT_IMPLEMENTED;
 }
 
 NS_IMETHODIMP 
 nsPrintingPromptService::ShowPageSetup(mozIDOMWindowProxy *parent, nsIPrintSettings *printSettings, nsIObserver *aObs)
 {
-  NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NSRESULT;
   nsCOMPtr<nsIPrintDialogService> dlgPrint(do_GetService(
                                            NS_PRINTDIALOGSERVICE_CONTRACTID));
   if (dlgPrint) {
     return dlgPrint->ShowPageSetup(nsPIDOMWindowOuter::From(parent), printSettings);
   }
 
   return NS_ERROR_FAILURE;
-
-  NS_OBJC_END_TRY_ABORT_BLOCK_NSRESULT;
 }
 
 NS_IMETHODIMP 
 nsPrintingPromptService::ShowPrinterProperties(mozIDOMWindowProxy *parent, const char16_t *printerName, nsIPrintSettings *printSettings)
 {
     return NS_ERROR_NOT_IMPLEMENTED;
 }
 
--- a/widget/cocoa/nsPrintDialogX.mm
+++ b/widget/cocoa/nsPrintDialogX.mm
@@ -179,31 +179,35 @@ nsPrintDialogServiceX::Show(nsPIDOMWindo
 
   NS_OBJC_END_TRY_ABORT_BLOCK_NSRESULT;
 }
 
 NS_IMETHODIMP
 nsPrintDialogServiceX::ShowPageSetup(nsPIDOMWindowOuter *aParent,
                                      nsIPrintSettings *aNSSettings)
 {
+  NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NSRESULT;
+
   NS_PRECONDITION(aParent, "aParent must not be null");
   NS_PRECONDITION(aNSSettings, "aSettings must not be null");
   NS_ENSURE_TRUE(aNSSettings, NS_ERROR_FAILURE);
 
   RefPtr<nsPrintSettingsX> settingsX(do_QueryObject(aNSSettings));
   if (!settingsX)
     return NS_ERROR_FAILURE;
 
   NSPrintInfo* printInfo = settingsX->GetCocoaPrintInfo();
   NSPageLayout *pageLayout = [NSPageLayout pageLayout];
   nsCocoaUtils::PrepareForNativeAppModalDialog();
   int button = [pageLayout runModalWithPrintInfo:printInfo];
   nsCocoaUtils::CleanUpAfterNativeAppModalDialog();
 
   return button == NSFileHandlingPanelOKButton ? NS_OK : NS_ERROR_ABORT;
+
+  NS_OBJC_END_TRY_ABORT_BLOCK_NSRESULT;
 }
 
 // Accessory view
 
 @interface PrintPanelAccessoryView (Private)
 
 - (NSString*)localizedString:(const char*)aKey;
 
--- a/widget/moz.build
+++ b/widget/moz.build
@@ -3,17 +3,17 @@
 # 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/.
 
 toolkit = CONFIG['MOZ_WIDGET_TOOLKIT']
 
 if toolkit in ('cocoa', 'android', 'gonk', 'uikit'):
     DIRS += [toolkit]
-if toolkit in ('android', 'gonk', 'gtk2', 'gtk3'):
+if toolkit in ('android', 'cocoa', 'gonk', 'gtk2', 'gtk3'):
     EXPORTS += ['nsIPrintDialogService.h']
 
 if toolkit == 'windows':
     DIRS += ['windows']
 
     XPIDL_SOURCES += [
         'nsIJumpListBuilder.idl',
         'nsIJumpListItem.idl',
@@ -33,17 +33,16 @@ elif toolkit == 'cocoa':
         'nsIMacDockSupport.idl',
         'nsIMacWebAppUtils.idl',
         'nsIStandaloneNativeMenu.idl',
         'nsISystemStatusBar.idl',
         'nsITaskbarProgress.idl',
     ]
     EXPORTS += [
         'nsINativeMenuService.h',
-        'nsIPrintDialogService.h',
     ]
 
 TEST_DIRS += ['tests']
 
 # Don't build the DSO under the 'build' directory as windows does.
 #
 # The DSOs get built in the toolkit dir itself.  Do this so that
 # multiple implementations of widget can be built on the same