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:29 UTC

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

http://git-wip-us.apache.org/repos/asf/cordova-osx/blob/5bfb9c0c/CordovaMac/CordovaMac/CDVBridge.m
----------------------------------------------------------------------
diff --git a/CordovaMac/CordovaMac/CDVBridge.m b/CordovaMac/CordovaMac/CDVBridge.m
deleted file mode 100644
index e0ce358..0000000
--- a/CordovaMac/CordovaMac/CDVBridge.m
+++ /dev/null
@@ -1,175 +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 "CDVBridge.h"
-#import <WebKit/WebKit.h>
-#import <AppKit/AppKit.h>
-#import <Foundation/NSJSONSerialization.h>
-
-@implementation CDVBridge
-
-- (BOOL) isArray:(id)item
-{
-    id win = [self.webView windowScriptObject];
-    NSNumber* result = [win callWebScriptMethod:@"__isArray__" withArguments:[NSArray arrayWithObject:item]];
-
-    return [result boolValue];
-}
-
-- (BOOL) isDictionary:(id)item
-{
-    id win = [self.webView windowScriptObject];
-    NSNumber* result = [win callWebScriptMethod:@"__isObject__" withArguments:[NSArray arrayWithObject:item]];
-    return [result boolValue];
-}
-
-- (NSDictionary*) convertWebScriptObjectToNSDictionary:(WebScriptObject*)webScriptObject
-{
-    // Assumption: webScriptObject has already been tested using isDictionary:
-
-    id win = [self.webView windowScriptObject];
-
-    WebScriptObject* keysObject = [win callWebScriptMethod:@"__dictionaryKeys__" withArguments:[NSArray arrayWithObject:webScriptObject]];
-    NSArray* keys = [self convertWebScriptObjectToNSArray:keysObject];
-    NSMutableDictionary* dict = [NSMutableDictionary dictionaryWithCapacity:[keys count]];
-
-    NSEnumerator* enumerator = [keys objectEnumerator];
-    id key;
-    while (key = [enumerator nextObject]) {
-        [dict setObject:[webScriptObject valueForKey:key] forKey:key];
-    }
-    
-    return dict;
-}
-
-- (NSArray*) convertWebScriptObjectToNSArray:(WebScriptObject*)webScriptObject
-{
-    // Assumption: webScriptObject has already been tested using isArray:
-    
-    NSUInteger count = [[webScriptObject valueForKey:@"length"] integerValue];
-    NSMutableArray *a = [NSMutableArray array];
-    for (unsigned i = 0; i < count; i++) {
-        id item = [webScriptObject webScriptValueAtIndex:i];
-        if ([item isKindOfClass:[WebScriptObject class]]) {
-            if ([self isArray:item]) {
-                [a addObject:[self convertWebScriptObjectToNSArray:item]];
-            } else if ([self isDictionary:item]) {
-                [a addObject:[self convertWebScriptObjectToNSDictionary:item]];
-            };
-        } else {
-            [a addObject:item];
-        }
-    }
-    
-    return a;
-}
-
-- (void) registerJavaScriptHelpers
-{
-    NSString* isArray = [NSString stringWithFormat:@"function __isArray__(obj) { return obj.constructor == Array; };"];
-    NSString* isObject = [NSString stringWithFormat:@"function __isObject__(obj) { return obj.constructor == Object; };"];
-    NSString* dictionaryKeys = [NSString stringWithFormat:
-                                @" \
-                                function __dictionaryKeys__(obj) { \
-                                    var a = []; \
-                                    for (var key in obj) { \
-                                        if (!obj.hasOwnProperty(key)) { \
-                                            continue; \
-                                        } \
-                                        a.push(key); \
-                                    } \
-                                    return a; \
-                                }"
-                                ];
-    
-    id win = [self.webView windowScriptObject];
-    [win evaluateWebScript:isArray];
-    [win evaluateWebScript:isObject];
-    [win evaluateWebScript:dictionaryKeys];
-}
-
-- (id) initWithWebView:(WebView *)webView
-{
-    if ((self = [super init]) != nil) {
-        self.webView = webView;
-        [self registerJavaScriptHelpers];
-    }
-    
-    return self;
-}
-
-- (void) exec:(NSString*)callbackId withService:(NSString*)service andAction:(NSString*)action andArguments:(WebScriptObject*)webScriptObject
-{
-    // We are going with the iOS method of passing in a callbackId.
-    // Note that we can use the JavaScriptCore C API to pass in the JavaScript function references
-    // and context and call them directly, but this is done this way for possible plugin sharing
-    // between iOS and OS X. Also we are going async as well.
-    
-    // we're just going to assume the webScriptObject passed in is an NSArray
-    NSArray* arguments = [self convertWebScriptObjectToNSArray:webScriptObject];
-#pragma unused(arguments)
-    
-	NSLog(@"TODO: [%@.%@] flesh out exec to dispatch the commands, possibly re-use iOS code", service, action);
-}
-
-#pragma mark WebScripting Protocol
-
-/* checks whether a selector is acceptable to be called from JavaScript */
-+ (BOOL) isSelectorExcludedFromWebScript:(SEL)selector
-{
-	BOOL	result = YES;
-	
-	int			i = 0;
-	static SEL	* acceptableList = NULL;
-	SEL			currentSelector;
-	
-	if (acceptableList == NULL && (acceptableList = calloc(256, sizeof(SEL))))	// up to 256 selectors
-	{
-		acceptableList[i++] = @selector(exec:withService:andAction:andArguments:);
-	}
-	
-	i = 0;
-	while (result == YES && (currentSelector = acceptableList[i++]))
-	{
-		//checking for exclusions
-		result = !(selector == currentSelector);
-	}
-	
-	return result;
-}
-
-/* helper function so we don't have to have underscores and stuff in js to refer to the right method */
-+ (NSString*) webScriptNameForSelector:(SEL)aSelector
-{
-	id	result = nil;
-	
-	if (aSelector == @selector(exec:withService:andAction:andArguments:)) {
-		result = @"exec";
-	}
-	
-	return result;
-}
-
-// right now exclude all properties (eg keys)
-+ (BOOL) isKeyExcludedFromWebScript:(const char*)name
-{
-	return YES;
-}
-
-@end

