cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From shaz...@apache.org
Subject [4/7] Re-arranged group and folder structure to make it easy for plugman support.
Date Wed, 06 Mar 2013 21:39:15 GMT
http://git-wip-us.apache.org/repos/asf/cordova-osx/blob/e1c85923/CordovaMac/CordovaMac/Commands/CDVReachability.m
----------------------------------------------------------------------
diff --git a/CordovaMac/CordovaMac/Commands/CDVReachability.m b/CordovaMac/CordovaMac/Commands/CDVReachability.m
deleted file mode 100644
index ed1afe7..0000000
--- a/CordovaMac/CordovaMac/Commands/CDVReachability.m
+++ /dev/null
@@ -1,261 +0,0 @@
-/*
-
- 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/e1c85923/CordovaMac/CordovaMac/Commands/Utils/NSData+Base64.h
----------------------------------------------------------------------
diff --git a/CordovaMac/CordovaMac/Commands/Utils/NSData+Base64.h b/CordovaMac/CordovaMac/Commands/Utils/NSData+Base64.h
deleted file mode 100644
index ffe9c83..0000000
--- a/CordovaMac/CordovaMac/Commands/Utils/NSData+Base64.h
+++ /dev/null
@@ -1,33 +0,0 @@
-//
-//  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/e1c85923/CordovaMac/CordovaMac/Commands/Utils/NSData+Base64.m
----------------------------------------------------------------------
diff --git a/CordovaMac/CordovaMac/Commands/Utils/NSData+Base64.m b/CordovaMac/CordovaMac/Commands/Utils/NSData+Base64.m
deleted file mode 100644
index 08c801b..0000000
--- a/CordovaMac/CordovaMac/Commands/Utils/NSData+Base64.m
+++ /dev/null
@@ -1,286 +0,0 @@
-//
-//  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/e1c85923/CordovaMac/CordovaMac/Commands/Utils/NSMutableArray+QueueAdditions.h
----------------------------------------------------------------------
diff --git a/CordovaMac/CordovaMac/Commands/Utils/NSMutableArray+QueueAdditions.h b/CordovaMac/CordovaMac/Commands/Utils/NSMutableArray+QueueAdditions.h
deleted file mode 100644
index 3194094..0000000
--- a/CordovaMac/CordovaMac/Commands/Utils/NSMutableArray+QueueAdditions.h
+++ /dev/null
@@ -1,29 +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 <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/e1c85923/CordovaMac/CordovaMac/Commands/Utils/NSMutableArray+QueueAdditions.m
----------------------------------------------------------------------
diff --git a/CordovaMac/CordovaMac/Commands/Utils/NSMutableArray+QueueAdditions.m b/CordovaMac/CordovaMac/Commands/Utils/NSMutableArray+QueueAdditions.m
deleted file mode 100644
index 9e67ede..0000000
--- a/CordovaMac/CordovaMac/Commands/Utils/NSMutableArray+QueueAdditions.m
+++ /dev/null
@@ -1,58 +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 "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/e1c85923/CordovaMac/CordovaMac/Constants.h
----------------------------------------------------------------------
diff --git a/CordovaMac/CordovaMac/Constants.h b/CordovaMac/CordovaMac/Constants.h
deleted file mode 100644
index 5b7fc2b..0000000
--- a/CordovaMac/CordovaMac/Constants.h
+++ /dev/null
@@ -1,22 +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.
- */
-
-#define kCDVStartPage      @"index.html"
-#define kCDVStartFolder    @"www"
-

http://git-wip-us.apache.org/repos/asf/cordova-osx/blob/e1c85923/CordovaMac/CordovaMac/ContentView.h
----------------------------------------------------------------------
diff --git a/CordovaMac/CordovaMac/ContentView.h b/CordovaMac/CordovaMac/ContentView.h
deleted file mode 100644
index d4e30b3..0000000
--- a/CordovaMac/CordovaMac/ContentView.h
+++ /dev/null
@@ -1,35 +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 <WebKit/WebKit.h>
-
-@class WebViewDelegate;
-
-@interface ContentView : NSView {
-	
-	IBOutlet WebView* webView;
-	WebViewDelegate* delegate;
-	
-}
-
-@property (strong) WebView* webView;
-@property (strong) WebViewDelegate* delegate;
-
-@end

