You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by sh...@apache.org on 2013/03/07 02:15:28 UTC

[6/7] Added plugin support. Core plugins implemented are Device and NetworkConnection.

http://git-wip-us.apache.org/repos/asf/cordova-osx/blob/5bfb9c0c/CordovaMac/CordovaLib/Commands/CDVPlugin.m
----------------------------------------------------------------------
diff --git a/CordovaMac/CordovaLib/Commands/CDVPlugin.m b/CordovaMac/CordovaLib/Commands/CDVPlugin.m
new file mode 100644
index 0000000..6301fac
--- /dev/null
+++ b/CordovaMac/CordovaLib/Commands/CDVPlugin.m
@@ -0,0 +1,148 @@
+/*
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements.  See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership.  The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License.  You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied.  See the License for the
+ specific language governing permissions and limitations
+ under the License.
+ */
+
+#import "CDVPlugin.h"
+
+NSString* const CDVPageDidLoadNotification = @"CDVPageDidLoadNotification";
+NSString* const CDVPluginHandleOpenURLNotification = @"CDVPluginHandleOpenURLNotification";
+NSString* const CDVPluginResetNotification = @"CDVPluginResetNotification";
+NSString* const CDVLocalNotification = @"CDVLocalNotification";
+
+@interface CDVPlugin ()
+
+@property (readwrite, assign) BOOL hasPendingOperation;
+
+@end
+
+@implementation CDVPlugin
+@synthesize webView, viewController, commandDelegate, hasPendingOperation;
+
+- (CDVPlugin*)initWithWebView:(WebView*)theWebView
+{
+    self = [super init];
+    if (self) {
+//        [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(onAppTerminate) name:UIApplicationWillTerminateNotification object:nil];
+//        [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(onMemoryWarning) name:UIApplicationDidReceiveMemoryWarningNotification object:nil];
+        [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(handleOpenURL:) name:CDVPluginHandleOpenURLNotification object:nil];
+        [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(onReset) name:CDVPluginResetNotification object:theWebView];
+
+        self.webView = theWebView;
+    }
+    return self;
+}
+
+- (void)pluginInitialize
+{
+    // You can listen to more app notifications, see:
+    // http://developer.apple.com/library/ios/#DOCUMENTATION/UIKit/Reference/UIApplication_Class/Reference/Reference.html#//apple_ref/doc/uid/TP40006728-CH3-DontLinkElementID_4
+
+    // NOTE: if you want to use these, make sure you uncomment the corresponding notification handler
+
+    // [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(onPause) name:UIApplicationDidEnterBackgroundNotification object:nil];
+    // [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(onResume) name:UIApplicationWillEnterForegroundNotification object:nil];
+    // [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(onOrientationWillChange) name:UIApplicationWillChangeStatusBarOrientationNotification object:nil];
+    // [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(onOrientationDidChange) name:UIApplicationDidChangeStatusBarOrientationNotification object:nil];
+
+    // Added in 2.3.0
+    // [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(didReceiveLocalNotification:) name:CDVLocalNotification object:nil];
+
+    // Added in 2.5.0
+    // [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(pageDidLoad:) name:CDVPageDidLoadNotification object:self.webView];
+}
+
+- (void)dispose
+{
+    viewController = nil;
+    commandDelegate = nil;
+    webView = nil;
+}
+
+/*
+// NOTE: for onPause and onResume, calls into JavaScript must not call or trigger any blocking UI, like alerts
+- (void) onPause {}
+- (void) onResume {}
+- (void) onOrientationWillChange {}
+- (void) onOrientationDidChange {}
+*/
+
+/* NOTE: calls into JavaScript must not call or trigger any blocking UI, like alerts */
+- (void)handleOpenURL:(NSNotification*)notification
+{
+    // override to handle urls sent to your app
+    // register your url schemes in your App-Info.plist
+
+    NSURL* url = [notification object];
+
+    if ([url isKindOfClass:[NSURL class]]) {
+        /* Do your thing! */
+    }
+}
+
+/* NOTE: calls into JavaScript must not call or trigger any blocking UI, like alerts */
+- (void)onAppTerminate
+{
+    // override this if you need to do any cleanup on app exit
+}
+
+- (void)onMemoryWarning
+{
+    // override to remove caches, etc
+}
+
+- (void)onReset
+{
+    // Override to cancel any long-running requests when the WebView navigates or refreshes.
+}
+
+- (void)dealloc
+{
+    [[NSNotificationCenter defaultCenter] removeObserver:self];   // this will remove all notification unless added using addObserverForName:object:queue:usingBlock:
+}
+
+- (id)appDelegate
+{
+    // TODO:
+    //return [[UIApplication sharedApplication] delegate];
+    return nil;
+}
+
+- (NSString*)writeJavascript:(NSString*)javascript
+{
+    return [self.webView stringByEvaluatingJavaScriptFromString:javascript];
+}
+
+- (NSString*)success:(CDVPluginResult*)pluginResult callbackId:(NSString*)callbackId
+{
+    [self.commandDelegate evalJs:[pluginResult toSuccessCallbackString:callbackId]];
+    return @"";
+}
+
+- (NSString*)error:(CDVPluginResult*)pluginResult callbackId:(NSString*)callbackId
+{
+    [self.commandDelegate evalJs:[pluginResult toErrorCallbackString:callbackId]];
+    return @"";
+}
+
+// default implementation does nothing, ideally, we are not registered for notification if we aren't going to do anything.
+// - (void)didReceiveLocalNotification:(NSNotification *)notification
+// {
+//    // UILocalNotification* localNotification = [notification object]; // get the payload as a LocalNotification
+// }
+
+@end

http://git-wip-us.apache.org/repos/asf/cordova-osx/blob/5bfb9c0c/CordovaMac/CordovaLib/Commands/CDVPluginResult.h
----------------------------------------------------------------------
diff --git a/CordovaMac/CordovaLib/Commands/CDVPluginResult.h b/CordovaMac/CordovaLib/Commands/CDVPluginResult.h
new file mode 100644
index 0000000..8393df2
--- /dev/null
+++ b/CordovaMac/CordovaLib/Commands/CDVPluginResult.h
@@ -0,0 +1,65 @@
+/*
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements.  See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership.  The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License.  You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied.  See the License for the
+ specific language governing permissions and limitations
+ under the License.
+ */
+
+#import <Foundation/Foundation.h>
+
+typedef enum {
+    CDVCommandStatus_NO_RESULT = 0,
+    CDVCommandStatus_OK,
+    CDVCommandStatus_CLASS_NOT_FOUND_EXCEPTION,
+    CDVCommandStatus_ILLEGAL_ACCESS_EXCEPTION,
+    CDVCommandStatus_INSTANTIATION_EXCEPTION,
+    CDVCommandStatus_MALFORMED_URL_EXCEPTION,
+    CDVCommandStatus_IO_EXCEPTION,
+    CDVCommandStatus_INVALID_ACTION,
+    CDVCommandStatus_JSON_EXCEPTION,
+    CDVCommandStatus_ERROR
+} CDVCommandStatus;
+
+@interface CDVPluginResult : NSObject {}
+
+@property (nonatomic, strong, readonly) NSNumber* status;
+@property (nonatomic, strong, readonly) id message;
+@property (nonatomic, strong)           NSNumber* keepCallback;
+
+- (CDVPluginResult*)init;
++ (CDVPluginResult*)resultWithStatus:(CDVCommandStatus)statusOrdinal;
++ (CDVPluginResult*)resultWithStatus:(CDVCommandStatus)statusOrdinal messageAsString:(NSString*)theMessage;
++ (CDVPluginResult*)resultWithStatus:(CDVCommandStatus)statusOrdinal messageAsArray:(NSArray*)theMessage;
++ (CDVPluginResult*)resultWithStatus:(CDVCommandStatus)statusOrdinal messageAsInt:(int)theMessage;
++ (CDVPluginResult*)resultWithStatus:(CDVCommandStatus)statusOrdinal messageAsDouble:(double)theMessage;
++ (CDVPluginResult*)resultWithStatus:(CDVCommandStatus)statusOrdinal messageAsBool:(BOOL)theMessage;
++ (CDVPluginResult*)resultWithStatus:(CDVCommandStatus)statusOrdinal messageAsDictionary:(NSDictionary*)theMessage;
++ (CDVPluginResult*)resultWithStatus:(CDVCommandStatus)statusOrdinal messageAsArrayBuffer:(NSData*)theMessage;
++ (CDVPluginResult*)resultWithStatus:(CDVCommandStatus)statusOrdinal messageAsMultipart:(NSArray*)theMessages;
++ (CDVPluginResult*)resultWithStatus:(CDVCommandStatus)statusOrdinal messageToErrorObject:(int)errorCode;
+
++ (void)setVerbose:(BOOL)verbose;
++ (BOOL)isVerbose;
+
+- (void)setKeepCallbackAsBool:(BOOL)bKeepCallback;
+
+- (NSString*)argumentsAsJSON;
+
+// These methods are used by the legacy plugin return result method
+- (NSString*)toJSONString;
+- (NSString*)toSuccessCallbackString:(NSString*)callbackId;
+- (NSString*)toErrorCallbackString:(NSString*)callbackId;
+
+@end