http://git-wip-us.apache.org/repos/asf/cordova-osx/blob/5bfb9c0c/CordovaMac/CordovaMac/Classes/AppDelegate.h
----------------------------------------------------------------------
diff --git a/CordovaMac/CordovaMac/Classes/AppDelegate.h b/CordovaMac/CordovaMac/Classes/AppDelegate.h
new file mode 100644
index 0000000..4c2a0eb
--- /dev/null
+++ b/CordovaMac/CordovaMac/Classes/AppDelegate.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 <Cocoa/Cocoa.h>
+#import "CDVViewController.h"
+
+@interface AppDelegate : NSObject <NSApplicationDelegate> {
+
+	IBOutlet NSWindow* window;
+}
+
+@property (nonatomic, strong) IBOutlet NSWindow* window;
+@property (nonatomic, strong) IBOutlet CDVViewController* viewController;
+
+
+@end

http://git-wip-us.apache.org/repos/asf/cordova-osx/blob/5bfb9c0c/CordovaMac/CordovaMac/Classes/AppDelegate.m
----------------------------------------------------------------------
diff --git a/CordovaMac/CordovaMac/Classes/AppDelegate.m b/CordovaMac/CordovaMac/Classes/AppDelegate.m
new file mode 100644
index 0000000..66a762e
--- /dev/null
+++ b/CordovaMac/CordovaMac/Classes/AppDelegate.m
@@ -0,0 +1,53 @@
+/*
+ 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"
+#import "Constants.h"
+#import "MainViewController.h"
+#import "CDVUtils.h"
+
+@implementation AppDelegate
+
+
+@synthesize window;
+
+- (id)init
+{
+    self = [super init];
+    return self;
+}
+
+- (void) applicationDidStartLaunching:(NSNotification*) aNotification 
+{
+}
+
+- (void) applicationWillFinishLaunching:(NSNotification*)aNotification
+{
+}
+
+- (void) applicationDidFinishLaunching:(NSNotification*)aNotification 
+{
+    [[NSNotificationCenter defaultCenter] addObserver:self.viewController
+                                             selector:@selector(windowResized:)
+                                                 name:NSWindowDidResizeNotification
+                                               object:[self window]];
+
+}
+
+@end

http://git-wip-us.apache.org/repos/asf/cordova-osx/blob/5bfb9c0c/CordovaMac/CordovaMac/Classes/Constants.h
----------------------------------------------------------------------
diff --git a/CordovaMac/CordovaMac/Classes/Constants.h b/CordovaMac/CordovaMac/Classes/Constants.h
new file mode 100644
index 0000000..5b7fc2b
--- /dev/null
+++ b/CordovaMac/CordovaMac/Classes/Constants.h
@@ -0,0 +1,22 @@
+/*
+ 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/5bfb9c0c/CordovaMac/CordovaMac/Classes/MainViewController.h
----------------------------------------------------------------------
diff --git a/CordovaMac/CordovaMac/Classes/MainViewController.h b/CordovaMac/CordovaMac/Classes/MainViewController.h
new file mode 100644
index 0000000..553c0d5
--- /dev/null
+++ b/CordovaMac/CordovaMac/Classes/MainViewController.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 "CDVViewController.h"
+#import "CDVCommandDelegateImpl.h"
+#import "CDVCommandQueue.h"
+
+@interface MainViewController : CDVViewController
+
+@end
+
+@interface MainCommandDelegate : CDVCommandDelegateImpl
+@end
+
+@interface MainCommandQueue : CDVCommandQueue
+@end
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cordova-osx/blob/5bfb9c0c/CordovaMac/CordovaMac/Classes/MainViewController.m
----------------------------------------------------------------------
diff --git a/CordovaMac/CordovaMac/Classes/MainViewController.m b/CordovaMac/CordovaMac/Classes/MainViewController.m
new file mode 100644
index 0000000..d82132b
--- /dev/null
+++ b/CordovaMac/CordovaMac/Classes/MainViewController.m
@@ -0,0 +1,114 @@
+/*
+ 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 "MainViewController.h"
+
+@interface MainViewController ()
+
+@end
+
+@implementation MainViewController
+
+- (id)initWithWindow:(NSWindow *)window
+{
+    self = [super initWithWindow:window];
+    if (self) {
+        // Initialization code here.
+    }
+    
+    return self;
+}
+
+- (id)initWithWindowNibName:(NSString*)nibNameOrNil
+{
+    self = [super initWithWindowNibName:nibNameOrNil];
+    if (self) {
+        // Uncomment to override the CDVCommandDelegateImpl used
+        // _commandDelegate = [[MainCommandDelegate alloc] initWithViewController:self];
+        // Uncomment to override the CDVCommandQueue used
+        // _commandQueue = [[MainCommandQueue alloc] initWithViewController:self];
+    }
+    return self;
+}
+
+
+- (id)init
+{
+    self = [super init];
+    if (self) {
+        // Uncomment to override the CDVCommandDelegateImpl used
+        // _commandDelegate = [[MainCommandDelegate alloc] initWithViewController:self];
+        // Uncomment to override the CDVCommandQueue used
+        // _commandQueue = [[MainCommandQueue alloc] initWithViewController:self];
+    }
+    return self;
+}
+
+
+- (void)windowDidLoad
+{
+    [super windowDidLoad];
+    
+    // Implement this method to handle any initialization after your window controller's window has been loaded from its nib file.
+}
+
+@end
+
+@implementation MainCommandDelegate
+
+/* To override the methods, uncomment the line in the init function(s)
+ in MainViewController.m
+ */
+
+#pragma mark CDVCommandDelegate implementation
+
+- (id)getCommandInstance:(NSString*)className
+{
+    return [super getCommandInstance:className];
+}
+
+/*
+ NOTE: this will only inspect execute calls coming explicitly from native plugins,
+ not the commandQueue (from JavaScript). To see execute calls from JavaScript, see
+ MainCommandQueue below
+ */
+- (BOOL)execute:(CDVInvokedUrlCommand*)command
+{
+    return [super execute:command];
+}
+
+- (NSString*)pathForResource:(NSString*)resourcepath;
+{
+    return [super pathForResource:resourcepath];
+}
+
+@end
+
+@implementation MainCommandQueue
+
+/* To override, uncomment the line in the init function(s)
+ in MainViewController.m
+ */
+- (BOOL)execute:(CDVInvokedUrlCommand*)command
+{
+    return [super execute:command];
+}
+
+@end
+

