More Carbon usage cleanup. b=550787 r=bsmedberg
authorJosh Aas <joshmoz@gmail.com>
Wed, 10 Mar 2010 14:30:11 -0500
changeset 39217 316b11468cdf4d010c868766ff7d55394ab6fc4f
parent 39216 9a52e9c81b7033632667fab4dcb369fd719377e3
child 39218 b9424d98afb442ea176b7a16a316987fc9ddc765
push id12085
push userjosh@mozilla.com
push dateWed, 10 Mar 2010 19:30:44 +0000
treeherdermozilla-central@316b11468cdf [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbsmedberg
bugs550787
milestone1.9.3a3pre
More Carbon usage cleanup. b=550787 r=bsmedberg
browser/components/shell/src/nsMacShellService.cpp
chrome/src/nsChromeRegistry.cpp
modules/plugin/default/mac/DefaultPlugin.mm
netwerk/protocol/http/src/nsHttpHandler.cpp
toolkit/xre/nsNativeAppSupportCocoa.mm
uriloader/exthandler/mac/nsLocalHandlerAppMac.mm
uriloader/exthandler/mac/nsMIMEInfoMac.mm
uriloader/exthandler/mac/nsOSHelperAppService.mm
widget/src/cocoa/nsBidiKeyboard.mm
widget/src/cocoa/nsLookAndFeel.mm
widget/src/cocoa/nsMenuItemIconX.h
widget/src/cocoa/nsMenuUtilsX.h
widget/src/cocoa/nsMenuUtilsX.mm
widget/src/cocoa/nsToolkit.mm
--- a/browser/components/shell/src/nsMacShellService.cpp
+++ b/browser/components/shell/src/nsMacShellService.cpp
@@ -51,17 +51,17 @@
 #include "nsIURL.h"
 #include "nsIWebBrowserPersist.h"
 #include "nsMacShellService.h"
 #include "nsNetUtil.h"
 #include "nsShellService.h"
 #include "nsStringAPI.h"
 
 #include <CoreFoundation/CoreFoundation.h>
-#include <Carbon/Carbon.h>
+#include <ApplicationServices/ApplicationServices.h>
 
 #define NETWORK_PREFPANE NS_LITERAL_CSTRING("/System/Library/PreferencePanes/Network.prefPane")
 #define DESKTOP_PREFPANE NS_LITERAL_CSTRING("/System/Library/PreferencePanes/DesktopScreenEffectsPref.prefPane")
 
 #define SAFARI_BUNDLE_IDENTIFIER "com.apple.Safari"
 
 NS_IMPL_ISUPPORTS3(nsMacShellService, nsIMacShellService, nsIShellService, nsIWebProgressListener)
 
--- a/chrome/src/nsChromeRegistry.cpp
+++ b/chrome/src/nsChromeRegistry.cpp
@@ -43,17 +43,17 @@
 
 #include <string.h>
 
 #include "prio.h"
 #include "prprf.h"
 #if defined(XP_WIN)
 #include <windows.h>
 #elif defined(XP_MACOSX)
-#include <Carbon/Carbon.h>
+#include <CoreServices/CoreServices.h>
 #elif defined(MOZ_WIDGET_GTK2)
 #include <gtk/gtk.h>
 #endif
 
 #include "nsAppDirectoryServiceDefs.h"
 #include "nsArrayEnumerator.h"
 #include "nsStringEnumerator.h"
 #include "nsEnumeratorUtils.h"
--- a/modules/plugin/default/mac/DefaultPlugin.mm
+++ b/modules/plugin/default/mac/DefaultPlugin.mm
@@ -34,17 +34,16 @@
  * the provisions above, a recipient may use your version of this file under
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 
 #include "npapi.h"
 #include "npfunctions.h"
 
-#include <Carbon/Carbon.h>
 #include <CoreFoundation/CoreFoundation.h>
 
 #pragma GCC visibility push(default)
 extern "C"
 {
 NPError NP_Initialize(NPNetscapeFuncs *browserFuncs);
 NPError NP_GetEntryPoints(NPPluginFuncs *pluginFuncs);
 void    NP_Shutdown(void);
--- a/netwerk/protocol/http/src/nsHttpHandler.cpp
+++ b/netwerk/protocol/http/src/nsHttpHandler.cpp
@@ -81,17 +81,17 @@
 #include <sys/utsname.h>
 #endif
 
 #if defined(XP_WIN)
 #include <windows.h>
 #endif
 
 #if defined(XP_MACOSX)
-#include <Carbon/Carbon.h>
+#include <CoreServices/CoreServices.h>
 #endif
 
 #if defined(XP_OS2)
 #define INCL_DOSMISC
 #include <os2.h>
 #endif
 
 #ifdef DEBUG
--- a/toolkit/xre/nsNativeAppSupportCocoa.mm
+++ b/toolkit/xre/nsNativeAppSupportCocoa.mm
@@ -33,17 +33,17 @@
  * and other provisions required by the GPL or the LGPL. If you do not delete
  * the provisions above, a recipient may use your version of this file under
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 
 #include "nsString.h"
 
-#import <Carbon/Carbon.h>
+#import <CoreServices/CoreServices.h>
 #import <Cocoa/Cocoa.h>
 
 #include "nsCOMPtr.h"
 #include "nsObjCExceptions.h"
 #include "nsNativeAppSupportBase.h"
 
 #include "nsIAppShellService.h"
 #include "nsIAppStartup.h"
@@ -54,34 +54,42 @@
 #include "nsIDocShellTreeOwner.h"
 #include "nsIInterfaceRequestorUtils.h"
 #include "nsIObserver.h"
 #include "nsIServiceManager.h"
 #include "nsIWebNavigation.h"
 #include "nsIWidget.h"
 #include "nsIWindowMediator.h"
 
-const OSType kNSCreator = 'MOSS';
-const OSType kMozCreator = 'MOZZ';
-const SInt16 kNSCanRunStrArrayID = 1000;
-const SInt16 kAnotherVersionStrIndex = 1;
-
 nsresult
-GetNativeWindowPointerFromDOMWindow(nsIDOMWindowInternal *window, NSWindow **nativeWindow);
+GetNativeWindowPointerFromDOMWindow(nsIDOMWindowInternal *a_window, NSWindow **a_nativeWindow)
+{
+  *a_nativeWindow = nil;
+  if (!a_window)
+    return NS_ERROR_INVALID_ARG;
 
-const SInt16 kNSOSVersErrsStrArrayID = 1001;
+  nsCOMPtr<nsIWebNavigation> mruWebNav(do_GetInterface(a_window));
+  if (mruWebNav) {
+    nsCOMPtr<nsIDocShellTreeItem> mruTreeItem(do_QueryInterface(mruWebNav));
+    nsCOMPtr<nsIDocShellTreeOwner> mruTreeOwner = nsnull;
+    mruTreeItem->GetTreeOwner(getter_AddRefs(mruTreeOwner));
+    if(mruTreeOwner) {
+      nsCOMPtr<nsIBaseWindow> mruBaseWindow(do_QueryInterface(mruTreeOwner));
+      if (mruBaseWindow) {
+        nsCOMPtr<nsIWidget> mruWidget = nsnull;
+        mruBaseWindow->GetMainWidget(getter_AddRefs(mruWidget));
+        if (mruWidget) {
+          *a_nativeWindow = (NSWindow*)mruWidget->GetNativeData(NS_NATIVE_WINDOW);
+        }
+      }
+    }
+  }
 
-enum {
-        eOSXVersTooOldErrIndex = 1,
-        eOSXVersTooOldExplanationIndex,
-        eContinueButtonTextIndex,
-        eQuitButtonTextIndex,
-        eCarbonLibVersTooOldIndex,
-        eCarbonLibVersTooOldExplanationIndex
-     };
+  return NS_OK;
+}
 
 class nsNativeAppSupportCocoa : public nsNativeAppSupportBase
 {
 public:
   nsNativeAppSupportCocoa() :
     mCanShowUI(PR_FALSE) { }
 
   NS_IMETHOD Start(PRBool* aRetVal);
@@ -205,41 +213,16 @@ nsNativeAppSupportCocoa::ReOpen()
     }
     
   } // got window mediator
   return NS_OK;
 
   NS_OBJC_END_TRY_ABORT_BLOCK_NSRESULT;
 }
 