http://git-wip-us.apache.org/repos/asf/cordova-osx/blob/5bfb9c0c/CordovaMac/CordovaLib/Commands/CDVPluginResult.m
----------------------------------------------------------------------
diff --git a/CordovaMac/CordovaLib/Commands/CDVPluginResult.m b/CordovaMac/CordovaLib/Commands/CDVPluginResult.m
new file mode 100644
index 0000000..a03e005
--- /dev/null
+++ b/CordovaMac/CordovaLib/Commands/CDVPluginResult.m
@@ -0,0 +1,224 @@
+/*
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements.  See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership.  The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License.  You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied.  See the License for the
+ specific language governing permissions and limitations
+ under the License.
+ */
+
+#import "CDVPluginResult.h"
+#import "CDVJSON.h"
+#import "CDVDebug.h"
+#import "NSData+Base64.h"
+
+@interface CDVPluginResult ()
+
+- (CDVPluginResult*)initWithStatus:(CDVCommandStatus)statusOrdinal message:(id)theMessage;
+
+@end
+
+@implementation CDVPluginResult
+@synthesize status, message, keepCallback;
+
+static NSArray* org_apache_cordova_CommandStatusMsgs;
+
+id messageFromArrayBuffer(NSData* data)
+{
+    return @{
+        @"CDVType" : @"ArrayBuffer",
+        @"data" :[data base64EncodedString]
+    };
+}
+
+id massageMessage(id message)
+{
+    if ([message isKindOfClass:[NSData class]]) {
+        return messageFromArrayBuffer(message);
+    }
+    return message;
+}
+
+id messageFromMultipart(NSArray* theMessages)
+{
+    NSMutableArray* messages = [NSMutableArray arrayWithArray:theMessages];
+
+    for (NSUInteger i = 0; i < messages.count; ++i) {
+        [messages replaceObjectAtIndex:i withObject:massageMessage([messages objectAtIndex:i])];
+    }
+
+    return @{
+        @"CDVType" : @"MultiPart",
+        @"messages" : messages
+    };
+}
+
++ (void)initialize
+{
+    org_apache_cordova_CommandStatusMsgs = [[NSArray alloc] initWithObjects:@"No result",
+        @"OK",
+        @"Class not found",
+        @"Illegal access",
+        @"Instantiation error",
+        @"Malformed url",
+        @"IO error",
+        @"Invalid action",
+        @"JSON error",
+        @"Error",
+        nil];
+}
+
+- (CDVPluginResult*)init
+{
+    return [self initWithStatus:CDVCommandStatus_NO_RESULT message:nil];
+}
+
+- (CDVPluginResult*)initWithStatus:(CDVCommandStatus)statusOrdinal message:(id)theMessage
+{
+    self = [super init];
+    if (self) {
+        status = [NSNumber numberWithInt:statusOrdinal];
+        message = theMessage;
+        keepCallback = [NSNumber numberWithBool:NO];
+    }
+    return self;
+}
+
++ (CDVPluginResult*)resultWithStatus:(CDVCommandStatus)statusOrdinal
+{
+    return [[self alloc] initWithStatus:statusOrdinal message:[org_apache_cordova_CommandStatusMsgs objectAtIndex:statusOrdinal]];
+}
+
++ (CDVPluginResult*)resultWithStatus:(CDVCommandStatus)statusOrdinal messageAsString:(NSString*)theMessage
+{
+    return [[self alloc] initWithStatus:statusOrdinal message:theMessage];
+}
+
++ (CDVPluginResult*)resultWithStatus:(CDVCommandStatus)statusOrdinal messageAsArray:(NSArray*)theMessage
+{
+    return [[self alloc] initWithStatus:statusOrdinal message:theMessage];
+}
+
++ (CDVPluginResult*)resultWithStatus:(CDVCommandStatus)statusOrdinal messageAsInt:(int)theMessage
+{
+    return [[self alloc] initWithStatus:statusOrdinal message:[NSNumber numberWithInt:theMessage]];
+}
+
++ (CDVPluginResult*)resultWithStatus:(CDVCommandStatus)statusOrdinal messageAsDouble:(double)theMessage
+{
+    return [[self alloc] initWithStatus:statusOrdinal message:[NSNumber numberWithDouble:theMessage]];
+}
+
++ (CDVPluginResult*)resultWithStatus:(CDVCommandStatus)statusOrdinal messageAsBool:(BOOL)theMessage
+{
+    return [[self alloc] initWithStatus:statusOrdinal message:[NSNumber numberWithBool:theMessage]];
+}
+
++ (CDVPluginResult*)resultWithStatus:(CDVCommandStatus)statusOrdinal messageAsDictionary:(NSDictionary*)theMessage
+{
+    return [[self alloc] initWithStatus:statusOrdinal message:theMessage];
+}
+
++ (CDVPluginResult*)resultWithStatus:(CDVCommandStatus)statusOrdinal messageAsArrayBuffer:(NSData*)theMessage
+{
+    return [[self alloc] initWithStatus:statusOrdinal message:messageFromArrayBuffer(theMessage)];
+}
+
++ (CDVPluginResult*)resultWithStatus:(CDVCommandStatus)statusOrdinal messageAsMultipart:(NSArray*)theMessages
+{
+    return [[self alloc] initWithStatus:statusOrdinal message:messageFromMultipart(theMessages)];
+}
+
++ (CDVPluginResult*)resultWithStatus:(CDVCommandStatus)statusOrdinal messageToErrorObject:(int)errorCode
+{
+    NSDictionary* errDict = @{@"code": [NSNumber numberWithInt:errorCode]};
+
+    return [[self alloc] initWithStatus:statusOrdinal message:errDict];
+}
+
+- (void)setKeepCallbackAsBool:(BOOL)bKeepCallback
+{
+    [self setKeepCallback:[NSNumber numberWithBool:bKeepCallback]];
+}
+
+- (NSString*)argumentsAsJSON
+{
+    id arguments = (self.message == nil ? [NSNull null] : self.message);
+    NSArray* argumentsWrappedInArray = [NSArray arrayWithObject:arguments];
+
+    NSString* argumentsJSON = [argumentsWrappedInArray JSONString];
+
+    argumentsJSON = [argumentsJSON substringWithRange:NSMakeRange(1, [argumentsJSON length] - 2)];
+
+    return argumentsJSON;
+}
+
+// These methods are used by the legacy plugin return result method
+- (NSString*)toJSONString
+{
+    NSDictionary* dict = [NSDictionary dictionaryWithObjectsAndKeys:
+        self.status, @"status",
+        self.message ? self.                                message:[NSNull null], @"message",
+        self.keepCallback, @"keepCallback",
+        nil];
+
+    NSError* error = nil;
+    NSData* jsonData = [NSJSONSerialization dataWithJSONObject:dict
+                                                       options:NSJSONWritingPrettyPrinted
+                                                         error:&error];
+    NSString* resultString = nil;
+
+    if (error != nil) {
+        NSLog(@"toJSONString error: %@", [error localizedDescription]);
+    } else {
+        resultString = [[NSString alloc] initWithData:jsonData encoding:NSUTF8StringEncoding];
+    }
+
+    if ([[self class] isVerbose]) {
+        NSLog(@"PluginResult:toJSONString - %@", resultString);
+    }
+    return resultString;
+}
+
+- (NSString*)toSuccessCallbackString:(NSString*)callbackId
+{
+    NSString* successCB = [NSString stringWithFormat:@"cordova.callbackSuccess('%@',%@);", callbackId, [self toJSONString]];
+
+    if ([[self class] isVerbose]) {
+        NSLog(@"PluginResult toSuccessCallbackString: %@", successCB);
+    }
+    return successCB;
+}
+
+- (NSString*)toErrorCallbackString:(NSString*)callbackId
+{
+    NSString* errorCB = [NSString stringWithFormat:@"cordova.callbackError('%@',%@);", callbackId, [self toJSONString]];
+
+    if ([[self class] isVerbose]) {
+        NSLog(@"PluginResult toErrorCallbackString: %@", errorCB);
+    }
+    return errorCB;
+}
+
+static BOOL gIsVerbose = NO;
++ (void)setVerbose:(BOOL)verbose
+{
+    gIsVerbose = verbose;
+}
+
++ (BOOL)isVerbose
+{
+    return gIsVerbose;
+}
+
+@end

http://git-wip-us.apache.org/repos/asf/cordova-osx/blob/5bfb9c0c/CordovaMac/CordovaLib/Commands/CDVReachability.h
----------------------------------------------------------------------
diff --git a/CordovaMac/CordovaLib/Commands/CDVReachability.h b/CordovaMac/CordovaLib/Commands/CDVReachability.h
new file mode 100644
index 0000000..01a95c3
--- /dev/null
+++ b/CordovaMac/CordovaLib/Commands/CDVReachability.h
@@ -0,0 +1,85 @@
+/*
+
+ File: Reachability.h
+ Abstract: Basic demonstration of how to use the SystemConfiguration Reachability APIs.
+ Version: 2.2
+
+ Disclaimer: IMPORTANT:  This Apple software is supplied to you by Apple Inc.
+ ("Apple") in consideration of your agreement to the following terms, and your
+ use, installation, modification or redistribution of this Apple software
+ constitutes acceptance of these terms.  If you do not agree with these terms,
+ please do not use, install, modify or redistribute this Apple software.
+
+ In consideration of your agreement to abide by the following terms, and subject
+ to these terms, Apple grants you a personal, non-exclusive license, under
+ Apple's copyrights in this original Apple software (the "Apple Software"), to
+ use, reproduce, modify and redistribute the Apple Software, with or without
+ modifications, in source and/or binary forms; provided that if you redistribute
+ the Apple Software in its entirety and without modifications, you must retain
+ this notice and the following text and disclaimers in all such redistributions
+ of the Apple Software.
+ Neither the name, trademarks, service marks or logos of Apple Inc. may be used
+ to endorse or promote products derived from the Apple Software without specific
+ prior written permission from Apple.  Except as expressly stated in this notice,
+ no other rights or licenses, express or implied, are granted by Apple herein,
+ including but not limited to any patent rights that may be infringed by your
+ derivative works or by other works in which the Apple Software may be
+ incorporated.
+
+ The Apple Software is provided by Apple on an "AS IS" basis.  APPLE MAKES NO
+ WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION THE IMPLIED
+ WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND OPERATION ALONE OR IN
+ COMBINATION WITH YOUR PRODUCTS.
+
+ IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL OR
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
+ GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION, MODIFICATION AND/OR
+ DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED AND WHETHER UNDER THEORY OF
+ CONTRACT, TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR OTHERWISE, EVEN IF
+ APPLE HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+ Copyright (C) 2010 Apple Inc. All Rights Reserved.
+
+*/
+
+#import <Foundation/Foundation.h>
+#import <SystemConfiguration/SystemConfiguration.h>
+#import <netinet/in.h>
+
+typedef enum {
+    NotReachable = 0,
+    ReachableViaWWAN, // this value has been swapped with ReachableViaWiFi for Cordova backwards compat. reasons
+    ReachableViaWiFi  // this value has been swapped with ReachableViaWWAN for Cordova backwards compat. reasons
+} NetworkStatus;
+#define kReachabilityChangedNotification @"kNetworkReachabilityChangedNotification"
+
+@interface CDVReachability : NSObject
+{
+    BOOL localWiFiRef;
+    SCNetworkReachabilityRef reachabilityRef;
+}
+
+// reachabilityWithHostName- Use to check the reachability of a particular host name.
++ (CDVReachability*)reachabilityWithHostName:(NSString*)hostName;
+
+// reachabilityWithAddress- Use to check the reachability of a particular IP address.
++ (CDVReachability*)reachabilityWithAddress:(const struct sockaddr_in*)hostAddress;
+
+// reachabilityForInternetConnection- checks whether the default route is available.
+//  Should be used by applications that do not connect to a particular host
++ (CDVReachability*)reachabilityForInternetConnection;
+
+// reachabilityForLocalWiFi- checks whether a local wifi connection is available.
++ (CDVReachability*)reachabilityForLocalWiFi;
+
+// Start listening for reachability notifications on the current run loop
+- (BOOL)startNotifier;
+- (void)stopNotifier;
+
+- (NetworkStatus)currentReachabilityStatus;
+// WWAN may be available, but not active until a connection has been established.
+// WiFi may require a connection for VPN on Demand.
+- (BOOL)connectionRequired;
+@end