http://git-wip-us.apache.org/repos/asf/cordova-osx/blob/5bfb9c0c/CordovaMac/CordovaMac/Commands/CDVConsole.h
----------------------------------------------------------------------
diff --git a/CordovaMac/CordovaMac/Commands/CDVConsole.h b/CordovaMac/CordovaMac/Commands/CDVConsole.h
deleted file mode 100644
index bb44368..0000000
--- a/CordovaMac/CordovaMac/Commands/CDVConsole.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 <Cocoa/Cocoa.h>
-
-
-@interface CDVConsole : NSObject {
-	
-}
-
-- (void) log:(NSString*)message;
-
-@end

http://git-wip-us.apache.org/repos/asf/cordova-osx/blob/5bfb9c0c/CordovaMac/CordovaMac/Commands/CDVConsole.m
----------------------------------------------------------------------
diff --git a/CordovaMac/CordovaMac/Commands/CDVConsole.m b/CordovaMac/CordovaMac/Commands/CDVConsole.m
deleted file mode 100644
index fc4b879..0000000
--- a/CordovaMac/CordovaMac/Commands/CDVConsole.m
+++ /dev/null
@@ -1,75 +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 "CDVConsole.h"
-
-
-@implementation CDVConsole
-
-
-- (void) log:(NSString*)message
-{
-    NSLog(@"%@", message);
-}
-
-#pragma mark WebScripting Protocol
-
-/* checks whether a selector is acceptable to be called from JavaScript */
-+ (BOOL) isSelectorExcludedFromWebScript:(SEL)selector
-{
-	BOOL	result = YES;
-	
-	int			i = 0;
-	static SEL	* acceptableList = NULL;
-	SEL			currentSelector;
-	
-	if (acceptableList == NULL && (acceptableList = calloc(256, sizeof(SEL))))	// up to 256 selectors
-	{
-		acceptableList[i++] = @selector(log:);
-	}
-	
-	i = 0;
-	while (result == YES && (currentSelector = acceptableList[i++]))
-	{
-		//checking for exclusions
-		result = !(selector == currentSelector);
-	}
-	
-	return result;
-}
-
-/* helper function so we don't have to have underscores and stuff in js to refer to the right method */
-+ (NSString*) webScriptNameForSelector:(SEL)aSelector
-{
-	id	result = nil;
-	
-	if (aSelector == @selector(log:)) {
-		result = @"log";
-	}
-	
-	return result;
-}
-
-// right now exclude all properties (eg keys)
-+ (BOOL) isKeyExcludedFromWebScript:(const char*)name
-{
-	return YES;
-}
-
-@end