-nsresult
-GetNativeWindowPointerFromDOMWindow(nsIDOMWindowInternal *a_window, NSWindow **a_nativeWindow)
-{
-    *a_nativeWindow = nil;
-    if (!a_window) return NS_ERROR_INVALID_ARG;
-    
-    nsCOMPtr<nsIWebNavigation> mruWebNav(do_GetInterface(a_window));
-    if (mruWebNav) {
-      nsCOMPtr<nsIDocShellTreeItem> mruTreeItem(do_QueryInterface(mruWebNav));
-      nsCOMPtr<nsIDocShellTreeOwner> mruTreeOwner = nsnull;
-      mruTreeItem->GetTreeOwner(getter_AddRefs(mruTreeOwner));
-      if(mruTreeOwner) {
-        nsCOMPtr<nsIBaseWindow> mruBaseWindow(do_QueryInterface(mruTreeOwner));
-        if (mruBaseWindow) {
-          nsCOMPtr<nsIWidget> mruWidget = nsnull;
-          mruBaseWindow->GetMainWidget(getter_AddRefs(mruWidget));
-          if (mruWidget) {
-            *a_nativeWindow = (NSWindow*)mruWidget->GetNativeData(NS_NATIVE_WINDOW);
-          }
-        }
-      }
-    }
-    return NS_OK;
-}
-
 #pragma mark -
 
 // Create and return an instance of class nsNativeAppSupportCocoa.
 nsresult NS_CreateNativeAppSupport(nsINativeAppSupport**aResult)
 {
   *aResult = new nsNativeAppSupportCocoa;
   if (!*aResult) return NS_ERROR_OUT_OF_MEMORY;
 
--- a/uriloader/exthandler/mac/nsLocalHandlerAppMac.mm
+++ b/uriloader/exthandler/mac/nsLocalHandlerAppMac.mm
@@ -30,17 +30,18 @@
  * use your version of this file under the terms of the MPL, indicate your
  * decision by deleting the provisions above and replace them with the notice
  * and other provisions required by the GPL or the LGPL. If you do not delete
  * the provisions above, a recipient may use your version of this file under
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 
-#import <Carbon/Carbon.h>
+#import <CoreFoundation/CoreFoundation.h>
+#import <ApplicationServices/ApplicationServices.h>
 
 #include "nsObjCExceptions.h"
 #include "nsLocalHandlerAppMac.h"
 #include "nsILocalFileMac.h"
 #include "nsIURI.h"
 
 // We override this to make sure app bundles display their pretty name (without .app suffix)
 NS_IMETHODIMP nsLocalHandlerAppMac::GetName(nsAString& aName)
--- a/uriloader/exthandler/mac/nsMIMEInfoMac.mm
+++ b/uriloader/exthandler/mac/nsMIMEInfoMac.mm
@@ -35,17 +35,17 @@
  * use your version of this file under the terms of the MPL, indicate your
  * decision by deleting the provisions above and replace them with the notice
  * and other provisions required by the GPL or the LGPL. If you do not delete
  * the provisions above, a recipient may use your version of this file under
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 
-#import <Carbon/Carbon.h>
+#import <ApplicationServices/ApplicationServices.h>
 
 #include "nsObjCExceptions.h"
 #include "nsMIMEInfoMac.h"
 #include "nsILocalFileMac.h"
 #include "nsIFileURL.h"
 
 // We override this to make sure app bundles display their pretty name (without .app suffix)
 NS_IMETHODIMP nsMIMEInfoMac::GetDefaultDescription(nsAString& aDefaultDescription)
--- a/uriloader/exthandler/mac/nsOSHelperAppService.mm
+++ b/uriloader/exthandler/mac/nsOSHelperAppService.mm
@@ -51,17 +51,18 @@
 #include "nsMimeTypes.h"
 #include "nsIStringBundle.h"
 #include "nsIPromptService.h"
 #include "nsMemory.h"
 #include "nsCRT.h"
 #include "nsMIMEInfoMac.h"
 #include "nsEmbedCID.h"
 
-#import <Carbon/Carbon.h>
+#import <CoreFoundation/CoreFoundation.h>
+#import <ApplicationServices/ApplicationServices.h>
 
 // chrome URL's
 #define HELPERAPPLAUNCHER_BUNDLE_URL "chrome://global/locale/helperAppLauncher.properties"
 #define BRAND_BUNDLE_URL "chrome://branding/locale/brand.properties"
 
 extern "C" {
   // Returns the CFURL for application currently set as the default opener for
   // the given URL scheme. appURL must be released by the caller.
--- a/widget/src/cocoa/nsBidiKeyboard.mm
+++ b/widget/src/cocoa/nsBidiKeyboard.mm
@@ -38,18 +38,16 @@
  *
  * ***** END LICENSE BLOCK ***** */
 
 #include "nsBidiKeyboard.h"
 #include "nsObjCExceptions.h"
 #include "nsCocoaUtils.h"
 #include "nsCocoaTextInputHandler.h"
 
-#import <Carbon/Carbon.h>
-
 NS_IMPL_ISUPPORTS1(nsBidiKeyboard, nsIBidiKeyboard)
 
 nsBidiKeyboard::nsBidiKeyboard() : nsIBidiKeyboard()
 {
 }
 
 nsBidiKeyboard::~nsBidiKeyboard()
 {
--- a/widget/src/cocoa/nsLookAndFeel.mm
+++ b/widget/src/cocoa/nsLookAndFeel.mm
@@ -36,17 +36,16 @@
  *
  * ***** END LICENSE BLOCK ***** */
 
 #include "nsLookAndFeel.h"
 #include "nsObjCExceptions.h"
 #include "nsIServiceManager.h"
 #include "nsNativeThemeColors.h"
 
-#import <Carbon/Carbon.h>
 #import <Cocoa/Cocoa.h>
 
 nsLookAndFeel::nsLookAndFeel() : nsXPLookAndFeel()
 {
 }
 
 nsLookAndFeel::~nsLookAndFeel()
 {
--- a/widget/src/cocoa/nsMenuItemIconX.h
+++ b/widget/src/cocoa/nsMenuItemIconX.h
@@ -46,17 +46,16 @@
 #include "nsCOMPtr.h"
 #include "imgIDecoderObserver.h"
 
 class nsIURI;
 class nsIContent;
 class imgIRequest;
 class nsMenuObjectX;
 
-#import <Carbon/Carbon.h>
 #import <Cocoa/Cocoa.h>
 
 class nsMenuItemIconX : public imgIDecoderObserver
 {
 public:
   nsMenuItemIconX(nsMenuObjectX* aMenuItem,
                   nsIContent*    aContent,
                   NSMenuItem*    aNativeMenuItem);
--- a/widget/src/cocoa/nsMenuUtilsX.h
+++ b/widget/src/cocoa/nsMenuUtilsX.h
@@ -39,24 +39,21 @@
 #ifndef nsMenuUtilsX_h_
 #define nsMenuUtilsX_h_
 
 #include "nscore.h"
 #include "nsEvent.h"
 #include "nsMenuBaseX.h"
 
 #import <Cocoa/Cocoa.h>
-#import <Carbon/Carbon.h>
 
 class nsIContent;
 class nsString;
 class nsMenuBarX;
 
-extern "C" MenuRef _NSGetCarbonMenu(NSMenu* aMenu);
-
 // Namespace containing utility functions used in our native menu implementation.
 namespace nsMenuUtilsX
 {
   void          DispatchCommandTo(nsIContent* aTargetContent);
   NSString*     GetTruncatedCocoaLabel(const nsString& itemLabel);
   PRUint8       GeckoModifiersForNodeAttribute(const nsString& modifiersAttribute);
   unsigned int  MacModifiersForGeckoModifiers(PRUint8 geckoModifiers);
   nsMenuBarX*   GetHiddenWindowMenuBar(); // returned object is not retained
--- a/widget/src/cocoa/nsMenuUtilsX.mm
+++ b/widget/src/cocoa/nsMenuUtilsX.mm
@@ -48,16 +48,18 @@
 #include "nsIDocument.h"
 #include "nsIDOMDocumentEvent.h"
 #include "nsIDOMEventTarget.h"
 #include "nsIDOMXULCommandEvent.h"
 #include "nsIPrivateDOMEvent.h"
 #include "nsPIDOMWindow.h"
 #include "nsIDOMAbstractView.h"
 
+#include <Carbon/Carbon.h>
+
 void nsMenuUtilsX::DispatchCommandTo(nsIContent* aTargetContent)
 {
   NS_PRECONDITION(aTargetContent, "null ptr");
 
   nsIDocument* doc = aTargetContent->GetOwnerDoc();
   nsCOMPtr<nsIDOMDocumentEvent> docEvent = do_QueryInterface(doc);
   nsCOMPtr<nsIDOMEventTarget> target = do_QueryInterface(aTargetContent);
   if (docEvent && target) {
--- a/widget/src/cocoa/nsToolkit.mm
+++ b/widget/src/cocoa/nsToolkit.mm
@@ -43,17 +43,16 @@
 #include <stdlib.h>
 #include <stdio.h>
 
 #include <mach/mach_port.h>
 #include <mach/mach_interface.h>
 #include <mach/mach_init.h>
 
 #import <Cocoa/Cocoa.h>
-#import <Carbon/Carbon.h>
 #import <IOKit/pwr_mgt/IOPMLib.h>
 #import <IOKit/IOMessage.h>
 
 #include "nsCocoaUtils.h"
 #include "nsObjCExceptions.h"
 
 #include "nsWidgetAtoms.h"
 #include "nsIRollupListener.h"