http://git-wip-us.apache.org/repos/asf/cordova-osx/blob/5bfb9c0c/CordovaMac/CordovaLib/Commands/CDVReachability.m
----------------------------------------------------------------------
diff --git a/CordovaMac/CordovaLib/Commands/CDVReachability.m b/CordovaMac/CordovaLib/Commands/CDVReachability.m
new file mode 100644
index 0000000..ed1afe7
--- /dev/null
+++ b/CordovaMac/CordovaLib/Commands/CDVReachability.m
@@ -0,0 +1,261 @@
+/*
+
+ File: Reachability.m
+ Abstract: Basic demonstration of how to use the SystemConfiguration Reachability APIs.
+ Version: 2.2
+
+ Disclaimer: IMPORTANT:  This Apple software is supplied to you by Apple Inc.
+ ("Apple") in consideration of your agreement to the following terms, and your
+ use, installation, modification or redistribution of this Apple software
+ constitutes acceptance of these terms.  If you do not agree with these terms,
+ please do not use, install, modify or redistribute this Apple software.
+
+ In consideration of your agreement to abide by the following terms, and subject
+ to these terms, Apple grants you a personal, non-exclusive license, under
+ Apple's copyrights in this original Apple software (the "Apple Software"), to
+ use, reproduce, modify and redistribute the Apple Software, with or without
+ modifications, in source and/or binary forms; provided that if you redistribute
+ the Apple Software in its entirety and without modifications, you must retain
+ this notice and the following text and disclaimers in all such redistributions
+ of the Apple Software.
+ Neither the name, trademarks, service marks or logos of Apple Inc. may be used
+ to endorse or promote products derived from the Apple Software without specific
+ prior written permission from Apple.  Except as expressly stated in this notice,
+ no other rights or licenses, express or implied, are granted by Apple herein,
+ including but not limited to any patent rights that may be infringed by your
+ derivative works or by other works in which the Apple Software may be
+ incorporated.
+
+ The Apple Software is provided by Apple on an "AS IS" basis.  APPLE MAKES NO
+ WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION THE IMPLIED
+ WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND OPERATION ALONE OR IN
+ COMBINATION WITH YOUR PRODUCTS.
+
+ IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL OR
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
+ GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION, MODIFICATION AND/OR
+ DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED AND WHETHER UNDER THEORY OF
+ CONTRACT, TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR OTHERWISE, EVEN IF
+ APPLE HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+ Copyright (C) 2010 Apple Inc. All Rights Reserved.
+
+*/
+
+#import <sys/socket.h>
+#import <netinet/in.h>
+#import <netinet6/in6.h>
+#import <arpa/inet.h>
+#import <ifaddrs.h>
+#import <netdb.h>
+
+#import <CoreFoundation/CoreFoundation.h>
+
+#import "CDVReachability.h"
+
+#define kShouldPrintReachabilityFlags 0
+
+static void CDVPrintReachabilityFlags(SCNetworkReachabilityFlags flags, const char* comment)
+{
+#if kShouldPrintReachabilityFlags
+        NSLog(@"Reachability Flag Status: %c%c %c%c%c%c%c%c%c %s\n",
+        (flags & kSCNetworkReachabilityFlagsIsWWAN)               ? 'W' : '-',
+        (flags & kSCNetworkReachabilityFlagsReachable)            ? 'R' : '-',
+
+        (flags & kSCNetworkReachabilityFlagsTransientConnection)  ? 't' : '-',
+        (flags & kSCNetworkReachabilityFlagsConnectionRequired)   ? 'c' : '-',
+        (flags & kSCNetworkReachabilityFlagsConnectionOnTraffic)  ? 'C' : '-',
+        (flags & kSCNetworkReachabilityFlagsInterventionRequired) ? 'i' : '-',
+        (flags & kSCNetworkReachabilityFlagsConnectionOnDemand)   ? 'D' : '-',
+        (flags & kSCNetworkReachabilityFlagsIsLocalAddress)       ? 'l' : '-',
+        (flags & kSCNetworkReachabilityFlagsIsDirect)             ? 'd' : '-',
+        comment
+        );
+#endif
+}
+
+@implementation CDVReachability
+
+static void CDVReachabilityCallback(SCNetworkReachabilityRef target, SCNetworkReachabilityFlags flags, void* info)
+{
+#pragma unused (target, flags)
+    //	NSCAssert(info != NULL, @"info was NULL in ReachabilityCallback");
+    //	NSCAssert([(NSObject*) info isKindOfClass: [Reachability class]], @"info was wrong class in ReachabilityCallback");
+
+    // Converted the asserts above to conditionals, with safe return from the function
+    if (info == NULL) {
+        NSLog(@"info was NULL in ReachabilityCallback");
+        return;
+    }
+
+    if (![(__bridge  NSObject*) info isKindOfClass:[CDVReachability class]]) {
+        NSLog(@"info was wrong class in ReachabilityCallback");
+        return;
+    }
+
+    // We're on the main RunLoop, so an NSAutoreleasePool is not necessary, but is added defensively
+    // in case someon uses the Reachability object in a different thread.
+    @autoreleasepool {
+        CDVReachability* noteObject = (__bridge CDVReachability*)info;
+        // Post a notification to notify the client that the network reachability changed.
+        [[NSNotificationCenter defaultCenter] postNotificationName:kReachabilityChangedNotification object:noteObject];
+    }
+}
+
+- (BOOL)startNotifier
+{
+    BOOL retVal = NO;
+    SCNetworkReachabilityContext context = {0, (__bridge void*)(self), NULL, NULL, NULL};
+
+    if (SCNetworkReachabilitySetCallback(reachabilityRef, CDVReachabilityCallback, &context)) {
+        if (SCNetworkReachabilityScheduleWithRunLoop(reachabilityRef, CFRunLoopGetCurrent(), kCFRunLoopDefaultMode)) {
+            retVal = YES;
+        }
+    }
+    return retVal;
+}
+
+- (void)stopNotifier
+{
+    if (reachabilityRef != NULL) {
+        SCNetworkReachabilityUnscheduleFromRunLoop(reachabilityRef, CFRunLoopGetCurrent(), kCFRunLoopDefaultMode);
+    }
+}
+
+- (void)dealloc
+{
+    [self stopNotifier];
+    if (reachabilityRef != NULL) {
+        CFRelease(reachabilityRef);
+    }
+    
+}
+
++ (CDVReachability*)reachabilityWithHostName:(NSString*)hostName;
+{
+    CDVReachability* retVal = NULL;
+    SCNetworkReachabilityRef reachability = SCNetworkReachabilityCreateWithName(NULL, [hostName UTF8String]);
+    if (reachability != NULL) {
+        retVal = [[self alloc] init];
+        if (retVal != NULL) {
+            retVal->reachabilityRef = reachability;
+            retVal->localWiFiRef = NO;
+        }
+    }
+    return retVal;
+}
+
++ (CDVReachability*)reachabilityWithAddress:(const struct sockaddr_in*)hostAddress;
+{
+    SCNetworkReachabilityRef reachability = SCNetworkReachabilityCreateWithAddress(kCFAllocatorDefault, (const struct sockaddr*)hostAddress);
+    CDVReachability* retVal = NULL;
+    if (reachability != NULL) {
+        retVal = [[self alloc] init];
+        if (retVal != NULL) {
+            retVal->reachabilityRef = reachability;
+            retVal->localWiFiRef = NO;
+        }
+    }
+    return retVal;
+}
+
++ (CDVReachability*)reachabilityForInternetConnection;
+{
+    struct sockaddr_in zeroAddress;
+    bzero(&zeroAddress, sizeof(zeroAddress));
+    zeroAddress.sin_len = sizeof(zeroAddress);
+    zeroAddress.sin_family = AF_INET;
+    return [self reachabilityWithAddress:&zeroAddress];
+}
+
++ (CDVReachability*)reachabilityForLocalWiFi;
+{
+    struct sockaddr_in localWifiAddress;
+    bzero(&localWifiAddress, sizeof(localWifiAddress));
+    localWifiAddress.sin_len = sizeof(localWifiAddress);
+    localWifiAddress.sin_family = AF_INET;
+    // IN_LINKLOCALNETNUM is defined in <netinet/in.h> as 169.254.0.0
+    localWifiAddress.sin_addr.s_addr = htonl(IN_LINKLOCALNETNUM);
+    CDVReachability* retVal = [self reachabilityWithAddress:&localWifiAddress];
+    if (retVal != NULL) {
+        retVal->localWiFiRef = YES;
+    }
+    return retVal;
+}
+
+#pragma mark Network Flag Handling
+
+- (NetworkStatus)localWiFiStatusForFlags:(SCNetworkReachabilityFlags)flags
+{
+    CDVPrintReachabilityFlags(flags, "localWiFiStatusForFlags");
+
+    BOOL retVal = NotReachable;
+    if ((flags & kSCNetworkReachabilityFlagsReachable) && (flags & kSCNetworkReachabilityFlagsIsDirect)) {
+        retVal = ReachableViaWiFi;
+    }
+    return retVal;
+}
+
+- (NetworkStatus)networkStatusForFlags:(SCNetworkReachabilityFlags)flags
+{
+    CDVPrintReachabilityFlags(flags, "networkStatusForFlags");
+    if ((flags & kSCNetworkReachabilityFlagsReachable) == 0) {
+        // if target host is not reachable
+        return NotReachable;
+    }
+
+    BOOL retVal = NotReachable;
+
+    if ((flags & kSCNetworkReachabilityFlagsConnectionRequired) == 0) {
+        // if target host is reachable and no connection is required
+        //  then we'll assume (for now) that your on Wi-Fi
+        retVal = ReachableViaWiFi;
+    }
+
+    if ((((flags & kSCNetworkReachabilityFlagsConnectionOnDemand) != 0) ||
+            ((flags & kSCNetworkReachabilityFlagsConnectionOnTraffic) != 0))) {
+        // ... and the connection is on-demand (or on-traffic) if the
+        //     calling application is using the CFSocketStream or higher APIs
+
+        if ((flags & kSCNetworkReachabilityFlagsInterventionRequired) == 0) {
+            // ... and no [user] intervention is needed
+            retVal = ReachableViaWiFi;
+        }
+    }
+
+    if ((flags & kSCNetworkReachabilityFlagsIsDirect) == kSCNetworkReachabilityFlagsIsDirect) {
+        // ... but WWAN connections are OK if the calling application
+        //     is using the CFNetwork (CFSocketStream?) APIs.
+        retVal = ReachableViaWWAN;
+    }
+    return retVal;
+}
+
+- (BOOL)connectionRequired;
+{
+    NSAssert(reachabilityRef != NULL, @"connectionRequired called with NULL reachabilityRef");
+    SCNetworkReachabilityFlags flags;
+    if (SCNetworkReachabilityGetFlags(reachabilityRef, &flags)) {
+        return flags & kSCNetworkReachabilityFlagsConnectionRequired;
+    }
+    return NO;
+}
+
+- (NetworkStatus)currentReachabilityStatus
+{
+    NSAssert(reachabilityRef != NULL, @"currentNetworkStatus called with NULL reachabilityRef");
+    NetworkStatus retVal = NotReachable;
+    SCNetworkReachabilityFlags flags;
+    if (SCNetworkReachabilityGetFlags(reachabilityRef, &flags)) {
+        if (localWiFiRef) {
+            retVal = [self localWiFiStatusForFlags:flags];
+        } else {
+            retVal = [self networkStatusForFlags:flags];
+        }
+    }
+    return retVal;
+}
+
+@end