http://git-wip-us.apache.org/repos/asf/cordova-osx/blob/5bfb9c0c/CordovaMac/CordovaMac/Commands/CDVNotification.h
----------------------------------------------------------------------
diff --git a/CordovaMac/CordovaMac/Commands/CDVNotification.h b/CordovaMac/CordovaMac/Commands/CDVNotification.h
deleted file mode 100644
index 7cff59f..0000000
--- a/CordovaMac/CordovaMac/Commands/CDVNotification.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 <Cocoa/Cocoa.h>
-
-
-@interface CDVNotification : NSObject {
-	
-}
-
-- (void) alert:(NSString*)message withTitle:(NSString*)title;
-
-@end

http://git-wip-us.apache.org/repos/asf/cordova-osx/blob/5bfb9c0c/CordovaMac/CordovaMac/Commands/CDVNotification.m
----------------------------------------------------------------------
diff --git a/CordovaMac/CordovaMac/Commands/CDVNotification.m b/CordovaMac/CordovaMac/Commands/CDVNotification.m
deleted file mode 100644
index 1830a13..0000000
--- a/CordovaMac/CordovaMac/Commands/CDVNotification.m
+++ /dev/null
@@ -1,78 +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 "CDVNotification.h"
-#import <AppKit/AppKit.h>
-
-@implementation CDVNotification
-
-
-- (void) alert:(NSString*)message withTitle:(NSString*)title;
-{
-    NSAlert* alert = [NSAlert alertWithMessageText:title
-                                     defaultButton:@"OK" alternateButton:nil
-                                       otherButton:nil informativeTextWithFormat:@"%@", message];
-    [alert runModal];
-}
-
-#pragma mark WebScripting Protocol
-
-/* checks whether a selector is acceptable to be called from JavaScript */
-+ (BOOL) isSelectorExcludedFromWebScript:(SEL)selector
-{
-	BOOL	result = YES;
-	
-	int			i = 0;
-	static SEL	* acceptableList = NULL;
-	SEL			currentSelector;
-	
-	if (acceptableList == NULL && (acceptableList = calloc(256, sizeof(SEL))))	// up to 256 selectors
-	{
-		acceptableList[i++] = @selector(alert:withTitle:);
-	}
-	
-	i = 0;
-	while (result == YES && (currentSelector = acceptableList[i++]))
-	{
-		//checking for exclusions
-		result = !(selector == currentSelector);
-	}
-	
-	return result;
-}
-
-/* helper function so we don't have to have underscores and stuff in js to refer to the right method */
-+ (NSString*) webScriptNameForSelector:(SEL)aSelector
-{
-	id	result = nil;
-	
-	if (aSelector == @selector(alert:withTitle:)) {
-		result = @"alert";
-	}
-	
-	return result;
-}
-
-// right now exclude all properties (eg keys)
-+ (BOOL) isKeyExcludedFromWebScript:(const char*)name
-{
-	return YES;
-}
-
-@end