http://git-wip-us.apache.org/repos/asf/cordova-osx/blob/e1c85923/CordovaMac/CordovaMac/ContentView.m
----------------------------------------------------------------------
diff --git a/CordovaMac/CordovaMac/ContentView.m b/CordovaMac/CordovaMac/ContentView.m
deleted file mode 100644
index 0ec6ce9..0000000
--- a/CordovaMac/CordovaMac/ContentView.m
+++ /dev/null
@@ -1,64 +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 "ContentView.h"
-#import "WebViewDelegate.h"
-#import "AppDelegate.h"
-
-@implementation ContentView
-
-@synthesize webView, delegate;
-
-- (void) awakeFromNib
-{
-    self.delegate = [[WebViewDelegate alloc] init];
-    [self.webView setFrameLoadDelegate:self.delegate];
-    [self.webView setUIDelegate:self.delegate];
-    [self.webView setResourceLoadDelegate:self.delegate];
-    [self.webView setDownloadDelegate:self.delegate];
-    [self.webView setPolicyDelegate:self.delegate];	
-    //self.window.backgroundColor = [NSColor colorWithCalibratedRed:0.933 green:0.933 blue:0.933
alpha:1.000];
-}
-
-- (id)initWithFrame:(NSRect)frame 
-{
-    self = [super initWithFrame:frame];
-    if (self) {
-        // init here
-    }
-    return self;
-}
-
-- (void) drawRect:(NSRect)dirtyRect 
-{
-    // Drawing code here.
-}
-
-- (void) windowResized:(NSNotification*)notification;
-{
-	NSWindow* window = (NSWindow*)notification.object;
-	NSSize size = [window frame].size;
-	
-	//DebugNSLog(@"window width = %f, window height = %f", size.width, size.height);
-	[self.webView setFrame:NSMakeRect(0, 0, size.width, size.height - [[Utils sharedInstance]
titleBarHeight:window])];
-    [self.webView stringByEvaluatingJavaScriptFromString:@"var e = document.createEvent('Events');
e.initEvent('orientationchange', true, false); document.dispatchEvent(e); "];
-}
-
-
-@end

http://git-wip-us.apache.org/repos/asf/cordova-osx/blob/e1c85923/CordovaMac/CordovaMac/CordovaMac-Prefix.pch
----------------------------------------------------------------------
diff --git a/CordovaMac/CordovaMac/CordovaMac-Prefix.pch b/CordovaMac/CordovaMac/CordovaMac-Prefix.pch
index eac26de..94d708c 100644
--- a/CordovaMac/CordovaMac/CordovaMac-Prefix.pch
+++ b/CordovaMac/CordovaMac/CordovaMac-Prefix.pch
@@ -19,14 +19,9 @@
 
 #ifdef __OBJC__
 
-#ifdef _DEBUG
-#define DebugNSLog(format, ...) NSLog(format, ## __VA_ARGS__)
-#else
-#define DebugNSLog(format, ...)
-#endif
-
 #import <Cocoa/Cocoa.h>
 
 #import "Constants.h"
 #import "Utils.h"
+
 #endif

http://git-wip-us.apache.org/repos/asf/cordova-osx/blob/e1c85923/CordovaMac/CordovaMac/Plugins/README
----------------------------------------------------------------------
diff --git a/CordovaMac/CordovaMac/Plugins/README b/CordovaMac/CordovaMac/Plugins/README
new file mode 100644
index 0000000..f6e19d7
--- /dev/null
+++ b/CordovaMac/CordovaMac/Plugins/README
@@ -0,0 +1,20 @@
+#
+# 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.
+#
+
+Put the .h and .m files of your plugin here. The .js files of your plugin belong in the www
folder.
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cordova-osx/blob/e1c85923/CordovaMac/CordovaMac/Resources/Cordova.icns
----------------------------------------------------------------------
diff --git a/CordovaMac/CordovaMac/Resources/Cordova.icns b/CordovaMac/CordovaMac/Resources/Cordova.icns
new file mode 100644
index 0000000..20fc3d3
Binary files /dev/null and b/CordovaMac/CordovaMac/Resources/Cordova.icns differ

http://git-wip-us.apache.org/repos/asf/cordova-osx/blob/e1c85923/CordovaMac/CordovaMac/Resources/en.lproj/Credits.rtf
----------------------------------------------------------------------
diff --git a/CordovaMac/CordovaMac/Resources/en.lproj/Credits.rtf b/CordovaMac/CordovaMac/Resources/en.lproj/Credits.rtf
new file mode 100644
index 0000000..816c9db
--- /dev/null
+++ b/CordovaMac/CordovaMac/Resources/en.lproj/Credits.rtf
@@ -0,0 +1,18 @@
+{\rtf1\ansi\ansicpg1252\cocoartf1138\cocoasubrtf320
+{\fonttbl\f0\fnil\fcharset0 HelveticaNeue;\f1\fnil\fcharset0 HelveticaNeue-Light;}
+{\colortbl;\red255\green255\blue255;}
+\vieww9600\viewh8400\viewkind0
+\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardirnatural
+{\field{\*\fldinst{HYPERLINK "http://www.apache.org/"}}{\fldrslt 
+\f0\fs36 \cf0 Apache Software Foundation\
+}}\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardirnatural
+
+\f1\fs36 \cf0 \
+
+\fs28 The {\field{\*\fldinst{HYPERLINK "http://phonegap.com/about"}}{\fldrslt PhoneGap}}
code was contributed to the Apache Software Foundation (ASF) under the name Apache Callback
in October 2011. It is currently under incubation until it can become a full Apache project.
Through the ASF, future {\field{\*\fldinst{HYPERLINK "http://phonegap.com/about"}}{\fldrslt
PhoneGap}} development will ensure open stewardship of the project. It will always remain
free and open source under the Apache License, Version 2.0.
+\fs32 \
+\
+\pard\tx560\pardeftab560\pardirnatural
+
+\fs28 \cf0 \CocoaLigature0 Licensed to the {\field{\*\fldinst{HYPERLINK "http://www.apache.org/"}}{\fldrslt
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 {\field{\*\fldinst{HYPERLINK "http://www.apache.org/licenses/LICENSE-2.0"}}{\fldrslt
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.\
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cordova-osx/blob/e1c85923/CordovaMac/CordovaMac/Resources/en.lproj/InfoPlist.strings
----------------------------------------------------------------------
diff --git a/CordovaMac/CordovaMac/Resources/en.lproj/InfoPlist.strings b/CordovaMac/CordovaMac/Resources/en.lproj/InfoPlist.strings
new file mode 100644
index 0000000..d277f9d
--- /dev/null
+++ b/CordovaMac/CordovaMac/Resources/en.lproj/InfoPlist.strings
@@ -0,0 +1,23 @@
+/*
+ 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.
+ */
+
+
+
+/* Localized versions of Info.plist keys */
+


Mime
View raw message