http://git-wip-us.apache.org/repos/asf/cordova-osx/blob/5bfb9c0c/CordovaMac/CordovaLib/Utils/CDVUtils.h
----------------------------------------------------------------------
diff --git a/CordovaMac/CordovaLib/Utils/CDVUtils.h b/CordovaMac/CordovaLib/Utils/CDVUtils.h
new file mode 100644
index 0000000..c38869f
--- /dev/null
+++ b/CordovaMac/CordovaLib/Utils/CDVUtils.h
@@ -0,0 +1,32 @@
+/*
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements.  See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership.  The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License.  You may obtain a copy of the License at
+ 
+ http://www.apache.org/licenses/LICENSE-2.0
+ 
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied.  See the License for the
+ specific language governing permissions and limitations
+ under the License.
+ */
+
+#import <Foundation/Foundation.h>
+
+#define DEG_EPS 0.001
+#define fequal(a,b) (fabs((a) - (b)) < DEG_EPS)
+#define fequalzero(a) (fabs(a) < DEG_EPS)
+
+@interface CDVUtils : NSObject {
+}
+
++ (float) titleBarHeight:(NSWindow*)aWindow;
++ (NSString*) pathForResource:(NSString*)resourcepath;
+
+@end

http://git-wip-us.apache.org/repos/asf/cordova-osx/blob/5bfb9c0c/CordovaMac/CordovaLib/Utils/CDVUtils.m
----------------------------------------------------------------------
diff --git a/CordovaMac/CordovaLib/Utils/CDVUtils.m b/CordovaMac/CordovaLib/Utils/CDVUtils.m
new file mode 100644
index 0000000..77c9dfc
--- /dev/null
+++ b/CordovaMac/CordovaLib/Utils/CDVUtils.m
@@ -0,0 +1,47 @@
+/*
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements.  See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership.  The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License.  You may obtain a copy of the License at
+ 
+ http://www.apache.org/licenses/LICENSE-2.0
+ 
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied.  See the License for the
+ specific language governing permissions and limitations
+ under the License.
+ */
+
+#import "CDVUtils.h"
+#import "Constants.h"
+
+@implementation CDVUtils
+
++ (float) titleBarHeight:(NSWindow*)aWindow
+{
+    NSRect frame = [aWindow frame];
+    NSRect contentRect = [NSWindow contentRectForFrameRect: frame
+												 styleMask: NSTitledWindowMask];
+	
+    return (frame.size.height - contentRect.size.height);
+}
+
++ (NSString*) pathForResource:(NSString*)resourcepath
+{
+    NSBundle * mainBundle = [NSBundle mainBundle];
+    NSMutableArray *directoryParts = [NSMutableArray arrayWithArray:[resourcepath componentsSeparatedByString:@"/"]];
+    NSString       *filename       = [directoryParts lastObject];
+    [directoryParts removeLastObject];
+	
+    NSString *directoryStr = [NSString stringWithFormat:@"%@/%@", kCDVStartFolder, [directoryParts componentsJoinedByString:@"/"]];
+    return [mainBundle pathForResource:filename
+								ofType:@""
+						   inDirectory:directoryStr];
+}
+
+@end

http://git-wip-us.apache.org/repos/asf/cordova-osx/blob/5bfb9c0c/CordovaMac/CordovaLib/Utils/NSData+Base64.h
----------------------------------------------------------------------
diff --git a/CordovaMac/CordovaLib/Utils/NSData+Base64.h b/CordovaMac/CordovaLib/Utils/NSData+Base64.h
new file mode 100644
index 0000000..ffe9c83
--- /dev/null
+++ b/CordovaMac/CordovaLib/Utils/NSData+Base64.h
@@ -0,0 +1,33 @@
+//
+//  NSData+Base64.h
+//  base64
+//
+//  Created by Matt Gallagher on 2009/06/03.
+//  Copyright 2009 Matt Gallagher. All rights reserved.
+//
+//  Permission is given to use this source code file, free of charge, in any
+//  project, commercial or otherwise, entirely at your risk, with the condition
+//  that any redistribution (in part or whole) of source code must retain
+//  this copyright and permission notice. Attribution in compiled projects is
+//  appreciated but not required.
+//
+
+#import <Foundation/Foundation.h>
+
+void *CDVNewBase64Decode(
+    const char* inputBuffer,
+    size_t    length,
+    size_t    * outputLength);
+
+char *CDVNewBase64Encode(
+    const void* inputBuffer,
+    size_t    length,
+    bool      separateLines,
+    size_t    * outputLength);
+
+@interface NSData (CDVBase64)
+
++ (NSData*)dataFromBase64String:(NSString*)aString;
+- (NSString*)base64EncodedString;
+
+@end

http://git-wip-us.apache.org/repos/asf/cordova-osx/blob/5bfb9c0c/CordovaMac/CordovaLib/Utils/NSData+Base64.m
----------------------------------------------------------------------
diff --git a/CordovaMac/CordovaLib/Utils/NSData+Base64.m b/CordovaMac/CordovaLib/Utils/NSData+Base64.m
new file mode 100644
index 0000000..08c801b
--- /dev/null
+++ b/CordovaMac/CordovaLib/Utils/NSData+Base64.m
@@ -0,0 +1,286 @@
+//
+//  NSData+Base64.m
+//  base64
+//
+//  Created by Matt Gallagher on 2009/06/03.
+//  Copyright 2009 Matt Gallagher. All rights reserved.
+//
+//  Permission is given to use this source code file, free of charge, in any
+//  project, commercial or otherwise, entirely at your risk, with the condition
+//  that any redistribution (in part or whole) of source code must retain
+//  this copyright and permission notice. Attribution in compiled projects is
+//  appreciated but not required.
+//
+
+#import "NSData+Base64.h"
+
+//
+// Mapping from 6 bit pattern to ASCII character.
+//
+static unsigned char cdvbase64EncodeLookup[65] =
+    "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
+
+//
+// Definition for "masked-out" areas of the base64DecodeLookup mapping
+//
+#define xx 65
+
+//
+// Mapping from ASCII character to 6 bit pattern.
+//
+static unsigned char cdvbase64DecodeLookup[256] =
+{
+    xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx,
+    xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx,
+    xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, 62, xx, xx, xx, 63,
+    52, 53, 54, 55, 56, 57, 58, 59, 60, 61, xx, xx, xx, xx, xx, xx,
+    xx, 0,  1,  2,  3,  4,  5,  6,  7,  8,  9,  10, 11, 12, 13, 14,
+    15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, xx, xx, xx, xx, xx,
+    xx, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40,
+    41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, xx, xx, xx, xx, xx,
+    xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx,
+    xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx,
+    xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx,
+    xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx,
+    xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx,
+    xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx,
+    xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx,
+    xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx, xx,
+};
+
+//
+// Fundamental sizes of the binary and base64 encode/decode units in bytes
+//
+#define CDV_BINARY_UNIT_SIZE 3
+#define CDV_BASE64_UNIT_SIZE 4
+
+//
+// NewBase64Decode
+//
+// Decodes the base64 ASCII string in the inputBuffer to a newly malloced
+// output buffer.
+//
+//  inputBuffer - the source ASCII string for the decode
+//	length - the length of the string or -1 (to specify strlen should be used)
+//	outputLength - if not-NULL, on output will contain the decoded length
+//
+// returns the decoded buffer. Must be freed by caller. Length is given by
+//	outputLength.
+//
+void *CDVNewBase64Decode(
+    const char* inputBuffer,
+    size_t    length,
+    size_t    * outputLength)
+{
+    if (length == -1) {
+        length = strlen(inputBuffer);
+    }
+
+    size_t outputBufferSize = (length / CDV_BASE64_UNIT_SIZE) * CDV_BINARY_UNIT_SIZE;
+    unsigned char* outputBuffer = (unsigned char*)malloc(outputBufferSize);
+
+    size_t i = 0;
+    size_t j = 0;
+
+    while (i < length) {
+        //
+        // Accumulate 4 valid characters (ignore everything else)
+        //
+        unsigned char accumulated[CDV_BASE64_UNIT_SIZE];
+        bzero(accumulated, sizeof(unsigned char) * CDV_BASE64_UNIT_SIZE);
+        size_t accumulateIndex = 0;
+
+        while (i < length) {
+            unsigned char decode = cdvbase64DecodeLookup[inputBuffer[i++]];
+            if (decode != xx) {
+                accumulated[accumulateIndex] = decode;
+                accumulateIndex++;
+
+                if (accumulateIndex == CDV_BASE64_UNIT_SIZE) {
+                    break;
+                }
+            }
+        }
+
+        //
+        // Store the 6 bits from each of the 4 characters as 3 bytes
+        //
+        outputBuffer[j] = (accumulated[0] << 2) | (accumulated[1] >> 4);
+        outputBuffer[j + 1] = (accumulated[1] << 4) | (accumulated[2] >> 2);
+        outputBuffer[j + 2] = (accumulated[2] << 6) | accumulated[3];
+        j += accumulateIndex - 1;
+    }
+
+    if (outputLength) {
+        *outputLength = j;
+    }
+    return outputBuffer;
+}
+
+//
+// NewBase64Decode
+//
+// Encodes the arbitrary data in the inputBuffer as base64 into a newly malloced
+// output buffer.
+//
+//  inputBuffer - the source data for the encode
+//	length - the length of the input in bytes
+//  separateLines - if zero, no CR/LF characters will be added. Otherwise
+//		a CR/LF pair will be added every 64 encoded chars.
+//	outputLength - if not-NULL, on output will contain the encoded length
+//		(not including terminating 0 char)
+//
+// returns the encoded buffer. Must be freed by caller. Length is given by
+//	outputLength.
+//
+char *CDVNewBase64Encode(
+    const void* buffer,
+    size_t    length,
+    bool      separateLines,
+    size_t    * outputLength)
+{
+    const unsigned char* inputBuffer = (const unsigned char*)buffer;
+
+#define MAX_NUM_PADDING_CHARS 2
+#define OUTPUT_LINE_LENGTH 64
+#define INPUT_LINE_LENGTH ((OUTPUT_LINE_LENGTH / CDV_BASE64_UNIT_SIZE) * CDV_BINARY_UNIT_SIZE)
+#define CR_LF_SIZE 0
+
+    //
+    // Byte accurate calculation of final buffer size
+    //
+    size_t outputBufferSize =
+        ((length / CDV_BINARY_UNIT_SIZE)
+        + ((length % CDV_BINARY_UNIT_SIZE) ? 1 : 0))
+        * CDV_BASE64_UNIT_SIZE;
+    if (separateLines) {
+        outputBufferSize +=
+            (outputBufferSize / OUTPUT_LINE_LENGTH) * CR_LF_SIZE;
+    }
+
+    //
+    // Include space for a terminating zero
+    //
+    outputBufferSize += 1;
+
+    //
+    // Allocate the output buffer
+    //
+    char* outputBuffer = (char*)malloc(outputBufferSize);
+    if (!outputBuffer) {
+        return NULL;
+    }
+
+    size_t i = 0;
+    size_t j = 0;
+    const size_t lineLength = separateLines ? INPUT_LINE_LENGTH : length;
+    size_t lineEnd = lineLength;
+
+    while (true) {
+        if (lineEnd > length) {
+            lineEnd = length;
+        }
+
+        for (; i + CDV_BINARY_UNIT_SIZE - 1 < lineEnd; i += CDV_BINARY_UNIT_SIZE) {
+            //
+            // Inner loop: turn 48 bytes into 64 base64 characters
+            //
+            outputBuffer[j++] = cdvbase64EncodeLookup[(inputBuffer[i] & 0xFC) >> 2];
+            outputBuffer[j++] = cdvbase64EncodeLookup[((inputBuffer[i] & 0x03) << 4)
+                | ((inputBuffer[i + 1] & 0xF0) >> 4)];
+            outputBuffer[j++] = cdvbase64EncodeLookup[((inputBuffer[i + 1] & 0x0F) << 2)
+                | ((inputBuffer[i + 2] & 0xC0) >> 6)];
+            outputBuffer[j++] = cdvbase64EncodeLookup[inputBuffer[i + 2] & 0x3F];
+        }
+
+        if (lineEnd == length) {
+            break;
+        }
+
+        //
+        // Add the newline
+        //
+        // outputBuffer[j++] = '\r';
+        // outputBuffer[j++] = '\n';
+        lineEnd += lineLength;
+    }
+
+    if (i + 1 < length) {
+        //
+        // Handle the single '=' case
+        //
+        outputBuffer[j++] = cdvbase64EncodeLookup[(inputBuffer[i] & 0xFC) >> 2];
+        outputBuffer[j++] = cdvbase64EncodeLookup[((inputBuffer[i] & 0x03) << 4)
+            | ((inputBuffer[i + 1] & 0xF0) >> 4)];
+        outputBuffer[j++] = cdvbase64EncodeLookup[(inputBuffer[i + 1] & 0x0F) << 2];
+        outputBuffer[j++] = '=';
+    } else if (i < length) {
+        //
+        // Handle the double '=' case
+        //
+        outputBuffer[j++] = cdvbase64EncodeLookup[(inputBuffer[i] & 0xFC) >> 2];
+        outputBuffer[j++] = cdvbase64EncodeLookup[(inputBuffer[i] & 0x03) << 4];
+        outputBuffer[j++] = '=';
+        outputBuffer[j++] = '=';
+    }
+    outputBuffer[j] = 0;
+
+    //
+    // Set the output length and return the buffer
+    //
+    if (outputLength) {
+        *outputLength = j;
+    }
+    return outputBuffer;
+}
+
+@implementation NSData (CDVBase64)
+
+//
+// dataFromBase64String:
+//
+// Creates an NSData object containing the base64 decoded representation of
+// the base64 string 'aString'
+//
+// Parameters:
+//    aString - the base64 string to decode
+//
+// returns the autoreleased NSData representation of the base64 string
+//
++ (NSData*)dataFromBase64String:(NSString*)aString
+{
+    NSData* data = [aString dataUsingEncoding:NSASCIIStringEncoding];
+    size_t outputLength;
+    void* outputBuffer = CDVNewBase64Decode([data bytes], [data length], &outputLength);
+    NSData* result = [NSData dataWithBytes:outputBuffer length:outputLength];
+
+    free(outputBuffer);
+    return result;
+}
+
+//
+// base64EncodedString
+//
+// Creates an NSString object that contains the base 64 encoding of the
+// receiver's data. Lines are broken at 64 characters long.
+//
+// returns an autoreleased NSString being the base 64 representation of the
+//	receiver.
+//
+- (NSString*)base64EncodedString
+{
+    size_t outputLength = 0;
+    char* outputBuffer =
+        CDVNewBase64Encode([self bytes], [self length], true, &outputLength);
+
+    NSString* result =
+        [[NSString alloc]
+        initWithBytes:outputBuffer
+               length:outputLength
+             encoding:NSASCIIStringEncoding];
+
+    free(outputBuffer);
+    return result;
+}
+
+@end