http://git-wip-us.apache.org/repos/asf/cordova-osx/blob/5bfb9c0c/CordovaMac/CordovaMac/Commands/CDVSound.h
----------------------------------------------------------------------
diff --git a/CordovaMac/CordovaMac/Commands/CDVSound.h b/CordovaMac/CordovaMac/Commands/CDVSound.h
deleted file mode 100644
index a277829..0000000
--- a/CordovaMac/CordovaMac/Commands/CDVSound.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 <Cocoa/Cocoa.h>
-
-
-@interface CDVSound : NSObject {
-	
-}
-
-- (void) play:(NSString*)file;
-
-@end

http://git-wip-us.apache.org/repos/asf/cordova-osx/blob/5bfb9c0c/CordovaMac/CordovaMac/Commands/CDVSound.m
----------------------------------------------------------------------
diff --git a/CordovaMac/CordovaMac/Commands/CDVSound.m b/CordovaMac/CordovaMac/Commands/CDVSound.m
deleted file mode 100644
index 8451a0c..0000000
--- a/CordovaMac/CordovaMac/Commands/CDVSound.m
+++ /dev/null
@@ -1,79 +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 "CDVSound.h"
-
-
-@implementation CDVSound
-
-
-- (void) play:(NSString*)file
-{
-	NSURL* fileUrl  = [NSURL fileURLWithPath:[[Utils sharedInstance] pathForResource:file]];
-	//DebugNSLog(@"Sound file:%@", [fileUrl description]);
-	
-	NSSound* sound = [[[NSSound alloc] initWithContentsOfURL:fileUrl byReference:YES] autorelease];
-	[sound play];
-}
-
-#pragma mark WebScripting Protocol
-
-/* checks whether a selector is acceptable to be called from JavaScript */
-+ (BOOL) isSelectorExcludedFromWebScript:(SEL)selector
-{
-	BOOL	result = YES;
-	
-	int			i = 0;
-	static SEL	* acceptableList = NULL;
-	SEL			currentSelector;
-	
-	if (acceptableList == NULL && (acceptableList = calloc(256, sizeof(SEL))))	// up to 256 selectors
-	{
-		acceptableList[i++] = @selector(play:);
-	}
-	
-	i = 0;
-	while (result == YES && (currentSelector = acceptableList[i++]))
-	{
-		//checking for exclusions
-		result = !(selector == currentSelector);
-	}
-	
-	return result;
-}
-
-/* helper function so we don't have to have underscores and stuff in js to refer to the right method */
-+ (NSString*) webScriptNameForSelector:(SEL)aSelector
-{
-	id	result = nil;
-	
-	if (aSelector == @selector(play:)) {
-		result = @"play";
-	}
-	
-	return result;
-}
-
-// right now exclude all properties (eg keys)
-+ (BOOL) isKeyExcludedFromWebScript:(const char*)name
-{
-	return YES;
-}
-
-@end

