cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From shaz...@apache.org
Subject [5/6] mac commit: Got NetworkConnection and Device plugins working.
Date Thu, 07 Mar 2013 01:13:59 GMT
Got NetworkConnection and Device plugins working.


Project: http://git-wip-us.apache.org/repos/asf/cordova-osx/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-osx/commit/a2fca6e6
Tree: http://git-wip-us.apache.org/repos/asf/cordova-osx/tree/a2fca6e6
Diff: http://git-wip-us.apache.org/repos/asf/cordova-osx/diff/a2fca6e6

Branch: refs/heads/plugin-enable
Commit: a2fca6e655180aecffb0ee3a02dc1784c8f521d8
Parents: e1c8592
Author: Shazron Abdullah <shazron@apache.org>
Authored: Wed Mar 6 17:13:40 2013 -0800
Committer: Shazron Abdullah <shazron@apache.org>
Committed: Wed Mar 6 17:13:40 2013 -0800

----------------------------------------------------------------------
 CordovaMac/CordovaLib/CDVBridge.h                  |    6 +-
 CordovaMac/CordovaLib/CDVBridge.m                  |   35 +-
 CordovaMac/CordovaLib/CDVViewController.h          |   57 +
 CordovaMac/CordovaLib/CDVViewController.m          |  199 +
 CordovaMac/CordovaLib/CDVWebViewDelegate.h         |   34 +
 CordovaMac/CordovaLib/CDVWebViewDelegate.m         |   87 +
 .../CordovaLib/Commands/CDVCommandDelegateImpl.h   |    6 +-
 .../CordovaLib/Commands/CDVCommandDelegateImpl.m   |   42 +-
 CordovaMac/CordovaLib/Commands/CDVConfigParser.m   |    2 +-
 CordovaMac/CordovaLib/Commands/CDVDevice.m         |    9 +-
 CordovaMac/CordovaLib/Commands/CDVPlugin.h         |    3 +-
 .../CordovaLib/Commands/Utils/NSData+Base64.h      |   33 -
 .../CordovaLib/Commands/Utils/NSData+Base64.m      |  286 --
 .../Commands/Utils/NSMutableArray+QueueAdditions.h |   29 -
 .../Commands/Utils/NSMutableArray+QueueAdditions.m |   58 -
 CordovaMac/CordovaLib/Utils/CDVUtils.h             |   32 +
 CordovaMac/CordovaLib/Utils/CDVUtils.m             |   47 +
 CordovaMac/CordovaLib/Utils/NSData+Base64.h        |   33 +
 CordovaMac/CordovaLib/Utils/NSData+Base64.m        |  286 ++
 .../Utils/NSMutableArray+QueueAdditions.h          |   29 +
 .../Utils/NSMutableArray+QueueAdditions.m          |   58 +
 CordovaMac/CordovaMac.xcodeproj/project.pbxproj    |   87 +-
 CordovaMac/CordovaMac/Classes/AppDelegate.h        |    8 +-
 CordovaMac/CordovaMac/Classes/AppDelegate.m        |   26 +-
 CordovaMac/CordovaMac/Classes/ContentView.h        |   35 -
 CordovaMac/CordovaMac/Classes/ContentView.m        |   64 -
 CordovaMac/CordovaMac/Classes/MainViewController.h |   32 +
 CordovaMac/CordovaMac/Classes/MainViewController.m |  114 +
 CordovaMac/CordovaMac/Classes/Utils.h              |   37 -
 CordovaMac/CordovaMac/Classes/Utils.m              |   94 -
 CordovaMac/CordovaMac/Classes/WebViewDelegate.h    |   36 -
 CordovaMac/CordovaMac/Classes/WebViewDelegate.m    |   87 -
 CordovaMac/CordovaMac/CordovaMac-Info.plist        |    2 +-
 CordovaMac/CordovaMac/CordovaMac-Prefix.pch        |    1 -
 .../CordovaMac/Resources/en.lproj/MainMenu.xib     | 3533 ---------------
 .../Resources/en.lproj/MainViewController.xib      | 3531 ++++++++++++++
 CordovaMac/CordovaMac/config.xml                   |    2 +-
 CordovaMac/www/cordova.osx.js                      |   98 +-
 CordovaMac/www/js/index.js                         |    4 +-
 39 files changed, 4722 insertions(+), 4440 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-osx/blob/a2fca6e6/CordovaMac/CordovaLib/CDVBridge.h
----------------------------------------------------------------------
diff --git a/CordovaMac/CordovaLib/CDVBridge.h b/CordovaMac/CordovaLib/CDVBridge.h
index 171675f..aa9e087 100644
--- a/CordovaMac/CordovaLib/CDVBridge.h
+++ b/CordovaMac/CordovaLib/CDVBridge.h
@@ -19,14 +19,16 @@
 
 #import <Cocoa/Cocoa.h>
 @class WebView;
+@class CDVViewController;
 
 @interface CDVBridge : NSObject {
 	
 }
 
-@property (nonatomic, strong) WebView* webView;
+@property (nonatomic, weak) WebView* webView;
+@property (nonatomic, weak) CDVViewController* viewController;
 
-- (id) initWithWebView:(WebView*)webView;
+- (id) initWithWebView:(WebView*)webView andViewController:(CDVViewController*)viewController;
 - (void) exec:(NSString*)callbackId withService:(NSString*)service andAction:(NSString*)action andArguments:(NSArray*)arguments;
 
 

http://git-wip-us.apache.org/repos/asf/cordova-osx/blob/a2fca6e6/CordovaMac/CordovaLib/CDVBridge.m
----------------------------------------------------------------------
diff --git a/CordovaMac/CordovaLib/CDVBridge.m b/CordovaMac/CordovaLib/CDVBridge.m
index 4cbdf4b..fade163 100644
--- a/CordovaMac/CordovaLib/CDVBridge.m
+++ b/CordovaMac/CordovaLib/CDVBridge.m
@@ -17,10 +17,13 @@
  under the License.
  */
 