http://git-wip-us.apache.org/repos/asf/cordova-osx/blob/5bfb9c0c/CordovaMac/CordovaLib/Utils/NSMutableArray+QueueAdditions.h
----------------------------------------------------------------------
diff --git a/CordovaMac/CordovaLib/Utils/NSMutableArray+QueueAdditions.h b/CordovaMac/CordovaLib/Utils/NSMutableArray+QueueAdditions.h
new file mode 100644
index 0000000..3194094
--- /dev/null
+++ b/CordovaMac/CordovaLib/Utils/NSMutableArray+QueueAdditions.h
@@ -0,0 +1,29 @@
+/*
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements.  See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership.  The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License.  You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied.  See the License for the
+ specific language governing permissions and limitations
+ under the License.
+ */
+
+#import <Foundation/Foundation.h>
+
+@interface NSMutableArray (QueueAdditions)
+
+- (id)pop;
+- (id)queueHead;
+- (id)dequeue;
+- (void)enqueue:(id)obj;
+
+@end

http://git-wip-us.apache.org/repos/asf/cordova-osx/blob/5bfb9c0c/CordovaMac/CordovaLib/Utils/NSMutableArray+QueueAdditions.m
----------------------------------------------------------------------
diff --git a/CordovaMac/CordovaLib/Utils/NSMutableArray+QueueAdditions.m b/CordovaMac/CordovaLib/Utils/NSMutableArray+QueueAdditions.m
new file mode 100644
index 0000000..9e67ede
--- /dev/null
+++ b/CordovaMac/CordovaLib/Utils/NSMutableArray+QueueAdditions.m
@@ -0,0 +1,58 @@
+/*
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements.  See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership.  The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License.  You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied.  See the License for the
+ specific language governing permissions and limitations
+ under the License.
+ */
+
+#import "NSMutableArray+QueueAdditions.h"
+
+@implementation NSMutableArray (QueueAdditions)
+
+- (id)queueHead
+{
+    if ([self count] == 0) {
+        return nil;
+    }
+
+    return [self objectAtIndex:0];
+}
+
+- (__autoreleasing id)dequeue
+{
+    if ([self count] == 0) {
+        return nil;
+    }
+
+    id head = [self objectAtIndex:0];
+    if (head != nil) {
+        // [[head retain] autorelease]; ARC - the __autoreleasing on the return value should so the same thing
+        [self removeObjectAtIndex:0];
+    }
+
+    return head;
+}
+
+- (id)pop
+{
+    return [self dequeue];
+}
+
+- (void)enqueue:(id)object
+{
+    [self addObject:object];
+}
+
+@end

http://git-wip-us.apache.org/repos/asf/cordova-osx/blob/5bfb9c0c/CordovaMac/CordovaMac.xcodeproj/project.pbxproj
----------------------------------------------------------------------
diff --git a/CordovaMac/CordovaMac.xcodeproj/project.pbxproj b/CordovaMac/CordovaMac.xcodeproj/project.pbxproj
index 77a119f..a5a0388 100644
--- a/CordovaMac/CordovaMac.xcodeproj/project.pbxproj
+++ b/CordovaMac/CordovaMac.xcodeproj/project.pbxproj
@@ -7,56 +7,97 @@
 	objects = {
 
 /* Begin PBXBuildFile section */
-		30513C05154B6DED002B79B6 /* CDVNotification.m in Sources */ = {isa = PBXBuildFile; fileRef = 30513C02154B6DED002B79B6 /* CDVNotification.m */; };
-		30513C06154B6DED002B79B6 /* CDVSound.m in Sources */ = {isa = PBXBuildFile; fileRef = 30513C04154B6DED002B79B6 /* CDVSound.m */; };
-		30513C09154B6F56002B79B6 /* CDVConsole.m in Sources */ = {isa = PBXBuildFile; fileRef = 30513C08154B6F56002B79B6 /* CDVConsole.m */; };
-		30FC415116E5845A004E6F35 /* CDVBridge.m in Sources */ = {isa = PBXBuildFile; fileRef = 30FC415016E5845A004E6F35 /* CDVBridge.m */; };
-		488B21E7152F6242007056D6 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 488B21E6152F6242007056D6 /* AppDelegate.m */; };
-		488B21EC152F742C007056D6 /* Cordova.icns in Resources */ = {isa = PBXBuildFile; fileRef = 488B21EB152F742C007056D6 /* Cordova.icns */; };
 		48B43519152E5E3500906A36 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 48B43518152E5E3500906A36 /* Cocoa.framework */; };
-		48B43523152E5E3500906A36 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 48B43521152E5E3500906A36 /* InfoPlist.strings */; };
 		48B43525152E5E3500906A36 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 48B43524152E5E3500906A36 /* main.m */; };
-		48B43529152E5E3500906A36 /* Credits.rtf in Resources */ = {isa = PBXBuildFile; fileRef = 48B43527152E5E3500906A36 /* Credits.rtf */; };
-		48B4352F152E5E3600906A36 /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = 48B4352D152E5E3600906A36 /* MainMenu.xib */; };
 		48B43536152E5E4100906A36 /* WebKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 48B43535152E5E4100906A36 /* WebKit.framework */; };
 		48B43538152E5E6B00906A36 /* www in Resources */ = {isa = PBXBuildFile; fileRef = 48B43537152E5E6B00906A36 /* www */; };