http://git-wip-us.apache.org/repos/asf/cordova-osx/blob/5bfb9c0c/CordovaMac/CordovaMac/Constants.h
----------------------------------------------------------------------
diff --git a/CordovaMac/CordovaMac/Constants.h b/CordovaMac/CordovaMac/Constants.h
deleted file mode 100644
index cffe4e6..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 kStartPage      @"index.html"
-#define kStartFolder    @"www"
-

http://git-wip-us.apache.org/repos/asf/cordova-osx/blob/5bfb9c0c/CordovaMac/CordovaMac/ContentView.h
----------------------------------------------------------------------
diff --git a/CordovaMac/CordovaMac/ContentView.h b/CordovaMac/CordovaMac/ContentView.h
deleted file mode 100644
index 6156efb..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 (retain) WebView* webView;
-@property (retain) WebViewDelegate* delegate;
-
-@end

http://git-wip-us.apache.org/repos/asf/cordova-osx/blob/5bfb9c0c/CordovaMac/CordovaMac/ContentView.m
----------------------------------------------------------------------
diff --git a/CordovaMac/CordovaMac/ContentView.m b/CordovaMac/CordovaMac/ContentView.m
deleted file mode 100644
index 391812e..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] autorelease];
-    [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/5bfb9c0c/CordovaMac/CordovaMac/CordovaMac-Info.plist
----------------------------------------------------------------------
diff --git a/CordovaMac/CordovaMac/CordovaMac-Info.plist b/CordovaMac/CordovaMac/CordovaMac-Info.plist
index c8f540f..d025b0b 100644
--- a/CordovaMac/CordovaMac/CordovaMac-Info.plist
+++ b/CordovaMac/CordovaMac/CordovaMac-Info.plist
@@ -27,7 +27,7 @@
 	<key>NSHumanReadableCopyright</key>
 	<string>Apache License, Version 2.0</string>
 	<key>NSMainNibFile</key>
-	<string>MainMenu</string>
+	<string>MainViewController</string>
 	<key>NSPrincipalClass</key>
 	<string>NSApplication</string>
 </dict>

http://git-wip-us.apache.org/repos/asf/cordova-osx/blob/5bfb9c0c/CordovaMac/CordovaMac/CordovaMac-Prefix.pch
----------------------------------------------------------------------
diff --git a/CordovaMac/CordovaMac/CordovaMac-Prefix.pch b/CordovaMac/CordovaMac/CordovaMac-Prefix.pch
index eac26de..c4c1d52 100644
--- a/CordovaMac/CordovaMac/CordovaMac-Prefix.pch
+++ b/CordovaMac/CordovaMac/CordovaMac-Prefix.pch
@@ -19,14 +19,8 @@
 
 #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/5bfb9c0c/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/5bfb9c0c/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/5bfb9c0c/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/5bfb9c0c/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 */
+