-#import "CDVBridge.h"
 #import <WebKit/WebKit.h>
 #import <AppKit/AppKit.h>
 #import <Foundation/NSJSONSerialization.h>
+#include <objc/message.h>
+
+#import "CDVBridge.h"
+#import "CDVViewController.h"
 
 @implementation CDVBridge
 
@@ -106,10 +109,11 @@
     [win evaluateWebScript:dictionaryKeys];
 }
 
-- (id) initWithWebView:(WebView *)webView
+- (id) initWithWebView:(WebView *)webView andViewController:(CDVViewController*)viewController
 {
     if ((self = [super init]) != nil) {
         self.webView = webView;
+        self.viewController = viewController;
         [self registerJavaScriptHelpers];
     }
     
@@ -125,9 +129,32 @@
     
     // 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);
+    CDVInvokedUrlCommand* command = [[CDVInvokedUrlCommand alloc] initWithArguments:arguments callbackId:callbackId className:service methodName:action];
+    
+    if ((command.className == nil) || (command.methodName == nil)) {
+        NSLog(@"ERROR: Classname and/or methodName not found for command.");
+        return;
+    }
+    
+    // Fetch an instance of this class
+    CDVPlugin* obj = [_viewController.commandDelegate getCommandInstance:command.className];
+    
+    if (!([obj isKindOfClass:[CDVPlugin class]])) {
+        NSLog(@"ERROR: Plugin '%@' not found, or is not a CDVPlugin. Check your plugin mapping in config.xml.", command.className);
+        return;
+    }
+
+    // Find the proper selector to call.
+    NSString* methodName = [NSString stringWithFormat:@"%@:", command.methodName];
+    SEL normalSelector = NSSelectorFromString(methodName);
+    if ([obj respondsToSelector:normalSelector]) {
+        // [obj performSelector:normalSelector withObject:command];
+        objc_msgSend(obj, normalSelector, command);
+    } else {
+        // There's no method to call, so throw an error.
+        NSLog(@"ERROR: Method '%@' not defined in Plugin '%@'", methodName, command.className);
+    }
 }
 
 #pragma mark WebScripting Protocol