-		48B4353B152E5EC300906A36 /* ContentView.m in Sources */ = {isa = PBXBuildFile; fileRef = 48B4353A152E5EC300906A36 /* ContentView.m */; };
-		48B4353E152E5FE200906A36 /* WebViewDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 48B4353D152E5FE200906A36 /* WebViewDelegate.m */; };
-		48B43544152E60A300906A36 /* Utils.m in Sources */ = {isa = PBXBuildFile; fileRef = 48B43543152E60A300906A36 /* Utils.m */; };
+		7E608F2B16E7D9B00018F512 /* config.xml in Resources */ = {isa = PBXBuildFile; fileRef = 7E608F2A16E7D9B00018F512 /* config.xml */; };
+		7E608F3C16E7EE8D0018F512 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 7E608F3416E7EE8D0018F512 /* AppDelegate.m */; };
+		7E608F4816E7EE970018F512 /* Cordova.icns in Resources */ = {isa = PBXBuildFile; fileRef = 7E608F4116E7EE970018F512 /* Cordova.icns */; };
+		7E608F4916E7EE970018F512 /* Credits.rtf in Resources */ = {isa = PBXBuildFile; fileRef = 7E608F4216E7EE970018F512 /* Credits.rtf */; };
+		7E608F4A16E7EE970018F512 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 7E608F4416E7EE970018F512 /* InfoPlist.strings */; };
+		7E608F4B16E7EE970018F512 /* MainViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 7E608F4616E7EE970018F512 /* MainViewController.xib */; };
+		7E608F6F16E7EEA60018F512 /* CDVBridge.m in Sources */ = {isa = PBXBuildFile; fileRef = 7E608F4E16E7EEA60018F512 /* CDVBridge.m */; };
+		7E608F7016E7EEA60018F512 /* CDVCommandDelegateImpl.m in Sources */ = {isa = PBXBuildFile; fileRef = 7E608F5416E7EEA60018F512 /* CDVCommandDelegateImpl.m */; };
+		7E608F7116E7EEA60018F512 /* CDVCommandQueue.m in Sources */ = {isa = PBXBuildFile; fileRef = 7E608F5616E7EEA60018F512 /* CDVCommandQueue.m */; };
+		7E608F7216E7EEA60018F512 /* CDVConfigParser.m in Sources */ = {isa = PBXBuildFile; fileRef = 7E608F5816E7EEA60018F512 /* CDVConfigParser.m */; };
+		7E608F7316E7EEA60018F512 /* CDVConnection.m in Sources */ = {isa = PBXBuildFile; fileRef = 7E608F5A16E7EEA60018F512 /* CDVConnection.m */; };
+		7E608F7416E7EEA60018F512 /* CDVConsole.m in Sources */ = {isa = PBXBuildFile; fileRef = 7E608F5C16E7EEA60018F512 /* CDVConsole.m */; };
+		7E608F7516E7EEA60018F512 /* CDVDevice.m in Sources */ = {isa = PBXBuildFile; fileRef = 7E608F5F16E7EEA60018F512 /* CDVDevice.m */; };
+		7E608F7616E7EEA60018F512 /* CDVInvokedUrlCommand.m in Sources */ = {isa = PBXBuildFile; fileRef = 7E608F6116E7EEA60018F512 /* CDVInvokedUrlCommand.m */; };
+		7E608F7716E7EEA60018F512 /* CDVJSON.m in Sources */ = {isa = PBXBuildFile; fileRef = 7E608F6316E7EEA60018F512 /* CDVJSON.m */; };
+		7E608F7816E7EEA60018F512 /* CDVPlugin.m in Sources */ = {isa = PBXBuildFile; fileRef = 7E608F6516E7EEA60018F512 /* CDVPlugin.m */; };
+		7E608F7916E7EEA60018F512 /* CDVPluginResult.m in Sources */ = {isa = PBXBuildFile; fileRef = 7E608F6716E7EEA60018F512 /* CDVPluginResult.m */; };
+		7E608F7A16E7EEA60018F512 /* CDVReachability.m in Sources */ = {isa = PBXBuildFile; fileRef = 7E608F6916E7EEA60018F512 /* CDVReachability.m */; };
+		7E608F7F16E7F0320018F512 /* CDVViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 7E608F7E16E7F0320018F512 /* CDVViewController.m */; };
+		7E608F8216E7F0880018F512 /* MainViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 7E608F8116E7F0880018F512 /* MainViewController.m */; };
+		7E608F8716E7F9D80018F512 /* CDVWebViewDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 7E608F8616E7F9D80018F512 /* CDVWebViewDelegate.m */; };
+		7E608F8F16E7FC990018F512 /* CDVUtils.m in Sources */ = {isa = PBXBuildFile; fileRef = 7E608F8A16E7FC990018F512 /* CDVUtils.m */; };
+		7E608F9016E7FC990018F512 /* NSData+Base64.m in Sources */ = {isa = PBXBuildFile; fileRef = 7E608F8C16E7FC990018F512 /* NSData+Base64.m */; };
+		7E608F9116E7FC990018F512 /* NSMutableArray+QueueAdditions.m in Sources */ = {isa = PBXBuildFile; fileRef = 7E608F8E16E7FC990018F512 /* NSMutableArray+QueueAdditions.m */; };
+		7E79276A16E7C900002E20B9 /* SystemConfiguration.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 7E79276916E7C8FF002E20B9 /* SystemConfiguration.framework */; };
 /* End PBXBuildFile section */
 
 /* Begin PBXFileReference section */
-		30513C01154B6DED002B79B6 /* CDVNotification.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CDVNotification.h; sourceTree = "<group>"; };
-		30513C02154B6DED002B79B6 /* CDVNotification.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CDVNotification.m; sourceTree = "<group>"; };
-		30513C03154B6DED002B79B6 /* CDVSound.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CDVSound.h; sourceTree = "<group>"; };
-		30513C04154B6DED002B79B6 /* CDVSound.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CDVSound.m; sourceTree = "<group>"; };
-		30513C07154B6F56002B79B6 /* CDVConsole.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CDVConsole.h; sourceTree = "<group>"; };
-		30513C08154B6F56002B79B6 /* CDVConsole.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CDVConsole.m; sourceTree = "<group>"; };
-		30FC414F16E5845A004E6F35 /* CDVBridge.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CDVBridge.h; sourceTree = "<group>"; };
-		30FC415016E5845A004E6F35 /* CDVBridge.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CDVBridge.m; sourceTree = "<group>"; };
-		488B21E5152F6242007056D6 /* AppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = "<group>"; };
-		488B21E6152F6242007056D6 /* AppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = "<group>"; };
-		488B21EB152F742C007056D6 /* Cordova.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; name = Cordova.icns; path = ../Cordova.icns; sourceTree = "<group>"; };
 		48B43514152E5E3500906A36 /* CordovaMac.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = CordovaMac.app; sourceTree = BUILT_PRODUCTS_DIR; };
 		48B43518152E5E3500906A36 /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = System/Library/Frameworks/Cocoa.framework; sourceTree = SDKROOT; };
 		48B4351B152E5E3500906A36 /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = System/Library/Frameworks/AppKit.framework; sourceTree = SDKROOT; };
 		48B4351C152E5E3500906A36 /* CoreData.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreData.framework; path = System/Library/Frameworks/CoreData.framework; sourceTree = SDKROOT; };
 		48B4351D152E5E3500906A36 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; };
-		48B43520152E5E3500906A36 /* CordovaMac-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "CordovaMac-Info.plist"; sourceTree = "<group>"; };
-		48B43522152E5E3500906A36 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = "<group>"; };
-		48B43524152E5E3500906A36 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; };
-		48B43526152E5E3500906A36 /* CordovaMac-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "CordovaMac-Prefix.pch"; sourceTree = "<group>"; };
-		48B43528152E5E3500906A36 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.rtf; name = en; path = en.lproj/Credits.rtf; sourceTree = "<group>"; };
-		48B4352E152E5E3600906A36 /* en */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = en; path = en.lproj/MainMenu.xib; sourceTree = "<group>"; };
+		48B43524152E5E3500906A36 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; name = main.m; path = CordovaMac/main.m; sourceTree = "<group>"; };
+		48B43526152E5E3500906A36 /* CordovaMac-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = "CordovaMac-Prefix.pch"; path = "CordovaMac/CordovaMac-Prefix.pch"; sourceTree = "<group>"; };
 		48B43535152E5E4100906A36 /* WebKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = WebKit.framework; path = System/Library/Frameworks/WebKit.framework; sourceTree = SDKROOT; };
 		48B43537152E5E6B00906A36 /* www */ = {isa = PBXFileReference; lastKnownFileType = folder; path = www; sourceTree = "<group>"; };
-		48B43539152E5EC300906A36 /* ContentView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ContentView.h; sourceTree = "<group>"; };
-		48B4353A152E5EC300906A36 /* ContentView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ContentView.m; sourceTree = "<group>"; };
-		48B4353C152E5FE200906A36 /* WebViewDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebViewDelegate.h; sourceTree = "<group>"; };
-		48B4353D152E5FE200906A36 /* WebViewDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = WebViewDelegate.m; sourceTree = "<group>"; };
-		48B43542152E60A300906A36 /* Utils.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Utils.h; sourceTree = "<group>"; };
-		48B43543152E60A300906A36 /* Utils.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Utils.m; sourceTree = "<group>"; };
-		48B43545152E60E500906A36 /* Constants.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Constants.h; sourceTree = "<group>"; };
+		7E608F2A16E7D9B00018F512 /* config.xml */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; name = config.xml; path = CordovaMac/config.xml; sourceTree = "<group>"; };
+		7E608F3316E7EE8D0018F512 /* AppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = "<group>"; };
+		7E608F3416E7EE8D0018F512 /* AppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = "<group>"; };
+		7E608F3516E7EE8D0018F512 /* Constants.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Constants.h; sourceTree = "<group>"; };
+		7E608F4116E7EE970018F512 /* Cordova.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; path = Cordova.icns; sourceTree = "<group>"; };
+		7E608F4316E7EE970018F512 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.rtf; name = en; path = en.lproj/Credits.rtf; sourceTree = "<group>"; };
+		7E608F4516E7EE970018F512 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = "<group>"; };
+		7E608F4716E7EE970018F512 /* en */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = en; path = en.lproj/MainViewController.xib; sourceTree = "<group>"; };
+		7E608F4D16E7EEA60018F512 /* CDVBridge.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CDVBridge.h; sourceTree = "<group>"; };
+		7E608F4E16E7EEA60018F512 /* CDVBridge.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CDVBridge.m; sourceTree = "<group>"; };
+		7E608F5016E7EEA60018F512 /* CDV.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CDV.h; sourceTree = "<group>"; };
+		7E608F5116E7EEA60018F512 /* CDVAvailability.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CDVAvailability.h; sourceTree = "<group>"; };
+		7E608F5216E7EEA60018F512 /* CDVCommandDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CDVCommandDelegate.h; sourceTree = "<group>"; };
+		7E608F5316E7EEA60018F512 /* CDVCommandDelegateImpl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CDVCommandDelegateImpl.h; sourceTree = "<group>"; };
+		7E608F5416E7EEA60018F512 /* CDVCommandDelegateImpl.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CDVCommandDelegateImpl.m; sourceTree = "<group>"; };
+		7E608F5516E7EEA60018F512 /* CDVCommandQueue.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CDVCommandQueue.h; sourceTree = "<group>"; };
+		7E608F5616E7EEA60018F512 /* CDVCommandQueue.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CDVCommandQueue.m; sourceTree = "<group>"; };
+		7E608F5716E7EEA60018F512 /* CDVConfigParser.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CDVConfigParser.h; sourceTree = "<group>"; };
+		7E608F5816E7EEA60018F512 /* CDVConfigParser.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CDVConfigParser.m; sourceTree = "<group>"; };
+		7E608F5916E7EEA60018F512 /* CDVConnection.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CDVConnection.h; sourceTree = "<group>"; };
+		7E608F5A16E7EEA60018F512 /* CDVConnection.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CDVConnection.m; sourceTree = "<group>"; };
+		7E608F5B16E7EEA60018F512 /* CDVConsole.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CDVConsole.h; sourceTree = "<group>"; };
+		7E608F5C16E7EEA60018F512 /* CDVConsole.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CDVConsole.m; sourceTree = "<group>"; };
+		7E608F5D16E7EEA60018F512 /* CDVDebug.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CDVDebug.h; sourceTree = "<group>"; };
+		7E608F5E16E7EEA60018F512 /* CDVDevice.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CDVDevice.h; sourceTree = "<group>"; };
+		7E608F5F16E7EEA60018F512 /* CDVDevice.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CDVDevice.m; sourceTree = "<group>"; };
+		7E608F6016E7EEA60018F512 /* CDVInvokedUrlCommand.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CDVInvokedUrlCommand.h; sourceTree = "<group>"; };
+		7E608F6116E7EEA60018F512 /* CDVInvokedUrlCommand.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CDVInvokedUrlCommand.m; sourceTree = "<group>"; };
+		7E608F6216E7EEA60018F512 /* CDVJSON.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CDVJSON.h; sourceTree = "<group>"; };
+		7E608F6316E7EEA60018F512 /* CDVJSON.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CDVJSON.m; sourceTree = "<group>"; };
+		7E608F6416E7EEA60018F512 /* CDVPlugin.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CDVPlugin.h; sourceTree = "<group>"; };
+		7E608F6516E7EEA60018F512 /* CDVPlugin.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CDVPlugin.m; sourceTree = "<group>"; };
+		7E608F6616E7EEA60018F512 /* CDVPluginResult.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CDVPluginResult.h; sourceTree = "<group>"; };
+		7E608F6716E7EEA60018F512 /* CDVPluginResult.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CDVPluginResult.m; sourceTree = "<group>"; };
+		7E608F6816E7EEA60018F512 /* CDVReachability.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CDVReachability.h; sourceTree = "<group>"; };
+		7E608F6916E7EEA60018F512 /* CDVReachability.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CDVReachability.m; sourceTree = "<group>"; };
+		7E608F7D16E7F0320018F512 /* CDVViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CDVViewController.h; sourceTree = "<group>"; };
+		7E608F7E16E7F0320018F512 /* CDVViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CDVViewController.m; sourceTree = "<group>"; };
+		7E608F8016E7F0880018F512 /* MainViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MainViewController.h; sourceTree = "<group>"; };
+		7E608F8116E7F0880018F512 /* MainViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MainViewController.m; sourceTree = "<group>"; };
+		7E608F8316E7F6940018F512 /* CordovaMac-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = "CordovaMac-Info.plist"; path = "CordovaMac/CordovaMac-Info.plist"; sourceTree = SOURCE_ROOT; };
+		7E608F8516E7F9D80018F512 /* CDVWebViewDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CDVWebViewDelegate.h; sourceTree = "<group>"; };
+		7E608F8616E7F9D80018F512 /* CDVWebViewDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CDVWebViewDelegate.m; sourceTree = "<group>"; };
+		7E608F8916E7FC990018F512 /* CDVUtils.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CDVUtils.h; sourceTree = "<group>"; };
+		7E608F8A16E7FC990018F512 /* CDVUtils.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CDVUtils.m; sourceTree = "<group>"; };
+		7E608F8B16E7FC990018F512 /* NSData+Base64.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSData+Base64.h"; sourceTree = "<group>"; };
+		7E608F8C16E7FC990018F512 /* NSData+Base64.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSData+Base64.m"; sourceTree = "<group>"; };
+		7E608F8D16E7FC990018F512 /* NSMutableArray+QueueAdditions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSMutableArray+QueueAdditions.h"; sourceTree = "<group>"; };
+		7E608F8E16E7FC990018F512 /* NSMutableArray+QueueAdditions.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSMutableArray+QueueAdditions.m"; sourceTree = "<group>"; };
+		7E79276916E7C8FF002E20B9 /* SystemConfiguration.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SystemConfiguration.framework; path = System/Library/Frameworks/SystemConfiguration.framework; sourceTree = SDKROOT; };
 /* End PBXFileReference section */
 
 /* Begin PBXFrameworksBuildPhase section */
