Bug 1117635 - Declare that MacApplicationDelegate implements the NSApplicationDelegate protocol. r=mstange
authorChris Peterson <cpeterson@mozilla.com>
Wed, 07 Jan 2015 18:33:32 -0800
changeset 248691 493811e4694e6ca903a9e6a3a8cae3045e878a33
parent 248690 20ed57d8a4e7ecc2d3a10d28533b03675b749f74
child 248692 0494ce969472c77187679861f09cd9f00058143e
push id4489
push userraliiev@mozilla.com
push dateMon, 23 Feb 2015 15:17:55 +0000
treeherdermozilla-beta@fd7c3dc24146 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmstange
bugs1117635
milestone37.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 1117635 - Declare that MacApplicationDelegate implements the NSApplicationDelegate protocol. r=mstange
toolkit/xre/MacApplicationDelegate.mm
toolkit/xre/moz.build
--- a/toolkit/xre/MacApplicationDelegate.mm
+++ b/toolkit/xre/MacApplicationDelegate.mm
@@ -11,16 +11,17 @@
 // See http://developer.apple.com/documentation/Cocoa/Conceptual/ScriptableCocoaApplications/SApps_handle_AEs/chapter_11_section_3.html for details.
 
 #import <Cocoa/Cocoa.h>
 #import <Carbon/Carbon.h>
 
 #include "nsCOMPtr.h"
 #include "nsINativeAppSupport.h"
 #include "nsAppRunner.h"
+#include "nsAppShell.h"
 #include "nsComponentManagerUtils.h"
 #include "nsIServiceManager.h"
 #include "nsServiceManagerUtils.h"
 #include "nsIAppStartup.h"
 #include "nsIObserverService.h"
 #include "nsISupportsPrimitives.h"
 #include "nsObjCExceptions.h"
 #include "nsIFile.h"
@@ -41,26 +42,24 @@ public:
   ~AutoAutoreleasePool()
   {
     [mLocalPool release];
   }
 private:
   NSAutoreleasePool *mLocalPool;
 };
 
-@interface MacApplicationDelegate : NSObject
+@interface MacApplicationDelegate : NSObject<NSApplicationDelegate>
 {
 }
 
 @end
 
 static bool sProcessedGetURLEvent = false;
 
-@class GeckoNSApplication;
-
 // Methods that can be called from non-Objective-C code.
 
 // This is needed, on relaunch, to force the OS to use the "Cocoa Dock API"
 // instead of the "Carbon Dock API".  For more info see bmo bug 377166.
 void
 EnsureUseCocoaDockAPI()
 {
   NS_OBJC_BEGIN_TRY_ABORT_BLOCK;
@@ -84,18 +83,18 @@ SetupMacApplicationDelegate()
 
   // This call makes it so that application:openFile: doesn't get bogus calls
   // from Cocoa doing its own parsing of the argument string. And yes, we need
   // to use a string with a boolean value in it. That's just how it works.
   [[NSUserDefaults standardUserDefaults] setObject:@"NO"
                                             forKey:@"NSTreatUnknownArgumentsAsOpen"];
 
   // Create the delegate. This should be around for the lifetime of the app.
-  MacApplicationDelegate *delegate = [[MacApplicationDelegate alloc] init];
-  [NSApp setDelegate:delegate];
+  id<NSApplicationDelegate> delegate = [[MacApplicationDelegate alloc] init];
+  [[GeckoNSApplication sharedApplication] setDelegate:delegate];
 
   NS_OBJC_END_TRY_ABORT_BLOCK;
 }
 
 // Indirectly make the OS process any pending GetURL Apple events.  This is
 // done via _DPSNextEvent() (an undocumented AppKit function called from
 // [NSApplication nextEventMatchingMask:untilDate:inMode:dequeue:]).  Apple
 // events are only processed if 'dequeue' is 'YES' -- so we need to call
--- a/toolkit/xre/moz.build
+++ b/toolkit/xre/moz.build
@@ -150,16 +150,22 @@ LOCAL_INCLUDES += [
     '/config',
     '/dom/base',
     '/dom/ipc',
     '/testing/gtest/mozilla',
     '/toolkit/crashreporter',
     '/xpcom/build',
 ]
 
+if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'cocoa':
+    LOCAL_INCLUDES += [
+        '/widget',
+        '/widget/cocoa',
+    ]
+
 if CONFIG['MOZ_ENABLE_XREMOTE']:
     LOCAL_INCLUDES += [
         '/widget/xremoteclient',
     ]
 
 if CONFIG['MOZ_B2G_LOADER']:
     DEFINES['OMNIJAR_NAME'] = CONFIG['OMNIJAR_NAME']