http://git-wip-us.apache.org/repos/asf/cordova-osx/blob/a2fca6e6/CordovaMac/CordovaLib/CDVViewController.h
----------------------------------------------------------------------
diff --git a/CordovaMac/CordovaLib/CDVViewController.h b/CordovaMac/CordovaLib/CDVViewController.h
new file mode 100644
index 0000000..490b1ee
--- /dev/null
+++ b/CordovaMac/CordovaLib/CDVViewController.h
@@ -0,0 +1,57 @@
+/*
+ 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>
+#import <Foundation/NSJSONSerialization.h>
+#import "CDVAvailability.h"
+#import "CDVInvokedUrlCommand.h"
+#import "CDVCommandDelegate.h"
+#import "CDVCommandQueue.h"
+#import "CDVPlugin.h"
+#import "CDVWebViewDelegate.h"
+
+@interface CDVViewController : NSWindowController
+{
+    @protected
+    id <CDVCommandDelegate> _commandDelegate;
+    @protected
+    CDVCommandQueue* _commandQueue;
+    NSString* _userAgent;
+}
+
+@property (nonatomic, strong) IBOutlet NSView* contentView;
+@property (nonatomic, strong) IBOutlet WebView* webView;
+@property (nonatomic, strong) IBOutlet CDVWebViewDelegate* webViewDelegate;
+
+@property (nonatomic, readonly, strong) NSMutableDictionary* pluginObjects;
+@property (nonatomic, readonly, strong) NSDictionary* pluginsMap;
+@property (nonatomic, readonly, strong) NSMutableDictionary* settings;
+@property (nonatomic, readonly, strong) NSXMLParser* configParser;
+@property (nonatomic, readonly, assign) BOOL loadFromString;
+
+@property (nonatomic, readwrite, copy) NSString* wwwFolderName;
+@property (nonatomic, readwrite, copy) NSString* startPage;
+@property (nonatomic, readonly, strong) CDVCommandQueue* commandQueue;
+@property (nonatomic, readonly, strong) id <CDVCommandDelegate> commandDelegate;
+
+- (id)getCommandInstance:(NSString*)pluginName;
+- (void)registerPlugin:(CDVPlugin*)plugin withClassName:(NSString*)className;
+
+@end

http://git-wip-us.apache.org/repos/asf/cordova-osx/blob/a2fca6e6/CordovaMac/CordovaLib/CDVViewController.m
----------------------------------------------------------------------
diff --git a/CordovaMac/CordovaLib/CDVViewController.m b/CordovaMac/CordovaLib/CDVViewController.m
new file mode 100644
index 0000000..12a6368
--- /dev/null
+++ b/CordovaMac/CordovaLib/CDVViewController.m
@@ -0,0 +1,199 @@
+/*
+ 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 "CDVUtils.h"
+#import "CDVConfigParser.h"
+#import "CDVCommandDelegateImpl.h"
+
+@interface CDVViewController ()
+
+@property (nonatomic, readwrite, strong) NSXMLParser* configParser;
+@property (nonatomic, readwrite, strong) NSMutableDictionary* settings;
+@property (nonatomic, readwrite, strong) NSMutableDictionary* pluginObjects;
+@property (nonatomic, readwrite, strong) NSArray* startupPluginNames;
+@property (nonatomic, readwrite, strong) NSDictionary* pluginsMap;
+@property (nonatomic, readwrite, assign) BOOL loadFromString;
+
+@end
+
+@implementation CDVViewController
+
+@synthesize webView;
+@synthesize pluginObjects, pluginsMap, startupPluginNames;
+@synthesize configParser, settings, loadFromString;
+@synthesize wwwFolderName, startPage;
+@synthesize commandDelegate = _commandDelegate;
+@synthesize commandQueue = _commandQueue;
+
+- (void) awakeFromNib
+{
+    _commandDelegate = [[CDVCommandDelegateImpl alloc] initWithViewController:self];
+    self.webViewDelegate.viewController = self;
+    
+    NSURL* appURL = nil;
+    NSString* loadErr = nil;
+    
+    if ([self.startPage rangeOfString:@"://"].location != NSNotFound) {
+        appURL = [NSURL URLWithString:self.startPage];
+    } else if ([self.wwwFolderName rangeOfString:@"://"].location != NSNotFound) {
+        appURL = [NSURL URLWithString:[NSString stringWithFormat:@"%@/%@", self.wwwFolderName, self.startPage]];
+    } else {
+        NSString* startFilePath = [self.commandDelegate pathForResource:self.startPage];
+        if (startFilePath == nil) {
+            loadErr = [NSString stringWithFormat:@"ERROR: Start Page at '%@/%@' was not found.", self.wwwFolderName, self.startPage];
+            NSLog(@"%@", loadErr);
+            self.loadFromString = YES;
+            appURL = nil;
+        } else {
+            appURL = [NSURL fileURLWithPath:startFilePath];
+        }
+    }
+    
+    if (!loadErr) {
+        NSURLRequest* appReq = [NSURLRequest requestWithURL:appURL cachePolicy:NSURLRequestUseProtocolCachePolicy timeoutInterval:20.0];
+        [[self.webView mainFrame] loadRequest:appReq];
+        
+    } else {
+        NSString* html = [NSString stringWithFormat:@"<html><body> %@ </body></html>", loadErr];
+        [[self.webView mainFrame] loadHTMLString:html baseURL:nil];
+    }
+    
+    for (NSString* pluginName in self.startupPluginNames) {
+        [self getCommandInstance:pluginName];
+    }
+}
+
+- (void) __init
+{
+    [self loadSettings];
+}
+
+- (id) init
+{
+    self = [super init];
+    if (self) {
+        // Initialization code here.
+        [self __init];
+    }
+    return self;
+}
+
+- (id)initWithWindowNibName:(NSString*)nibNameOrNil
+{
+    self = [super initWithWindowNibName:nibNameOrNil];
+    if (self) {
+        // Initialization code here.
+        [self __init];
+    }
+    return self;
+}
+
+- (void)loadSettings
+{
+    CDVConfigParser* delegate = [[CDVConfigParser alloc] init];
+    
+    // read from config.xml in the app bundle
+    NSString* path = [[NSBundle mainBundle] pathForResource:@"config" ofType:@"xml"];
+    
+    if (![[NSFileManager defaultManager] fileExistsAtPath:path]) {
+        NSAssert(NO, @"ERROR: config.xml does not exist. Please run cordova-ios/bin/cordova_plist_to_config_xml path/to/project.");
+        return;
+    }
+    
+    NSURL* url = [NSURL fileURLWithPath:path];
+    
+    configParser = [[NSXMLParser alloc] initWithContentsOfURL:url];
+    if (configParser == nil) {
+        NSLog(@"Failed to initialize XML parser.");
+        return;
+    }
+    [configParser setDelegate:((id < NSXMLParserDelegate >)delegate)];
+    [configParser parse];
+    
+    // Get the plugin dictionary, whitelist and settings from the delegate.
+    self.pluginsMap = delegate.pluginsDict;
+    self.startupPluginNames = delegate.startupPluginNames;
+    self.settings = delegate.settings;
+    
+    // And the start folder/page.
+    self.wwwFolderName = @"www";
+    self.startPage = delegate.startPage;
+    if (self.startPage == nil) {
+        self.startPage = @"index.html";
+    }
+    
+    // Initialize the plugin objects dict.
+    self.pluginObjects = [[NSMutableDictionary alloc] initWithCapacity:20];
+}
+
+- (void)registerPlugin:(CDVPlugin*)plugin withClassName:(NSString*)className
+{
+    if ([plugin respondsToSelector:@selector(setViewController:)]) {
+        [plugin setViewController:self];
+    }
+    
+    if ([plugin respondsToSelector:@selector(setCommandDelegate:)]) {
+        [plugin setCommandDelegate:_commandDelegate];
+    }
+    
+    [self.pluginObjects setObject:plugin forKey:className];
+    [plugin pluginInitialize];
+}
+
+/**
+ Returns an instance of a CordovaCommand object, based on its name.  If one exists already, it is returned.
+ */
+- (id)getCommandInstance:(NSString*)pluginName
+{
+    // first, we try to find the pluginName in the pluginsMap
+    // (acts as a whitelist as well) if it does not exist, we return nil
+    // NOTE: plugin names are matched as lowercase to avoid problems - however, a
+    // possible issue is there can be duplicates possible if you had:
+    // "org.apache.cordova.Foo" and "org.apache.cordova.foo" - only the lower-cased entry will match
+    NSString* className = [self.pluginsMap objectForKey:[pluginName lowercaseString]];
+    
+    if (className == nil) {
+        return nil;
+    }
+    
+    id obj = [self.pluginObjects objectForKey:className];
+    if (!obj) {
+        obj = [[NSClassFromString (className)alloc] initWithWebView:webView];
+        
+        if (obj != nil) {
+            [self registerPlugin:obj withClassName:className];
+        } else {
+            NSLog(@"CDVPlugin class %@ (pluginName: %@) does not exist.", className, pluginName);
+        }
+    }
+    return obj;
+}
+
+- (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 - [CDVUtils 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/a2fca6e6/CordovaMac/CordovaLib/CDVWebViewDelegate.h
----------------------------------------------------------------------
diff --git a/CordovaMac/CordovaLib/CDVWebViewDelegate.h b/CordovaMac/CordovaLib/CDVWebViewDelegate.h
new file mode 100644
index 0000000..c2a33f4
--- /dev/null
+++ b/CordovaMac/CordovaLib/CDVWebViewDelegate.h
@@ -0,0 +1,34 @@
+/*
+ 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 CDVConsole;
+@class CDVBridge;
+@class CDVViewController;
+
+@interface CDVWebViewDelegate : NSObject {
+}
+
+@property (nonatomic, strong) CDVConsole* console;
+@property (nonatomic, strong) CDVBridge* bridge;
+@property (nonatomic, weak)   CDVViewController* viewController;
+
+@end

http://git-wip-us.apache.org/repos/asf/cordova-osx/blob/a2fca6e6/CordovaMac/CordovaLib/CDVWebViewDelegate.m
----------------------------------------------------------------------
diff --git a/CordovaMac/CordovaLib/CDVWebViewDelegate.m b/CordovaMac/CordovaLib/CDVWebViewDelegate.m
new file mode 100644
index 0000000..144c8fd
--- /dev/null
+++ b/CordovaMac/CordovaLib/CDVWebViewDelegate.m
@@ -0,0 +1,87 @@
+/*
+ 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 "CDVWebViewDelegate.h"
+#import "CDVConsole.h"
+#import "CDVBridge.h"
+
+@implementation CDVWebViewDelegate
+
+@synthesize console;
+
+- (void) webView:(WebView*)webView windowScriptObjectAvailable:(WebScriptObject*)windowScriptObject
+{
+	if (self.console == nil) {
+        self.console = [CDVConsole new];
+    }
+	[windowScriptObject setValue:self.console forKey:@"console"];
+	
+	if (self.bridge == nil) {
+        self.bridge = [[CDVBridge alloc] initWithWebView:webView andViewController:self.viewController];
+    }
+    [windowScriptObject setValue:self.bridge forKey:@"cordovabridge"];
+}
+
+- (void)webView:(WebView *)sender didFinishLoadForFrame:(WebFrame *)frame
+{
+    id win = [sender windowScriptObject];
+    NSString* nativeReady = @"try{cordova.require('cordova/channel').onNativeReady.fire();}catch(e){window._nativeReady = true;}";
+    [win evaluateWebScript:nativeReady];
+}
+
+/* This logs all errors from Javascript, nifty */
+- (void) webView:(WebView*)webView addMessageToConsole:(NSDictionary*)message
+{
+	if (![message isKindOfClass:[NSDictionary class]]) { 
+		return;
+	}
+	
+	NSLog(@"JavaScript error: %@:%@: %@", 
+		  [[message objectForKey:@"sourceURL"] lastPathComponent],	// could be nil
+		  [message objectForKey:@"lineNumber"],
+		  [message objectForKey:@"message"]);
+}
+
+#pragma mark WebScripting protocol
+
+/* checks whether a selector is acceptable to be called from JavaScript */
++ (BOOL) isSelectorExcludedFromWebScript:(SEL)selector
+{
+	return YES;
+}
+
+// right now exclude all properties (eg keys)
++ (BOOL) isKeyExcludedFromWebScript:(const char*)name
+{
+	return YES;
+}
+
+#pragma mark WebPolicyDelegate
+
+- (void)webView:(WebView *)sender decidePolicyForNavigationAction:(NSDictionary *)actionInformation request:(NSURLRequest *)request frame:(WebFrame *)frame decisionListener:(id<WebPolicyDecisionListener>)listener
+{	
+    NSString* url = [[request URL] description];
+    NSLog(@"navigating to %@", url);
+
+    [listener use];
+}
+
+
+@end

http://git-wip-us.apache.org/repos/asf/cordova-osx/blob/a2fca6e6/CordovaMac/CordovaLib/Commands/CDVCommandDelegateImpl.h
----------------------------------------------------------------------
diff --git a/CordovaMac/CordovaLib/Commands/CDVCommandDelegateImpl.h b/CordovaMac/CordovaLib/Commands/CDVCommandDelegateImpl.h
index 733dd1d..db0bd09 100644
--- a/CordovaMac/CordovaLib/Commands/CDVCommandDelegateImpl.h
+++ b/CordovaMac/CordovaLib/Commands/CDVCommandDelegateImpl.h
@@ -19,14 +19,14 @@
 
 #import "CDVCommandDelegate.h"
 
-@class NSViewController;
+@class CDVViewController;
 @class CDVCommandQueue;
 
 @interface CDVCommandDelegateImpl : NSObject <CDVCommandDelegate>{
 //    @private
-    __weak NSViewController* _viewController;
+    __weak CDVViewController* _viewController;
     @protected
     __weak CDVCommandQueue* _commandQueue;
 }
-- (id)initWithViewController:(NSViewController*)viewController;
+- (id)initWithViewController:(CDVViewController*)viewController;
 @end

http://git-wip-us.apache.org/repos/asf/cordova-osx/blob/a2fca6e6/CordovaMac/CordovaLib/Commands/CDVCommandDelegateImpl.m
----------------------------------------------------------------------
diff --git a/CordovaMac/CordovaLib/Commands/CDVCommandDelegateImpl.m b/CordovaMac/CordovaLib/Commands/CDVCommandDelegateImpl.m
index 2041b7e..ed082aa 100644
--- a/CordovaMac/CordovaLib/Commands/CDVCommandDelegateImpl.m
+++ b/CordovaMac/CordovaLib/Commands/CDVCommandDelegateImpl.m
@@ -21,10 +21,11 @@
 #import "CDVJSON.h"
 #import "CDVCommandQueue.h"
 #import "CDVPluginResult.h"
+#import "CDVViewController.h"
 
 @implementation CDVCommandDelegateImpl
 
-- (id)initWithViewController:(NSViewController*)viewController
+- (id)initWithViewController:(CDVViewController*)viewController
 {
     self = [super init];
     if (self != nil) {
@@ -44,26 +45,24 @@
     [directoryParts removeLastObject];
 
     NSString* directoryPartsJoined = [directoryParts componentsJoinedByString:@"/"];
-#pragma unused(directoryPartsJoined)
-    NSString* directoryStr = @""; //TODO: //_viewController.wwwFolderName;
+    NSString* directoryStr = _viewController.wwwFolderName;
 
-// TODO:
-//    if ([directoryPartsJoined length] > 0) {
-//        directoryStr = [NSString stringWithFormat:@"%@/%@", _viewController.wwwFolderName, [directoryParts componentsJoinedByString:@"/"]];
-//    }
+    if ([directoryPartsJoined length] > 0) {
+        directoryStr = [NSString stringWithFormat:@"%@/%@", _viewController.wwwFolderName, [directoryParts componentsJoinedByString:@"/"]];
+    }
 
     return [mainBundle pathForResource:filename ofType:@"" inDirectory:directoryStr];
 }
 
 - (void)evalJsHelper2:(NSString*)js
 {
-// TODO: 
-//    CDV_EXEC_LOG(@"Exec: evalling: %@", [js substringToIndex:MIN([js length], 160)]);
-//    NSString* commandsJSON = [_viewController.webView stringByEvaluatingJavaScriptFromString:js];
-//    if ([commandsJSON length] > 0) {
-//        CDV_EXEC_LOG(@"Exec: Retrieved new exec messages by chaining.");
-//    }
-//
+    CDV_EXEC_LOG(@"Exec: evalling: %@", [js substringToIndex:MIN([js length], 160)]);
+    NSString* commandsJSON = [_viewController.webView stringByEvaluatingJavaScriptFromString:js];
+    if ([commandsJSON length] > 0) {
+        CDV_EXEC_LOG(@"Exec: Retrieved new exec messages by chaining.");
+    }
+    
+    // TODO:
 //    [_commandQueue enqueCommandBatch:commandsJSON];
 }
 
@@ -76,6 +75,7 @@
     // execute the callback immediately.
     // Using    (dispatch_get_main_queue()) does *not* fix deadlocks for some reaon,
     // but performSelectorOnMainThread: does.
+
     if (![NSThread isMainThread] || !_commandQueue.currentlyExecuting) {
         [self performSelectorOnMainThread:@selector(evalJsHelper2:) withObject:js waitUntilDone:NO];
     } else {
@@ -121,14 +121,12 @@
 
 - (id)getCommandInstance:(NSString*)pluginName
 {
-    //TODO:
-//    return [_viewController getCommandInstance:pluginName];
+    return [_viewController getCommandInstance:pluginName];
 }
 
 - (void)registerPlugin:(CDVPlugin*)plugin withClassName:(NSString*)className
 {
-    //TODO:
-//    [_viewController registerPlugin:plugin withClassName:className];
+    [_viewController registerPlugin:plugin withClassName:className];
 }
 
 - (void)runInBackground:(void (^)())block
@@ -138,8 +136,8 @@
 
 - (NSString*)userAgent
 {
-    // TODO:
-//    return [_viewController userAgent];
+    //return [_viewController userAgent];
+    return nil;
 }
 
 - (BOOL)URLIsWhitelisted:(NSURL*)url
@@ -152,9 +150,7 @@
 
 - (NSDictionary*)settings
 {
-    // TODO:
-//    return _viewController.settings;
-    return nil;
+    return _viewController.settings;
 }
 
 @end

http://git-wip-us.apache.org/repos/asf/cordova-osx/blob/a2fca6e6/CordovaMac/CordovaLib/Commands/CDVConfigParser.m
----------------------------------------------------------------------
diff --git a/CordovaMac/CordovaLib/Commands/CDVConfigParser.m b/CordovaMac/CordovaLib/Commands/CDVConfigParser.m
index 6fd5913..876d17a 100644
--- a/CordovaMac/CordovaLib/Commands/CDVConfigParser.m
+++ b/CordovaMac/CordovaLib/Commands/CDVConfigParser.m
@@ -64,7 +64,7 @@
 
 - (void)parser:(NSXMLParser*)parser parseErrorOccurred:(NSError*)parseError
 {
-    NSAssert(NO, @"config.xml parse error line %d col %d", [parser lineNumber], [parser columnNumber]);
+    NSAssert(NO, @"config.xml parse error line %ld col %ld", (long)[parser lineNumber], (long)[parser columnNumber]);
 }
 
 @end

http://git-wip-us.apache.org/repos/asf/cordova-osx/blob/a2fca6e6/CordovaMac/CordovaLib/Commands/CDVDevice.m
----------------------------------------------------------------------
diff --git a/CordovaMac/CordovaLib/Commands/CDVDevice.m b/CordovaMac/CordovaLib/Commands/CDVDevice.m
index 83ff1d3..9728301 100644
--- a/CordovaMac/CordovaLib/Commands/CDVDevice.m
+++ b/CordovaMac/CordovaLib/Commands/CDVDevice.m
@@ -40,17 +40,20 @@
 
 - (NSString*)model
 {
-    return nil;
+    // TODO:
+    return @"";
 }
 
 - (NSString*)uniqueAppInstanceIdentifier
 {
-    return nil;
+    // TODO:
+    return @"";
 }
 
 - (NSString*)systemVersion
 {
-    return nil;
+    // TODO:
+    return @"";
 }
 
 - (void)getDeviceInfo:(CDVInvokedUrlCommand*)command

http://git-wip-us.apache.org/repos/asf/cordova-osx/blob/a2fca6e6/CordovaMac/CordovaLib/Commands/CDVPlugin.h
----------------------------------------------------------------------
diff --git a/CordovaMac/CordovaLib/Commands/CDVPlugin.h b/CordovaMac/CordovaLib/Commands/CDVPlugin.h
index 8f8d1a1..6e0754a 100644
--- a/CordovaMac/CordovaLib/Commands/CDVPlugin.h
+++ b/CordovaMac/CordovaLib/Commands/CDVPlugin.h
@@ -22,6 +22,7 @@
 #import "CDVPluginResult.h"
 #import "NSMutableArray+QueueAdditions.h"
 #import "CDVCommandDelegate.h"
+#import "CDVViewController.h"
 
 NSString* const CDVPageDidLoadNotification;
 NSString* const CDVPluginHandleOpenURLNotification;
@@ -31,7 +32,7 @@ NSString* const CDVLocalNotification;
 @interface CDVPlugin : NSObject {}
 
 @property (nonatomic, weak) WebView* webView;
-@property (nonatomic, unsafe_unretained) NSViewController* viewController;
+@property (nonatomic, unsafe_unretained) CDVViewController* viewController;
 @property (nonatomic, unsafe_unretained) id <CDVCommandDelegate> commandDelegate;
 
 @property (readonly, assign) BOOL hasPendingOperation;

http://git-wip-us.apache.org/repos/asf/cordova-osx/blob/a2fca6e6/CordovaMac/CordovaLib/Commands/Utils/NSData+Base64.h
----------------------------------------------------------------------
diff --git a/CordovaMac/CordovaLib/Commands/Utils/NSData+Base64.h b/CordovaMac/CordovaLib/Commands/Utils/NSData+Base64.h
deleted file mode 100644
index ffe9c83..0000000
--- a/CordovaMac/CordovaLib/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/a2fca6e6/CordovaMac/CordovaLib/Commands/Utils/NSData+Base64.m
----------------------------------------------------------------------
diff --git a/CordovaMac/CordovaLib/Commands/Utils/NSData+Base64.m b/CordovaMac/CordovaLib/Commands/Utils/NSData+Base64.m
deleted file mode 100644
index 08c801b..0000000
--- a/CordovaMac/CordovaLib/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/a2fca6e6/CordovaMac/CordovaLib/Commands/Utils/NSMutableArray+QueueAdditions.h
----------------------------------------------------------------------
diff --git a/CordovaMac/CordovaLib/Commands/Utils/NSMutableArray+QueueAdditions.h b/CordovaMac/CordovaLib/Commands/Utils/NSMutableArray+QueueAdditions.h
deleted file mode 100644
index 3194094..0000000
--- a/CordovaMac/CordovaLib/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/a2fca6e6/CordovaMac/CordovaLib/Commands/Utils/NSMutableArray+QueueAdditions.m
----------------------------------------------------------------------
diff --git a/CordovaMac/CordovaLib/Commands/Utils/NSMutableArray+QueueAdditions.m b/CordovaMac/CordovaLib/Commands/Utils/NSMutableArray+QueueAdditions.m
deleted file mode 100644
index 9e67ede..0000000
--- a/CordovaMac/CordovaLib/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/a2fca6e6/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/a2fca6e6/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/a2fca6e6/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/a2fca6e6/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/a2fca6e6/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/a2fca6e6/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/a2fca6e6/CordovaMac/CordovaMac.xcodeproj/project.pbxproj
----------------------------------------------------------------------
diff --git a/CordovaMac/CordovaMac.xcodeproj/project.pbxproj b/CordovaMac/CordovaMac.xcodeproj/project.pbxproj
index 394db70..a5a0388 100644
--- a/CordovaMac/CordovaMac.xcodeproj/project.pbxproj
+++ b/CordovaMac/CordovaMac.xcodeproj/project.pbxproj
@@ -13,13 +13,10 @@
 		48B43538152E5E6B00906A36 /* www in Resources */ = {isa = PBXBuildFile; fileRef = 48B43537152E5E6B00906A36 /* www */; };
 		7E608F2B16E7D9B00018F512 /* config.xml in Resources */ = {isa = PBXBuildFile; fileRef = 7E608F2A16E7D9B00018F512 /* config.xml */; };
 		7E608F3C16E7EE8D0018F512 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 7E608F3416E7EE8D0018F512 /* AppDelegate.m */; };
-		7E608F3D16E7EE8D0018F512 /* ContentView.m in Sources */ = {isa = PBXBuildFile; fileRef = 7E608F3716E7EE8D0018F512 /* ContentView.m */; };
-		7E608F3E16E7EE8D0018F512 /* Utils.m in Sources */ = {isa = PBXBuildFile; fileRef = 7E608F3916E7EE8D0018F512 /* Utils.m */; };
-		7E608F3F16E7EE8D0018F512 /* WebViewDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 7E608F3B16E7EE8D0018F512 /* WebViewDelegate.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 /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = 7E608F4616E7EE970018F512 /* MainMenu.xib */; };
+		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 */; };
@@ -32,8 +29,12 @@
 		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 */; };