@@ -64,6 +105,7 @@
 			isa = PBXFrameworksBuildPhase;
 			buildActionMask = 2147483647;
 			files = (
+				7E79276A16E7C900002E20B9 /* SystemConfiguration.framework in Frameworks */,
 				48B43536152E5E4100906A36 /* WebKit.framework in Frameworks */,
 				48B43519152E5E3500906A36 /* Cocoa.framework in Frameworks */,
 			);
@@ -72,24 +114,15 @@
 /* End PBXFrameworksBuildPhase section */
 
 /* Begin PBXGroup section */
-		30513C00154B6DED002B79B6 /* Commands */ = {
-			isa = PBXGroup;
-			children = (
-				30513C07154B6F56002B79B6 /* CDVConsole.h */,
-				30513C08154B6F56002B79B6 /* CDVConsole.m */,
-				30513C01154B6DED002B79B6 /* CDVNotification.h */,
-				30513C02154B6DED002B79B6 /* CDVNotification.m */,
-				30513C03154B6DED002B79B6 /* CDVSound.h */,
-				30513C04154B6DED002B79B6 /* CDVSound.m */,
-			);
-			path = Commands;
-			sourceTree = "<group>";
-		};
 		48B43509152E5E3500906A36 = {
 			isa = PBXGroup;
 			children = (
+				7E608F2A16E7D9B00018F512 /* config.xml */,
 				48B43537152E5E6B00906A36 /* www */,
-				48B4351E152E5E3500906A36 /* CordovaMac */,
+				7E608F4C16E7EEA60018F512 /* CordovaLib */,
+				7E608F4016E7EE970018F512 /* Resources */,
+				7E608F3216E7EE8D0018F512 /* Classes */,
+				7E608F2E16E7EC900018F512 /* Other Sources */,
 				48B43517152E5E3500906A36 /* Frameworks */,
 				48B43515152E5E3500906A36 /* Products */,
 			);
@@ -106,6 +139,7 @@
 		48B43517152E5E3500906A36 /* Frameworks */ = {
 			isa = PBXGroup;
 			children = (
+				7E79276916E7C8FF002E20B9 /* SystemConfiguration.framework */,
 				48B43535152E5E4100906A36 /* WebKit.framework */,
 				48B43518152E5E3500906A36 /* Cocoa.framework */,
 				48B4351A152E5E3500906A36 /* Other Frameworks */,
@@ -123,38 +157,100 @@
 			name = "Other Frameworks";
 			sourceTree = "<group>";
 		};
-		48B4351E152E5E3500906A36 /* CordovaMac */ = {
+		7E608F2E16E7EC900018F512 /* Other Sources */ = {
 			isa = PBXGroup;
 			children = (
-				30513C00154B6DED002B79B6 /* Commands */,
-				30FC414F16E5845A004E6F35 /* CDVBridge.h */,
-				30FC415016E5845A004E6F35 /* CDVBridge.m */,
-				48B43542152E60A300906A36 /* Utils.h */,
-				48B43543152E60A300906A36 /* Utils.m */,
-				488B21E5152F6242007056D6 /* AppDelegate.h */,
-				488B21E6152F6242007056D6 /* AppDelegate.m */,
-				48B43545152E60E500906A36 /* Constants.h */,
-				48B43539152E5EC300906A36 /* ContentView.h */,
-				48B4353A152E5EC300906A36 /* ContentView.m */,
-				48B4353C152E5FE200906A36 /* WebViewDelegate.h */,
-				48B4353D152E5FE200906A36 /* WebViewDelegate.m */,
-				48B4351F152E5E3500906A36 /* Supporting Files */,
+				48B43524152E5E3500906A36 /* main.m */,
+				48B43526152E5E3500906A36 /* CordovaMac-Prefix.pch */,
 			);
-			path = CordovaMac;
+			name = "Other Sources";
 			sourceTree = "<group>";
 		};
-		48B4351F152E5E3500906A36 /* Supporting Files */ = {
+		7E608F3216E7EE8D0018F512 /* Classes */ = {
 			isa = PBXGroup;
 			children = (
-				488B21EB152F742C007056D6 /* Cordova.icns */,
-				48B4352D152E5E3600906A36 /* MainMenu.xib */,
-				48B43520152E5E3500906A36 /* CordovaMac-Info.plist */,
-				48B43521152E5E3500906A36 /* InfoPlist.strings */,
-				48B43524152E5E3500906A36 /* main.m */,
-				48B43526152E5E3500906A36 /* CordovaMac-Prefix.pch */,
-				48B43527152E5E3500906A36 /* Credits.rtf */,
+				7E608F4616E7EE970018F512 /* MainViewController.xib */,
+				7E608F3316E7EE8D0018F512 /* AppDelegate.h */,
+				7E608F3416E7EE8D0018F512 /* AppDelegate.m */,
+				7E608F3516E7EE8D0018F512 /* Constants.h */,
+				7E608F8016E7F0880018F512 /* MainViewController.h */,
+				7E608F8116E7F0880018F512 /* MainViewController.m */,
 			);
-			name = "Supporting Files";
+			name = Classes;
+			path = CordovaMac/Classes;
+			sourceTree = "<group>";
+		};
+		7E608F4016E7EE970018F512 /* Resources */ = {
+			isa = PBXGroup;
+			children = (
+				7E608F8316E7F6940018F512 /* CordovaMac-Info.plist */,
+				7E608F4116E7EE970018F512 /* Cordova.icns */,
+				7E608F4216E7EE970018F512 /* Credits.rtf */,
+				7E608F4416E7EE970018F512 /* InfoPlist.strings */,
+			);
+			name = Resources;
+			path = CordovaMac/Resources;
+			sourceTree = "<group>";
+		};
+		7E608F4C16E7EEA60018F512 /* CordovaLib */ = {
+			isa = PBXGroup;
+			children = (
+				7E608F8816E7FC990018F512 /* Utils */,
+				7E608F4F16E7EEA60018F512 /* Commands */,
+				7E608F8516E7F9D80018F512 /* CDVWebViewDelegate.h */,
+				7E608F8616E7F9D80018F512 /* CDVWebViewDelegate.m */,
+				7E608F4D16E7EEA60018F512 /* CDVBridge.h */,
+				7E608F4E16E7EEA60018F512 /* CDVBridge.m */,
+				7E608F7D16E7F0320018F512 /* CDVViewController.h */,
+				7E608F7E16E7F0320018F512 /* CDVViewController.m */,
+			);
+			path = CordovaLib;
+			sourceTree = "<group>";
+		};
+		7E608F4F16E7EEA60018F512 /* Commands */ = {
+			isa = PBXGroup;
+			children = (
+				7E608F5016E7EEA60018F512 /* CDV.h */,
+				7E608F5116E7EEA60018F512 /* CDVAvailability.h */,
+				7E608F5216E7EEA60018F512 /* CDVCommandDelegate.h */,
+				7E608F5316E7EEA60018F512 /* CDVCommandDelegateImpl.h */,
+				7E608F5416E7EEA60018F512 /* CDVCommandDelegateImpl.m */,
+				7E608F5516E7EEA60018F512 /* CDVCommandQueue.h */,
+				7E608F5616E7EEA60018F512 /* CDVCommandQueue.m */,
+				7E608F5716E7EEA60018F512 /* CDVConfigParser.h */,
+				7E608F5816E7EEA60018F512 /* CDVConfigParser.m */,
+				7E608F5916E7EEA60018F512 /* CDVConnection.h */,
+				7E608F5A16E7EEA60018F512 /* CDVConnection.m */,
+				7E608F5B16E7EEA60018F512 /* CDVConsole.h */,
+				7E608F5C16E7EEA60018F512 /* CDVConsole.m */,
+				7E608F5D16E7EEA60018F512 /* CDVDebug.h */,
+				7E608F5E16E7EEA60018F512 /* CDVDevice.h */,
+				7E608F5F16E7EEA60018F512 /* CDVDevice.m */,
+				7E608F6016E7EEA60018F512 /* CDVInvokedUrlCommand.h */,
+				7E608F6116E7EEA60018F512 /* CDVInvokedUrlCommand.m */,
+				7E608F6216E7EEA60018F512 /* CDVJSON.h */,
+				7E608F6316E7EEA60018F512 /* CDVJSON.m */,
+				7E608F6416E7EEA60018F512 /* CDVPlugin.h */,
+				7E608F6516E7EEA60018F512 /* CDVPlugin.m */,
+				7E608F6616E7EEA60018F512 /* CDVPluginResult.h */,
+				7E608F6716E7EEA60018F512 /* CDVPluginResult.m */,
+				7E608F6816E7EEA60018F512 /* CDVReachability.h */,
+				7E608F6916E7EEA60018F512 /* CDVReachability.m */,
+			);
+			path = Commands;
+			sourceTree = "<group>";
+		};
+		7E608F8816E7FC990018F512 /* Utils */ = {
+			isa = PBXGroup;
+			children = (
+				7E608F8916E7FC990018F512 /* CDVUtils.h */,
+				7E608F8A16E7FC990018F512 /* CDVUtils.m */,
+				7E608F8B16E7FC990018F512 /* NSData+Base64.h */,
+				7E608F8C16E7FC990018F512 /* NSData+Base64.m */,
+				7E608F8D16E7FC990018F512 /* NSMutableArray+QueueAdditions.h */,
+				7E608F8E16E7FC990018F512 /* NSMutableArray+QueueAdditions.m */,
+			);
+			path = Utils;
 			sourceTree = "<group>";
 		};
 /* End PBXGroup section */
@@ -209,11 +305,12 @@
 			isa = PBXResourcesBuildPhase;
 			buildActionMask = 2147483647;
 			files = (
-				48B43523152E5E3500906A36 /* InfoPlist.strings in Resources */,
-				48B43529152E5E3500906A36 /* Credits.rtf in Resources */,
-				48B4352F152E5E3600906A36 /* MainMenu.xib in Resources */,
 				48B43538152E5E6B00906A36 /* www in Resources */,
-				488B21EC152F742C007056D6 /* Cordova.icns in Resources */,
+				7E608F2B16E7D9B00018F512 /* config.xml in Resources */,
+				7E608F4816E7EE970018F512 /* Cordova.icns in Resources */,
+				7E608F4916E7EE970018F512 /* Credits.rtf in Resources */,
+				7E608F4A16E7EE970018F512 /* InfoPlist.strings in Resources */,
+				7E608F4B16E7EE970018F512 /* MainViewController.xib in Resources */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};
@@ -225,42 +322,54 @@
 			buildActionMask = 2147483647;
 			files = (
 				48B43525152E5E3500906A36 /* main.m in Sources */,
-				48B4353B152E5EC300906A36 /* ContentView.m in Sources */,
-				48B4353E152E5FE200906A36 /* WebViewDelegate.m in Sources */,
-				48B43544152E60A300906A36 /* Utils.m in Sources */,
-				488B21E7152F6242007056D6 /* AppDelegate.m in Sources */,
-				30513C05154B6DED002B79B6 /* CDVNotification.m in Sources */,
-				30513C06154B6DED002B79B6 /* CDVSound.m in Sources */,
-				30513C09154B6F56002B79B6 /* CDVConsole.m in Sources */,
-				30FC415116E5845A004E6F35 /* CDVBridge.m in Sources */,
+				7E608F3C16E7EE8D0018F512 /* AppDelegate.m in Sources */,
+				7E608F6F16E7EEA60018F512 /* CDVBridge.m in Sources */,
+				7E608F7016E7EEA60018F512 /* CDVCommandDelegateImpl.m in Sources */,
+				7E608F7116E7EEA60018F512 /* CDVCommandQueue.m in Sources */,
+				7E608F7216E7EEA60018F512 /* CDVConfigParser.m in Sources */,
+				7E608F7316E7EEA60018F512 /* CDVConnection.m in Sources */,
+				7E608F7416E7EEA60018F512 /* CDVConsole.m in Sources */,
+				7E608F7516E7EEA60018F512 /* CDVDevice.m in Sources */,
+				7E608F7616E7EEA60018F512 /* CDVInvokedUrlCommand.m in Sources */,
+				7E608F7716E7EEA60018F512 /* CDVJSON.m in Sources */,
+				7E608F7816E7EEA60018F512 /* CDVPlugin.m in Sources */,
+				7E608F7916E7EEA60018F512 /* CDVPluginResult.m in Sources */,
+				7E608F7A16E7EEA60018F512 /* CDVReachability.m in Sources */,
+				7E608F7F16E7F0320018F512 /* CDVViewController.m in Sources */,
+				7E608F8216E7F0880018F512 /* MainViewController.m in Sources */,
+				7E608F8716E7F9D80018F512 /* CDVWebViewDelegate.m in Sources */,
+				7E608F8F16E7FC990018F512 /* CDVUtils.m in Sources */,
+				7E608F9016E7FC990018F512 /* NSData+Base64.m in Sources */,
+				7E608F9116E7FC990018F512 /* NSMutableArray+QueueAdditions.m in Sources */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};
 /* End PBXSourcesBuildPhase section */
 
 /* Begin PBXVariantGroup section */
-		48B43521152E5E3500906A36 /* InfoPlist.strings */ = {
+		7E608F4216E7EE970018F512 /* Credits.rtf */ = {
 			isa = PBXVariantGroup;
 			children = (
-				48B43522152E5E3500906A36 /* en */,
+				7E608F4316E7EE970018F512 /* en */,
 			);
-			name = InfoPlist.strings;
+			name = Credits.rtf;
 			sourceTree = "<group>";
 		};
-		48B43527152E5E3500906A36 /* Credits.rtf */ = {
+		7E608F4416E7EE970018F512 /* InfoPlist.strings */ = {
 			isa = PBXVariantGroup;
 			children = (
-				48B43528152E5E3500906A36 /* en */,
+				7E608F4516E7EE970018F512 /* en */,
 			);
-			name = Credits.rtf;
+			name = InfoPlist.strings;
 			sourceTree = "<group>";
 		};
-		48B4352D152E5E3600906A36 /* MainMenu.xib */ = {
+		7E608F4616E7EE970018F512 /* MainViewController.xib */ = {
 			isa = PBXVariantGroup;
 			children = (
-				48B4352E152E5E3600906A36 /* en */,
+				7E608F4716E7EE970018F512 /* en */,
 			);
-			name = MainMenu.xib;
+			name = MainViewController.xib;
+			path = ../Resources;
 			sourceTree = "<group>";
 		};
 /* End PBXVariantGroup section */
@@ -322,6 +431,7 @@
 		48B43533152E5E3600906A36 /* Debug */ = {
 			isa = XCBuildConfiguration;
 			buildSettings = {
+				CLANG_ENABLE_OBJC_ARC = YES;
 				COMBINE_HIDPI_IMAGES = YES;
 				GCC_PRECOMPILE_PREFIX_HEADER = YES;
 				GCC_PREFIX_HEADER = "CordovaMac/CordovaMac-Prefix.pch";
@@ -334,6 +444,7 @@
 		48B43534152E5E3600906A36 /* Release */ = {
 			isa = XCBuildConfiguration;
 			buildSettings = {
+				CLANG_ENABLE_OBJC_ARC = YES;
 				COMBINE_HIDPI_IMAGES = YES;
 				GCC_PRECOMPILE_PREFIX_HEADER = YES;
 				GCC_PREFIX_HEADER = "CordovaMac/CordovaMac-Prefix.pch";

http://git-wip-us.apache.org/repos/asf/cordova-osx/blob/5bfb9c0c/CordovaMac/CordovaMac/AppDelegate.h
----------------------------------------------------------------------
diff --git a/CordovaMac/CordovaMac/AppDelegate.h b/CordovaMac/CordovaMac/AppDelegate.h
deleted file mode 100644
index ec38a73..0000000
--- a/CordovaMac/CordovaMac/AppDelegate.h
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements.  See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership.  The ASF licenses this file
- to you under the Apache License, Version 2.0 (the
- "License"); you may not use this file except in compliance
- with the License.  You may obtain a copy of the License at
- 
- http://www.apache.org/licenses/LICENSE-2.0
- 
- Unless required by applicable law or agreed to in writing,
- software distributed under the License is distributed on an
- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- KIND, either express or implied.  See the License for the
- specific language governing permissions and limitations
- under the License.
- */
-
-#import <Cocoa/Cocoa.h>
-#import "ContentView.h"
-
-@interface AppDelegate : NSObject <NSApplicationDelegate> {
-
-	IBOutlet NSWindow* window;
-	IBOutlet ContentView* contentView;
-}
-
-@property (nonatomic, retain) NSWindow* window;
-@property (nonatomic, retain) ContentView* contentView;
-
-@end

http://git-wip-us.apache.org/repos/asf/cordova-osx/blob/5bfb9c0c/CordovaMac/CordovaMac/AppDelegate.m
----------------------------------------------------------------------
diff --git a/CordovaMac/CordovaMac/AppDelegate.m b/CordovaMac/CordovaMac/AppDelegate.m
deleted file mode 100644
index 3ce0fc2..0000000
--- a/CordovaMac/CordovaMac/AppDelegate.m
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements.  See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership.  The ASF licenses this file
- to you under the Apache License, Version 2.0 (the
- "License"); you may not use this file except in compliance
- with the License.  You may obtain a copy of the License at
- 
- http://www.apache.org/licenses/LICENSE-2.0
- 
- Unless required by applicable law or agreed to in writing,
- software distributed under the License is distributed on an
- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- KIND, either express or implied.  See the License for the
- specific language governing permissions and limitations
- under the License.
- */
-
-#import "AppDelegate.h"
-
-@implementation AppDelegate
-
-
-@synthesize window, contentView;
-
-- (void) applicationDidStartLaunching:(NSNotification*) aNotification 
-{
-}
-
-- (void) applicationWillFinishLaunching:(NSNotification*)aNotification
-{
-    [[NSNotificationCenter defaultCenter] addObserver:self.contentView 
-                                             selector:@selector(windowResized:) 
-                                                 name:NSWindowDidResizeNotification 
-                                               object:[self window]];
-
-    NSURL* fileUrl = [NSURL fileURLWithPath:[[Utils sharedInstance] pathForResource:kStartPage]];
-        
-    [self.contentView.webView setMainFrameURL:[fileUrl description]];
-}
-
-- (void) applicationDidFinishLaunching:(NSNotification*)aNotification 
-{
-    self.contentView.webView.alphaValue = 1.0;
-    self.contentView.alphaValue = 1.0;
-}
-
-@end

http://git-wip-us.apache.org/repos/asf/cordova-osx/blob/5bfb9c0c/CordovaMac/CordovaMac/CDVBridge.h
----------------------------------------------------------------------
diff --git a/CordovaMac/CordovaMac/CDVBridge.h b/CordovaMac/CordovaMac/CDVBridge.h
deleted file mode 100644
index cdca928..0000000
--- a/CordovaMac/CordovaMac/CDVBridge.h
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements.  See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership.  The ASF licenses this file
- to you under the Apache License, Version 2.0 (the
- "License"); you may not use this file except in compliance
- with the License.  You may obtain a copy of the License at
- 
- http://www.apache.org/licenses/LICENSE-2.0
- 
- Unless required by applicable law or agreed to in writing,
- software distributed under the License is distributed on an
- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- KIND, either express or implied.  See the License for the
- specific language governing permissions and limitations
- under the License.
- */
-
-#import <Cocoa/Cocoa.h>
-@class WebView;
-
-@interface CDVBridge : NSObject {
-	
-}
-
-@property (nonatomic, retain) WebView* webView;
-
-- (id) initWithWebView:(WebView*)webView;
-- (void) exec:(NSString*)callbackId withService:(NSString*)service andAction:(NSString*)action andArguments:(NSArray*)arguments;
-
-
-@end