-		7E608F7B16E7EEA60018F512 /* NSData+Base64.m in Sources */ = {isa = PBXBuildFile; fileRef = 7E608F6C16E7EEA60018F512 /* NSData+Base64.m */; };
-		7E608F7C16E7EEA60018F512 /* NSMutableArray+QueueAdditions.m in Sources */ = {isa = PBXBuildFile; fileRef = 7E608F6E16E7EEA60018F512 /* NSMutableArray+QueueAdditions.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 */
 
@@ -51,16 +52,10 @@
 		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>"; };
-		7E608F3616E7EE8D0018F512 /* ContentView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ContentView.h; sourceTree = "<group>"; };
-		7E608F3716E7EE8D0018F512 /* ContentView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ContentView.m; sourceTree = "<group>"; };
-		7E608F3816E7EE8D0018F512 /* Utils.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Utils.h; sourceTree = "<group>"; };
-		7E608F3916E7EE8D0018F512 /* Utils.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Utils.m; sourceTree = "<group>"; };
-		7E608F3A16E7EE8D0018F512 /* WebViewDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebViewDelegate.h; sourceTree = "<group>"; };
-		7E608F3B16E7EE8D0018F512 /* WebViewDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = WebViewDelegate.m; 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/MainMenu.xib; 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>"; };
@@ -89,10 +84,19 @@
 		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>"; };
-		7E608F6B16E7EEA60018F512 /* NSData+Base64.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSData+Base64.h"; sourceTree = "<group>"; };
-		7E608F6C16E7EEA60018F512 /* NSData+Base64.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSData+Base64.m"; sourceTree = "<group>"; };
-		7E608F6D16E7EEA60018F512 /* NSMutableArray+QueueAdditions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSMutableArray+QueueAdditions.h"; sourceTree = "<group>"; };
-		7E608F6E16E7EEA60018F512 /* NSMutableArray+QueueAdditions.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSMutableArray+QueueAdditions.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 */
 
@@ -165,15 +169,12 @@
 		7E608F3216E7EE8D0018F512 /* Classes */ = {
 			isa = PBXGroup;
 			children = (
+				7E608F4616E7EE970018F512 /* MainViewController.xib */,
 				7E608F3316E7EE8D0018F512 /* AppDelegate.h */,
 				7E608F3416E7EE8D0018F512 /* AppDelegate.m */,
 				7E608F3516E7EE8D0018F512 /* Constants.h */,
-				7E608F3616E7EE8D0018F512 /* ContentView.h */,
-				7E608F3716E7EE8D0018F512 /* ContentView.m */,
-				7E608F3816E7EE8D0018F512 /* Utils.h */,
-				7E608F3916E7EE8D0018F512 /* Utils.m */,
-				7E608F3A16E7EE8D0018F512 /* WebViewDelegate.h */,
-				7E608F3B16E7EE8D0018F512 /* WebViewDelegate.m */,
+				7E608F8016E7F0880018F512 /* MainViewController.h */,
+				7E608F8116E7F0880018F512 /* MainViewController.m */,
 			);
 			name = Classes;
 			path = CordovaMac/Classes;
@@ -182,10 +183,10 @@
 		7E608F4016E7EE970018F512 /* Resources */ = {
 			isa = PBXGroup;
 			children = (
+				7E608F8316E7F6940018F512 /* CordovaMac-Info.plist */,
 				7E608F4116E7EE970018F512 /* Cordova.icns */,
 				7E608F4216E7EE970018F512 /* Credits.rtf */,
 				7E608F4416E7EE970018F512 /* InfoPlist.strings */,
-				7E608F4616E7EE970018F512 /* MainMenu.xib */,
 			);
 			name = Resources;
 			path = CordovaMac/Resources;
@@ -194,9 +195,14 @@
 		7E608F4C16E7EEA60018F512 /* CordovaLib */ = {
 			isa = PBXGroup;
 			children = (
+				7E608F8816E7FC990018F512 /* Utils */,
+				7E608F4F16E7EEA60018F512 /* Commands */,
+				7E608F8516E7F9D80018F512 /* CDVWebViewDelegate.h */,
+				7E608F8616E7F9D80018F512 /* CDVWebViewDelegate.m */,
 				7E608F4D16E7EEA60018F512 /* CDVBridge.h */,
 				7E608F4E16E7EEA60018F512 /* CDVBridge.m */,
-				7E608F4F16E7EEA60018F512 /* Commands */,
+				7E608F7D16E7F0320018F512 /* CDVViewController.h */,
+				7E608F7E16E7F0320018F512 /* CDVViewController.m */,
 			);
 			path = CordovaLib;
 			sourceTree = "<group>";
@@ -230,18 +236,19 @@
 				7E608F6716E7EEA60018F512 /* CDVPluginResult.m */,
 				7E608F6816E7EEA60018F512 /* CDVReachability.h */,
 				7E608F6916E7EEA60018F512 /* CDVReachability.m */,
-				7E608F6A16E7EEA60018F512 /* Utils */,
 			);
 			path = Commands;
 			sourceTree = "<group>";
 		};
-		7E608F6A16E7EEA60018F512 /* Utils */ = {
+		7E608F8816E7FC990018F512 /* Utils */ = {
 			isa = PBXGroup;
 			children = (
-				7E608F6B16E7EEA60018F512 /* NSData+Base64.h */,
-				7E608F6C16E7EEA60018F512 /* NSData+Base64.m */,
-				7E608F6D16E7EEA60018F512 /* NSMutableArray+QueueAdditions.h */,
-				7E608F6E16E7EEA60018F512 /* NSMutableArray+QueueAdditions.m */,
+				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>";
@@ -303,7 +310,7 @@
 				7E608F4816E7EE970018F512 /* Cordova.icns in Resources */,
 				7E608F4916E7EE970018F512 /* Credits.rtf in Resources */,
 				7E608F4A16E7EE970018F512 /* InfoPlist.strings in Resources */,
-				7E608F4B16E7EE970018F512 /* MainMenu.xib in Resources */,
+				7E608F4B16E7EE970018F512 /* MainViewController.xib in Resources */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};
@@ -316,9 +323,6 @@
 			files = (
 				48B43525152E5E3500906A36 /* main.m in Sources */,
 				7E608F3C16E7EE8D0018F512 /* AppDelegate.m in Sources */,
-				7E608F3D16E7EE8D0018F512 /* ContentView.m in Sources */,
-				7E608F3E16E7EE8D0018F512 /* Utils.m in Sources */,
-				7E608F3F16E7EE8D0018F512 /* WebViewDelegate.m in Sources */,
 				7E608F6F16E7EEA60018F512 /* CDVBridge.m in Sources */,
 				7E608F7016E7EEA60018F512 /* CDVCommandDelegateImpl.m in Sources */,
 				7E608F7116E7EEA60018F512 /* CDVCommandQueue.m in Sources */,
@@ -331,8 +335,12 @@
 				7E608F7816E7EEA60018F512 /* CDVPlugin.m in Sources */,
 				7E608F7916E7EEA60018F512 /* CDVPluginResult.m in Sources */,
 				7E608F7A16E7EEA60018F512 /* CDVReachability.m in Sources */,
-				7E608F7B16E7EEA60018F512 /* NSData+Base64.m in Sources */,
-				7E608F7C16E7EEA60018F512 /* NSMutableArray+QueueAdditions.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;
 		};
@@ -355,12 +363,13 @@
 			name = InfoPlist.strings;
 			sourceTree = "<group>";
 		};
-		7E608F4616E7EE970018F512 /* MainMenu.xib */ = {
+		7E608F4616E7EE970018F512 /* MainViewController.xib */ = {
 			isa = PBXVariantGroup;
 			children = (
 				7E608F4716E7EE970018F512 /* en */,
 			);
-			name = MainMenu.xib;
+			name = MainViewController.xib;
+			path = ../Resources;
 			sourceTree = "<group>";
 		};
 /* End PBXVariantGroup section */

http://git-wip-us.apache.org/repos/asf/cordova-osx/blob/a2fca6e6/CordovaMac/CordovaMac/Classes/AppDelegate.h
----------------------------------------------------------------------
diff --git a/CordovaMac/CordovaMac/Classes/AppDelegate.h b/CordovaMac/CordovaMac/Classes/AppDelegate.h
index ccd218f..4c2a0eb 100644
--- a/CordovaMac/CordovaMac/Classes/AppDelegate.h
+++ b/CordovaMac/CordovaMac/Classes/AppDelegate.h
@@ -18,15 +18,15 @@
  */
 
 #import <Cocoa/Cocoa.h>
-#import "ContentView.h"
+#import "CDVViewController.h"
 
 @interface AppDelegate : NSObject <NSApplicationDelegate> {
 
 	IBOutlet NSWindow* window;
-	IBOutlet ContentView* contentView;
 }
 
-@property (nonatomic, strong) NSWindow* window;
-@property (nonatomic, strong) ContentView* contentView;
+@property (nonatomic, strong) IBOutlet NSWindow* window;
+@property (nonatomic, strong) IBOutlet CDVViewController* viewController;
+
 
 @end

http://git-wip-us.apache.org/repos/asf/cordova-osx/blob/a2fca6e6/CordovaMac/CordovaMac/Classes/AppDelegate.m
----------------------------------------------------------------------
diff --git a/CordovaMac/CordovaMac/Classes/AppDelegate.m b/CordovaMac/CordovaMac/Classes/AppDelegate.m
index ff7f06f..66a762e 100644
--- a/CordovaMac/CordovaMac/Classes/AppDelegate.m
+++ b/CordovaMac/CordovaMac/Classes/AppDelegate.m
@@ -18,11 +18,20 @@
  */
 
 #import "AppDelegate.h"
+#import "Constants.h"
+#import "MainViewController.h"
+#import "CDVUtils.h"
 
 @implementation AppDelegate
 
 
-@synthesize window, contentView;
+@synthesize window;
+
+- (id)init
+{
+    self = [super init];
+    return self;
+}
 
 - (void) applicationDidStartLaunching:(NSNotification*) aNotification 
 {
@@ -30,20 +39,15 @@
 
 - (void) applicationWillFinishLaunching:(NSNotification*)aNotification
 {
-    [[NSNotificationCenter defaultCenter] addObserver:self.contentView 
-                                             selector:@selector(windowResized:) 
-                                                 name:NSWindowDidResizeNotification 
-                                               object:[self window]];
-
-    NSURL* fileUrl = [NSURL fileURLWithPath:[[Utils sharedInstance] pathForResource:kCDVStartPage]];
-        
-    [self.contentView.webView setMainFrameURL:[fileUrl description]];
 }
 
 - (void) applicationDidFinishLaunching:(NSNotification*)aNotification 
 {
-    self.contentView.webView.alphaValue = 1.0;
-    self.contentView.alphaValue = 1.0;
+    [[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/a2fca6e6/CordovaMac/CordovaMac/Classes/ContentView.h
----------------------------------------------------------------------
diff --git a/CordovaMac/CordovaMac/Classes/ContentView.h b/CordovaMac/CordovaMac/Classes/ContentView.h
deleted file mode 100644
index d4e30b3..0000000
--- a/CordovaMac/CordovaMac/Classes/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/a2fca6e6/CordovaMac/CordovaMac/Classes/ContentView.m
----------------------------------------------------------------------
diff --git a/CordovaMac/CordovaMac/Classes/ContentView.m b/CordovaMac/CordovaMac/Classes/ContentView.m
deleted file mode 100644
index 0ec6ce9..0000000
--- a/CordovaMac/CordovaMac/Classes/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/a2fca6e6/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/a2fca6e6/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
+


Mime
View raw message