Merge remote-tracking branch 'cappuccino/master'

This commit is contained in:
daboe01 committed 2016-07-24 16:44:00 +02:00
commit 8bf9f8057e
48 files changed
+193 -4833

No files matched your search

+53 -37
View File
@@ -172,6 +172,7 @@ var CPViewHighDPIDrawingEnabled = YES;
CPArray _registeredDraggedTypesArray;
BOOL _isHidden;
BOOL _isHiddenOrHasHiddenAncestor;
BOOL _hitTests;
BOOL _clipsToBounds;
@@ -372,6 +373,7 @@ var CPViewHighDPIDrawingEnabled = YES;
_opacity = 1.0;
_isHidden = NO;
_isHiddenOrHasHiddenAncestor = NO;
_hitTests = YES;
_hierarchyScaleSize = CGSizeMake(1.0 , 1.0);
@@ -598,7 +600,7 @@ var CPViewHighDPIDrawingEnabled = YES;
[aSubview _removeFromSuperview];
// Set ourselves as the superview.
aSubview._superview = self;
[aSubview _setSuperview:self];
}
if (anIndex === CPNotFound || anIndex >= count)
@@ -623,11 +625,6 @@ var CPViewHighDPIDrawingEnabled = YES;
[aSubview setNextResponder:self];
[aSubview _scaleSizeUnitSquareToSize:[self _hierarchyScaleSize]];
// If the subview is not hidden and one of its ancestors is hidden,
// notify the subview that it is now hidden.
if (![aSubview isHidden] && [self isHiddenOrHasHiddenAncestor])
[aSubview _notifyViewDidHide];
[aSubview viewDidMoveToSuperview];
// Set the subview's window to our own.
@@ -697,13 +694,10 @@ var CPViewHighDPIDrawingEnabled = YES;
// If the view is not hidden and one of its ancestors is hidden,
// notify the view that it is now unhidden.
if (!_isHidden && [_superview isHiddenOrHasHiddenAncestor])
[self _notifyViewDidUnhide];
[self _setSuperview:nil];
[self _notifyWindowDidResignKey];
[self _notifyViewDidResignFirstResponder];
_superview = nil;
}
/*!
@@ -1599,10 +1593,8 @@ var CPViewHighDPIDrawingEnabled = YES;
// FIXME: Should we return to visibility? This breaks in FireFox, Opera, and IE.
// _DOMElement.style.visibility = (_isHidden = aFlag) ? "hidden" : "visible";
_isHidden = aFlag;
#if PLATFORM(DOM)
_DOMElement.style.display = _isHidden ? "none" : "block";
_DOMElement.style.display = aFlag ? "none" : "block";
#endif
if (aFlag)
@@ -1622,33 +1614,61 @@ var CPViewHighDPIDrawingEnabled = YES;
while (view = [view superview]);
}
[self _notifyViewDidHide];
[self _recursiveGainedHiddenAncestor];
}
else
{
[self setNeedsDisplay:YES];
[self _notifyViewDidUnhide];
[self _recursiveLostHiddenAncestor];
}
_isHidden = aFlag;
}
- (void)_notifyViewDidHide
- (void)_setSuperview:(CPView)aSuperview
{
[self viewDidHide];
var hasOldSuperview = (_superview !== nil),
hasNewSuperview = (aSuperview !== nil),
oldSuperviewIsHidden = hasOldSuperview && [_superview isHiddenOrHasHiddenAncestor],
newSuperviewIsHidden = hasNewSuperview && [aSuperview isHiddenOrHasHiddenAncestor];
var count = [_subviews count];
if (!newSuperviewIsHidden && oldSuperviewIsHidden)
[self _recursiveLostHiddenAncestor];
while (count--)
[_subviews[count] _notifyViewDidHide];
if (newSuperviewIsHidden && !oldSuperviewIsHidden)
[self _recursiveGainedHiddenAncestor];
_superview = aSuperview;
}
- (void)_notifyViewDidUnhide
- (void)_recursiveLostHiddenAncestor
{
[self viewDidUnhide];
if (_isHiddenOrHasHiddenAncestor)
{
_isHiddenOrHasHiddenAncestor = NO;
[self viewDidUnhide];
}
var count = [_subviews count];
[_subviews enumerateObjectsUsingBlock:function(view, idx, stop)
{
[view _recursiveLostHiddenAncestor];
}];
}
while (count--)
[_subviews[count] _notifyViewDidUnhide];
- (void)_recursiveGainedHiddenAncestor
{
if (!_isHidden)
{
[self viewDidHide];
}
_isHiddenOrHasHiddenAncestor = YES;
[_subviews enumerateObjectsUsingBlock:function(view, idx, stop)
{
[view _recursiveGainedHiddenAncestor];
}];
}
/*!
@@ -1718,12 +1738,7 @@ var CPViewHighDPIDrawingEnabled = YES;
*/
- (BOOL)isHiddenOrHasHiddenAncestor
{
var view = self;
while (view && ![view isHidden])
view = [view superview];
return view !== nil;
return _isHiddenOrHasHiddenAncestor;
}
/*!
@@ -3494,14 +3509,14 @@ setBoundsOrigin:
Invoked automatically when the view’s geometry changes such that its tracking areas need to be recalculated.
You should override this method to remove out of date tracking areas and add recomputed tracking areas;
Cocoa calls this on every view, whereas they have tracking area(s) or not.
Cappuccino behaves differently :
- updateTrackingAreas is called when placing a view in the view hierarchy (that is in a window)
- if you have only CPTrackingInVisibleRect tracking areas attached to a view, it will not be called again (until you move the view in the hierarchy)
- if you have at least one non-CPTrackingInVisibleRect tracking area attached, it will be called every time the view geometry could be modified
You don't have to touch to CPTrackingInVisibleRect tracking areas, they will be automatically updated
Please note that it is the owner of a tracking area who is called for updateTrackingAreas.
But, if a view without any tracking area is inserted in the view hierarchy (that is, in a window), the view is called for updateTrackingAreas.
This enables you to use updateTrackingArea to initially attach your tracking areas to the view.
@@ -3513,16 +3528,16 @@ setBoundsOrigin:
/*!
This utility method is intended for CPView subclasses overriding updateTrackingAreas
Typical use would be :
- (void)updateTrackingAreas
{
[self removeAllTrackingAreas];
... add your specific updated tracking areas ...
}
*/
- (void)removeAllTrackingAreas
{
@@ -3707,6 +3722,7 @@ var CPViewAutoresizingMaskKey = @"CPViewAutoresizingMask",
#endif
[self setHidden:[aCoder decodeBoolForKey:CPViewIsHiddenKey]];
_isHiddenOrHasHiddenAncestor = NO;
if ([aCoder containsValueForKey:CPViewOpacityKey])
[self setAlphaValue:[aCoder decodeIntForKey:CPViewOpacityKey]];
+1 -2
View File
@@ -308,7 +308,7 @@ CPTexturedBackgroundWindowMask
[self setPlatformWindow:[CPPlatformWindow primaryPlatformWindow]];
else
{
// give zero sized borderless bridge windows a default size if we're not in the browser so they show up in NativeHost.
// give zero sized borderless bridge windows a default size.
if ((aStyleMask & CPBorderlessBridgeWindowMask) && aContentRect.size.width === 0 && aContentRect.size.height === 0)
{
var visibleFrame = [[[CPScreen alloc] init] visibleFrame];
@@ -655,7 +655,6 @@ CPTexturedBackgroundWindowMask
CPBorderlessWindowMask
CPTitledWindowMask
CPClosableWindowMask
CPMiniaturizableWindowMask (NOTE: only available in NativeHost)
CPResizableWindowMask
CPTexturedBackgroundWindowMask
CPBorderlessBridgeWindowMask
-70
View File
@@ -1,70 +0,0 @@
var FILE = require("file");
var OS = require("os");
var NATIVEHOST_SOURCE = FILE.path(module.path).dirname().dirname().dirname().join("support", "NativeHost.app");
exports.buildNativeHost = function(rootPath, buildNative, options) {
options = options || {};
options.index = options.index || "index.html";
rootPath = FILE.path(rootPath);
buildNative = FILE.path(buildNative);
if (buildNative.exists())
buildNative.rmtree();
buildNative.dirname().mkdirs();
// FIXME: Narwhal doesn't preserve permissions
// FILE.copyTree(NATIVEHOST_SOURCE, buildNative);
OS.system(["cp", "-r", NATIVEHOST_SOURCE, buildNative]);
FILE.chmod(buildNative.join("Contents", "MacOS", "NativeHost"), 0755);
var rootBaseName = rootPath.basename();
var buildClientDirectory = buildNative.join("Contents", "Resources", rootBaseName);
FILE.mkdirs(FILE.dirname(buildClientDirectory));
// FILE.copyTree(rootPath, buildClientDirectory);
OS.system(["cp", "-r", rootPath, buildClientDirectory]);
var defaultBundleName = buildNative.basename().match(/^(.*)(\.app)?$/)[1];
function mergePlist(plist, path) {
var otherPlist = CFPropertyList.readPropertyListFromFile(String(path));
otherPlist.keys().forEach(function(key) {
var value = otherPlist.valueForKey(key);
plist.setValueForKey(key, value);
if (key === "CPBundleName")
plist.setValueForKey("CFBundleName", value);
if (key === "CFBundleIconFile") {
var iconPath = rootPath.join("Resources", value);
if (iconPath.isFile())
iconPath.copy(buildNative.join("Contents", "Resources", value));
else
print("Warning: CFBundleIconFile references " + value + " but does not exist in the resources directory.");
}
if (key === "CFBundleExecutable") {
buildNative.join("Contents", "MacOS", "NativeHost").rename(value);
// FIXME:
FILE.chmod(buildNative.join("Contents", "MacOS", value), 0755);
}
});
}
CFPropertyList.modifyPlist(buildNative.join("Contents", "Info.plist"), function(plist) {
plist.setValueForKey("CFBundleName", defaultBundleName);
plist.setValueForKey("NHInitialResource", FILE.join(rootBaseName, options.index));
// merge Cappuccino plist
var cappPlistPath = rootPath.join("Info.plist");
if (cappPlistPath.isFile())
mergePlist(plist, cappPlistPath);
if (options.extraPlistPath)
mergePlist(plist, options.extraPlistPath);
});
}
+137 -28
View File
@@ -895,70 +895,167 @@ var updateTrackingAreasCalls,
[self assert:nil equals:[view effectiveAppearance]];
}
- (void)testViewDidHideDidUnhide
{
var expectedResult = [@"viewDidHide_view1", @"viewDidUnhide_view1"];
[view1 setHidden:YES];
[view1 setHidden:NO];
[self assert:expectedResult equals:methodCalled];
}
- (void)testViewGainedHiddenAncestor
{
var expectedResult = [@"viewDidHide_view1",
@"viewWillMoveToSuperview_view3",
@"viewDidMoveToSuperview_view3",
@"viewWillMoveToSuperview_view2",
@"viewDidHide_view2",
@"viewDidHide_view3",
@"viewDidMoveToSuperview_view2"];
[view1 setHidden:YES];
[view2 addSubview:view3];
[view1 addSubview:view2];
[self assert:expectedResult equals:methodCalled];
[self assertTrue: [view2 isHiddenOrHasHiddenAncestor] message:@"Expected isHiddenOrHasHiddenAncestor = YES"];
[self assertTrue: [view3 isHiddenOrHasHiddenAncestor] message:@"Expected isHiddenOrHasHiddenAncestor = YES"];
[self assertFalse:[view2 isHidden]];
[self assertFalse:[view3 isHidden]];
}
- (void)testRemoveViewsHiddenByAncestor
{
var expectedResult = @[
@"viewWillMoveToSuperview_view2",
@"viewDidUnhide_view2",
@"viewDidUnhide_view3",
@"viewDidMoveToSuperview_view2",
@"viewWillMoveToWindow_view2",
@"viewWillMoveToWindow_view3",
@"viewDidMoveToWindow_view3",
@"viewDidMoveToWindow_view2"
];
[view1 setHidden:YES];
[view1 addSubview:view2];
[view2 addSubview:view3];
[self assertTrue: [view2 isHiddenOrHasHiddenAncestor] message:@"Expected isHiddenOrHasHiddenAncestor = YES" ];
[self assertFalse:[view2 isHidden]];
[self assertTrue: [view3 isHiddenOrHasHiddenAncestor] message:@"Expected isHiddenOrHasHiddenAncestor = YES" ];
[self assertFalse:[view3 isHidden]];
methodCalled = [];
[view2 removeFromSuperview];
[self assertFalse: [view2 isHiddenOrHasHiddenAncestor] message:@"Expected isHiddenOrHasHiddenAncestor = NO" ];
[self assertFalse: [view3 isHiddenOrHasHiddenAncestor] message:@"Expected isHiddenOrHasHiddenAncestor = NO" ];
[self assert:expectedResult equals:methodCalled];
}
- (void)testRemoveHiddenView
{
var expectedResult = [@"viewWillMoveToSuperview_view2", @"viewDidMoveToSuperview_view2", @"viewWillMoveToWindow_view2", @"viewDidMoveToWindow_view2"];
[view1 addSubview:view2];
[view2 setHidden:YES];
methodCalled = [];
[view2 removeFromSuperview];
[self assertTrue: [view2 isHiddenOrHasHiddenAncestor] message:@"Expected isHiddenOrHasHiddenAncestor = YES" ];
[self assert:expectedResult equals:methodCalled];
}
- (void)testLostHiddenAncestorAfterMovingToNewSuperview
{
var expectedResult = @[
@"viewWillMoveToSuperview_view2",
@"viewDidMoveToSuperview_view2",
@"viewDidHide_view1",
@"viewDidHide_view2",
@"viewWillMoveToSuperview_view2",
@"viewDidUnhide_view2",
@"viewDidMoveToSuperview_view2"
];
[view1 addSubview:view2];
[view1 setHidden:YES];
[view3 addSubview:view2];
[self assert:expectedResult equals:methodCalled];
}
// TrackingAreaAdditions
- (void)testTrackingAreas
{
var trackingArea = [[CPTrackingArea alloc] initWithRect:CGRectMakeZero() options:CPTrackingMouseEnteredAndExited | CPTrackingActiveInKeyWindow | CPTrackingInVisibleRect owner:self userInfo:nil];
[self assert:0 equals:[[view trackingAreas] count] message:@"Initially, a view has no tracking area"];
//
[view addTrackingArea:trackingArea];
[self assert:1 equals:[[view trackingAreas] count] message:@"After adding a tracking area"];
[self assert:view equals:[trackingArea view] message:@"Tracking area should be linked to view"];
//
[view removeTrackingArea:trackingArea];
[self assert:0 equals:[[view trackingAreas] count] message:@"After removing the only tracking area"];
[self assert:nil equals:[trackingArea view] message:@"Tracking area should be unlinked"];
//
[view addTrackingArea:trackingArea];
[view addTrackingArea:trackingArea];
[view addTrackingArea:trackingArea];
[self assert:1 equals:[[view trackingAreas] count] message:@"Adding the same tracking area multiple times should add it once"];
[self assert:view equals:[trackingArea view] message:@"Tracking area should be linked to view"];
var trackingArea2 = [[CPTrackingArea alloc] initWithRect:CGRectMakeZero() options:CPTrackingMouseEnteredAndExited | CPTrackingActiveInKeyWindow owner:self userInfo:nil];
//
[view addTrackingArea:trackingArea2];
[self assert:2 equals:[[view trackingAreas] count] message:@"After adding a second tracking area"];
[self assert:view equals:[trackingArea2 view] message:@"Tracking area should be linked to view"];
//
[view removeAllTrackingAreas];
[self assert:0 equals:[[view trackingAreas] count] message:@"After removing all tracking areas"];
[self assert:nil equals:[trackingArea view] message:@"Tracking area should be unlinked"];
[self assert:nil equals:[trackingArea2 view] message:@"Tracking area should be unlinked"];
//
[view addTrackingArea:trackingArea];
var contentView = [window contentView];
[contentView addSubview:view];
[self assert:0 equals:updateTrackingAreasCalls message:@"Putting a view with a CPTrackingAreaInVisibleRect in a window should not call updateTrackingAreas"];
[view removeFromSuperview];
//
[view addTrackingArea:trackingArea2];
[contentView addSubview:view];
[self assert:1 equals:updateTrackingAreasCalls message:@"Putting a view with a non CPTrackingAreaInVisibleRect in a window should call updateTrackingAreas"];
[view removeAllTrackingAreas];
//
var viewTA = [[CPTrackingAreaView alloc] initWithFrame:CGRectMakeZero()];
updateTrackingAreasCalls = 0;
@@ -966,17 +1063,17 @@ var updateTrackingAreasCalls,
[self assert:1 equals:updateTrackingAreasCalls message:@"Putting a view with no tracking areas in a window should call updateTrackingAreas"];
//
updateTrackingAreasCalls = 0;
[viewTA addTrackingArea:trackingArea];
[viewTA setFrame:CGRectMake(10, 10, 10, 10)];
[self assert:0 equals:updateTrackingAreasCalls message:@"Changing geometry of a view with a CPTrackingAreaInVisibleRect should not call updateTrackingAreas"];
//
updateTrackingAreasCalls = 0;
[viewTA addTrackingArea:trackingArea2];
[viewTA setFrame:CGRectMake(20, 20, 20, 20)];
[self assert:1 equals:updateTrackingAreasCalls message:@"Changing geometry of a view with a non CPTrackingAreaInVisibleRect should call updateTrackingAreas"];
@@ -1048,7 +1145,7 @@ var updateTrackingAreasCalls,
[viewTA removeAllTrackingAreas];
[viewTA addTrackingArea:trackingAreaAllWithDrag];
// Mouse enters the tracking area while dragging (option set)
[self moveMouseAtPoint:CGPointMake(21, 21) dragging:YES];
@@ -1103,7 +1200,7 @@ var updateTrackingAreasCalls,
[self assert:0 equals:mouseExitedCalls message:@"Mouse entering inner tracking area should not call mouseExited"];
[self assert:1 equals:mouseMovedCalls message:@"Mouse entering inner tracking area should call mouseMoved"];
[self assert:1 equals:cursorUpdateCalls message:@"Mouse entering inner tracking area should call cursorUpdate"];
// Mouse moves in inner view
[self moveMouseAtPoint:CGPointMake(27, 27) dragging:NO];
@@ -1112,7 +1209,7 @@ var updateTrackingAreasCalls,
[self assert:0 equals:mouseExitedCalls message:@"Mouse moving in inner tracking area should not call mouseExited"];
[self assert:2 equals:mouseMovedCalls message:@"Mouse moving in inner tracking area should call mouseMoved for both views"];
[self assert:0 equals:cursorUpdateCalls message:@"Mouse moving in inner tracking area should not call cursorUpdate"];
// Mouse leaves inner view but remains in outer view
[self moveMouseAtPoint:CGPointMake(36, 36) dragging:NO];
@@ -1121,7 +1218,7 @@ var updateTrackingAreasCalls,
[self assert:1 equals:mouseExitedCalls message:@"Mouse moving from inner to outer tracking area should call mouseExited (for inner)"];
[self assert:1 equals:mouseMovedCalls message:@"Mouse moving from inner to outer tracking area should call mouseMoved (for outer)"];
[self assert:1 equals:cursorUpdateCalls message:@"Mouse moving from inner to outer tracking area should call cursorUpdate (for outer)"];
[self assert:innerViewTA equals:involvedViewForMouseExited message:@"Inner view should receive mouseExited"];
[self assert:viewTA equals:involvedViewForCursorUpdate message:@"Outer view should receive cursorUpdate"];
@@ -1278,7 +1375,7 @@ var updateTrackingAreasCalls,
[self mouseUpAtPoint:CGPointMake(10, 10)];
[self assert:[CPCursor arrowCursor] equals:[CPCursor currentCursor] message:@"Step 1.7 : cursor should be an arrow"];
//
[self moveMouseAtPoint:CGPointMake(1, 1) dragging:NO];
@@ -1292,7 +1389,7 @@ var updateTrackingAreasCalls,
[self moveMouseAtPoint:CGPointMake(5, 5) dragging:NO];
[self assert:[CPCursor arrowCursor] equals:[CPCursor currentCursor] message:@"Step 2.1 : cursor should be an arrow"];
// Step 2.2 : inside the superview / outside the subview
[self moveMouseAtPoint:CGPointMake(15, 15) dragging:NO];
@@ -1310,7 +1407,7 @@ var updateTrackingAreasCalls,
[self moveMouseAtPoint:CGPointMake(15, 15) dragging:NO];
[self assert:[CPCursor crosshairCursor] equals:[CPCursor currentCursor] message:@"Step 2.4 : cursor should be a crosshair"];
// Step 2.5 : outside the superview
[self moveMouseAtPoint:CGPointMake(5, 5) dragging:NO];
@@ -1355,14 +1452,14 @@ var updateTrackingAreasCalls,
[self moveMouseAtPoint:CGPointMake(5, 5) dragging:NO];
[self assert:[CPCursor arrowCursor] equals:[CPCursor currentCursor] message:@"Step 3.5 : cursor should be an arrow"];
}
- (void)testTrackingAreasLiveViewHierarchyModification
{
// 1. viewB inside viewA with mouseEntered removing itself
var viewA = [[CPTrackingAreaViewWithCursorUpdate alloc] initWithFrame:CGRectMake(20, 20, 40, 40)]
var viewA = [[CPTrackingAreaViewWithCursorUpdate alloc] initWithFrame:CGRectMake(20, 20, 40, 40)],
viewB = [[CPTrackingAreaViewLiveRemoval alloc] initWithFrame:CGRectMake(10, 10, 20, 20)];
[[window contentView] setSubviews:[CPArray arrayWithObject:viewA]];
@@ -1691,6 +1788,18 @@ var updateTrackingAreasCalls,
[methodCalled addObject:string];
}
- (void)viewDidUnhide
{
var string = _cmd + @"_" + [self identifier];
[methodCalled addObject:string];
}
- (void)viewDidHide
{
var string = _cmd + @"_" + [self identifier];
[methodCalled addObject:string];
}
- (BOOL)acceptsFirstResponder
{
return YES;
@@ -142,7 +142,7 @@
[_menuItemView setDirty];
}
// Performs autoenable processing, returns isEnabled to propagate state to NativeHost
// Performs autoenable processing, returns isEnabled to propagate state
- (BOOL)_performAutoenable
{
if ([_menu autoenablesItems])
@@ -162,7 +162,7 @@
}
else
{
// XXX: will toggle state as part of _target check, required to sync stane with NativeHost
// XXX: will toggle state as part of _target check
_isEnabled = isEnabled;
[_menuItemView setDirty];
-5
View File
@@ -1,5 +0,0 @@
.DS_Store
*.mode1v3
*.pbxuser
*.perspectivev3
build
-33
View File
@@ -1,33 +0,0 @@
//
// AppController+MainMenu.m
// NativeHost
//
// Created by Francisco Tolmasky on 9/2/09.
// Copyright 2009 280 North, Inc.. All rights reserved.
//
#import <WebKit/WebKit.h>
#import "MenuBridge.h"
#import "AppController.h"
@interface NSApplication (MenuMethods)
- (void)setAppleMenu:(NSMenu *)aMenu;
@end
@implementation AppController (MainMenu)
- (void)setMainMenuObject:(WebScriptObject *)aMenuObject
{
NSMenu * mainMenu = [[MenuBridge alloc] initWithMenuObject:aMenuObject];
[NSApp setAppleMenu:[[mainMenu itemArray] objectAtIndex:0]];
[NSApp setMainMenu:mainMenu];
[mainMenu release];
}
@end
@@ -1,26 +0,0 @@
//
// AppController+WebFrameLoadDelegate.m
// NativeHost
//
// Created by Francisco Tolmasky on 7/28/09.
// Copyright 2009 280 North, Inc.. All rights reserved.
//
#import "AppController.h"
#import "BridgedMethods.h"
@implementation AppController (WebFrameLoadDelegate)
- (void)webView:(WebView *)aWebView didClearWindowObject:(WebScriptObject *)aWindowObject forFrame:(WebFrame *)aFrame
{
if (aWebView == webView)
[GlobalMethods enhanceWindowObject:aWindowObject ofWebView:aWebView];
else
[WindowMethods enhanceWindowObject:aWindowObject ofWebView:aWebView];
}
@end
@@ -1,35 +0,0 @@
//
// AppController+WebPolicyDelegate.m
// NativeHost
//
// Created by Francisco Tolmasky on 5/11/10.
// Copyright 2010 280 North, Inc. All rights reserved.
//
#import "NSURL+Additions.h"
#import "AppController.h"
@implementation AppController (WebPolicyDelegate)
- (void)webView:(WebView *)aWebView decidePolicyForNewWindowAction:(NSDictionary *)actionInformation request:(NSURLRequest *)aRequest newFrameName:(NSString *)aFrameName decisionListener:(id /*< WebPolicyDecisionListener >*/)aListener
{
[[NSWorkspace sharedWorkspace] openURL:[actionInformation objectForKey:WebActionOriginalURLKey]];
[aListener ignore];
}
- (void)webView:(WebView *)aWebView decidePolicyForNavigationAction:(NSDictionary *)aDictionary request:(NSURLRequest *)aRequest frame:(WebFrame *)aWebFrame decisionListener:(id /*<WebPolicyDecisionListener>*/)aDecisionListener
{
NSURL * requestURL = [aRequest URL];
if([aWebView mainFrame] != aWebFrame ||
[[baseURL scheme] isEqualTo:[requestURL scheme]] &&
![baseURL host] || [[baseURL host] isEqualTo:[requestURL host]] &&
![baseURL port] || [[baseURL port] isEqualTo:[requestURL port]])
return [aDecisionListener use];
[[NSWorkspace sharedWorkspace] openURL:[aDictionary objectForKey:WebActionOriginalURLKey]];
[aDecisionListener ignore];
}
@end
@@ -1,32 +0,0 @@
//
// AppController+WebResourceLoadDelegate.m
// NativeHost
//
// Created by Francisco Tolmasky on 7/28/09.
// Copyright 2009 280 North, Inc.. All rights reserved.
//
#import "AppController.h"
#import "SSCrypto.h"
NSString *authHeader = nil;
@implementation AppController (WebResourceLoadDelegate)
- (NSURLRequest *)webView:(WebView *)aSender resource:(id)anIdentifier willSendRequest:(NSURLRequest *)aRequest redirectResponse:(NSURLResponse *)aRedirectResponse fromDataSource:(WebDataSource *)aDataSource
{
aRequest = [[aRequest mutableCopy] autorelease];
if (!authHeader)
{
NSString *plaintext = [NSString stringWithFormat:@"%@:%@", SERVER_USER, SERVER_PASSWORD];
NSData *data = [plaintext dataUsingEncoding:NSASCIIStringEncoding];
authHeader = [[NSString alloc] initWithFormat:@"Basic %@", [data encodeBase64WithNewlines:NO]];
}
[(NSMutableURLRequest *)aRequest setValue:authHeader forHTTPHeaderField:@"Authorization"];
return aRequest;
}
@end
@@ -1,71 +0,0 @@
//
// AppController+WebUIDelegate.m
// NativeHost
//
// Created by Francisco Tolmasky on 7/28/09.
// Copyright 2009 280 North, Inc.. All rights reserved.
//
#import "AppController.h"
#import "WebWindow.h"
@implementation AppController (WebUIDelegate)
- (void)webView:(WebView *)aWebView setFrame:(NSRect)aFrame
{
[[aWebView window] setFrame:aFrame display:YES];
}
- (NSRect)webViewFrame:(WebView *)aWebView
{
return [[aWebView window] frame];
}
- (WebView *)webView:(WebView *)aWebView createWebViewWithRequest:(NSURLRequest *)aRequest
{
return [[WebWindow webWindow] webView];
}
- (void)webViewClose:(WebView *)aWebView
{
// Important to call close and not:
// -performClose:, which beeps without the presence of a close button.
// -orderOut:, which doesn't release the window.
[[aWebView window] close];
//[[aWebView window] orderOut:self];
}
- (void)webViewShow:(WebView *)aWebView
{
[[aWebView window] makeKeyAndOrderFront:self];
}
- (NSAttributedString *)loggedOutput;
{
return loggedOutput;
}
- (void)webView:(WebView *)aWebView addMessageToConsole:(NSDictionary *)aDictionary
{
NSString * message = [aDictionary objectForKey:@"message"];
NSAttributedString * attributedString = [[NSAttributedString alloc] initWithString:[NSString stringWithFormat:@"%@\n", message, nil]];
[loggedOutput appendAttributedString:attributedString];
[attributedString release];
NHLog(@"CONSOLE", message);
}
- (void)webView:(WebView *)aSender runJavaScriptAlertPanelWithMessage:(NSString *)aMessage initiatedByFrame:(WebFrame *)aFrame
{
WebDataSource * dataSource = [aFrame dataSource];
NSString * title = [dataSource pageTitle];
if (![title length])
title = [[[dataSource request] URL] absoluteString];
[[NSAlert alertWithMessageText:title defaultButton:@"OK" alternateButton:nil otherButton:nil informativeTextWithFormat:@"%@", aMessage, nil] runModal];
}
@end
-54
View File
@@ -1,54 +0,0 @@
//
// AppController.h
// NativeHost
//
// Created by Francisco Tolmasky on 6/4/09.
// Copyright 2009 280 North, Inc. All rights reserved.
//
#import <Cocoa/Cocoa.h>
extern int SERVER_PORT;
extern NSString *SERVER_PASSWORD;
extern NSString *SERVER_USER;
@class Server;
@class WebScriptObject;
@interface AppController : NSObject
{
NSWindow * webViewWindow;
WebView * webView;
NSMutableArray * openingFilenames;
NSMutableArray * openingURLStrings;
Server * server;
NSFileHandle * stdinFileHandle;
NSMutableAttributedString * loggedOutput;
NSURL * baseURL;
}
- (void)configureLocalStorage;
- (NSURL *)baseURL;
- (void)startServer;
- (void)startCappuccinoApplication;
- (NSArray *)openingURLStrings;
- (NSView *)keyView;
- (WebView *)webView;
- (WebScriptObject *)windowScriptObject;
@end
@interface AppController (MainMenu)
- (void)setMainMenuObject:(WebScriptObject *)aMenuObject;
@end
void NHLog(NSString *type, NSString *message);
-221
View File
@@ -1,221 +0,0 @@
//
// AppController.m
// NativeHost
//
// Created by Francisco Tolmasky on 6/4/09.
// Copyright 2009 280 North, Inc. All rights reserved.
//
#import "Console.h"
#import "Server.h"
#import "AppController.h"
#import "NSURL+Additions.h"
#import "BridgedMethods.h"
#import "WebWindow.h"
#import "WebScripObject+Objective-J.h"
extern int interactive;
int SERVER_PORT = 9191;
NSString *SERVER_PASSWORD = nil;
NSString *SERVER_USER = nil;
@implementation AppController
- (id)init
{
self = [super init];
if (self)
openingURLStrings = [NSMutableArray new];
return self;
}
- (void)dealloc
{
[webView release];
[webViewWindow release];
[openingURLStrings release];
[super dealloc];
}
- (BOOL)application:(NSApplication *)anApplication openFile:(NSString *)aFilename
{
id canOpenFilesImmediately = [[webView windowScriptObject] evaluateWebScript:@"CPApp && CPApp._finishedLaunching"];
NSString *path = [[[NSURL fileURLWithPath:aFilename] HTTPFileSystemURL] absoluteString];
if ([canOpenFilesImmediately isKindOfClass:[NSNumber class]] && [canOpenFilesImmediately boolValue])
[[webView windowScriptObject] evaluateObjectiveJ:[NSString stringWithFormat:@"[CPApp _openURL:[CPURL URLWithString:\"%@\"]]", path]];
else
[openingURLStrings addObject:path];
return NO;
}
- (void)applicationWillFinishLaunching:(NSNotification *)aNotification
{
NSUserDefaults * defaults = [NSUserDefaults standardUserDefaults];
[defaults registerDefaults:[NSDictionary dictionaryWithObject:[NSNumber numberWithBool:YES] forKey:@"WebKitDeveloperExtras"]];
[self startServer];
}
- (void)applicationDidFinishLaunching:(NSNotification *)notification
{
[self startCappuccinoApplication];
}
- (void)applicationDidResignActive:(NSNotification *)aNotification
{
// FIXME: handle this better.
[[self windowScriptObject] evaluateObjectiveJ:@"[CPApp _willResignActive];"];
[[self windowScriptObject] evaluateObjectiveJ:@"CPApp._isActive = NO;"];
[[self windowScriptObject] evaluateObjectiveJ:@"[CPApp _didResignActive];"];
}
- (void)applicationDidBecomeActive:(NSNotification *)aNotification
{
// FIXME: handle this better.
[[self windowScriptObject] evaluateObjectiveJ:@"[CPApp _willBecomeActive];"];
[[self windowScriptObject] evaluateObjectiveJ:@"CPApp._isActive = YES;"];
[[self windowScriptObject] evaluateObjectiveJ:@"[CPApp _didBecomeActive];"];
}
- (NSArray *)openingURLStrings
{
return openingURLStrings;
}
- (NSView *)keyView
{
return [[[webView mainFrame] frameView] documentView];
}
- (WebView *)webView
{
return webView;
}
- (WebScriptObject *)windowScriptObject
{
return [webView windowScriptObject];
}
- (void)startServer
{
server = [[Server alloc] init];
if (![server start])
exit(0);
if (interactive)
{
stdinFileHandle = [[NSFileHandle fileHandleWithStandardInput] retain];
[[NSNotificationCenter defaultCenter]
addObserver:self
selector:@selector(didReadStdin:)
name:NSFileHandleReadCompletionNotification
object:stdinFileHandle];
fprintf(stdout, "objj> ");
fflush(stdout);
[stdinFileHandle readInBackgroundAndNotify];
}
}
- (void)didReadStdin:(NSNotification *)aNotification
{
NSString *string = [[NSString alloc] initWithData:[[aNotification userInfo] objectForKey:NSFileHandleNotificationDataItem] encoding:NSASCIIStringEncoding];
NSString *result = [[self windowScriptObject] evaluateObjectiveJReturningString:string];
[string release];
if ([result respondsToSelector:@selector(UTF8String)])
fprintf(stdout, "%s\n", [result UTF8String]);
fprintf(stdout, "objj> ");
fflush(stdout);
[stdinFileHandle readInBackgroundAndNotify];
}
- (NSURL *)baseURL
{
return baseURL;
}
- (void)startCappuccinoApplication
{
NSString *initialURL = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"NHInitialURL"];
BOOL prependServer = [[[NSBundle mainBundle] objectForInfoDictionaryKey:@"NHInitialURLPrependServer"] boolValue];
if (!initialURL)
{
NSString *initialResource = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"NHInitialResource"];
if (!initialResource)
initialResource = @"Application/index.html";
initialURL = [[NSString stringWithFormat:@"file://%@/%@", [[NSBundle mainBundle] resourcePath], initialResource] stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
baseURL = [[NSURL alloc] initWithString:@"file:///"];
}
else if (prependServer)
{
initialURL = [NSString stringWithFormat:@"http://127.0.0.1:%d/%@", SERVER_PORT, initialURL];
baseURL = [[NSURL alloc] initWithString:[NSString stringWithFormat:@"http://127.0.0.1:%d/", SERVER_PORT]];
}
NHLog(@"STARTUP", [initialURL description]);
[[webView mainFrame] loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:initialURL]]];
}
- (void)applicationWillTerminate:(NSNotification *)aNotification
{
[server stop];
}
- (void)configureLocalStorage
{
WebPreferences *webConfiguration = [WebPreferences standardPreferences];
NSBundle *mainBundle = [NSBundle mainBundle];
NSString *cappBundleName = [mainBundle objectForInfoDictionaryKey:@"CPBundleName"];
NSString *applicationSupportFile = [@"~/Library/Application Support/" stringByExpandingTildeInPath];
NSString *savePath = [NSString pathWithComponents:[NSArray arrayWithObjects:applicationSupportFile, cappBundleName, @"LocalStorage", nil]];
if ([webConfiguration respondsToSelector:@selector(setLocalStorageDatabasePath:)])
[webConfiguration setLocalStorageDatabasePath:savePath];
else
[webConfiguration _setLocalStorageDatabasePath:savePath];
[webView setPreferences:webConfiguration];
}
- (void)awakeFromNib
{
webView = [[WebView alloc] init];
[webView setUIDelegate:self];
[webView setFrameLoadDelegate:self];
[webView setResourceLoadDelegate:self];
[webView setPolicyDelegate:self];
[self configureLocalStorage];
webViewWindow = [[NSWindow alloc] init];
[webViewWindow setContentView:webView];
}
@end
void NHLog(NSString *type, NSString *message)
{
NSArray *lines = [message componentsSeparatedByString:@"\n"];
for (NSString *line in lines)
{
if ([line length] > 0)
NSLog(@"%10@: %@", type, line);
}
}
-18
View File
@@ -1,18 +0,0 @@
//
// Application.h
// NativeHost
//
// Created by Francisco Tolmasky on 10/8/09.
// Copyright 2009 280 North, Inc.. All rights reserved.
//
#import <Cocoa/Cocoa.h>
@interface Application : NSApplication
{
}
- (void)_reallyTerminate:(id)sender;
@end
-49
View File
@@ -1,49 +0,0 @@
//
// Application.m
// NativeHost
//
// Created by Francisco Tolmasky on 10/8/09.
// Copyright 2009 280 North, Inc.. All rights reserved.
//
#import "Application.h"
#import "AppController.h"
#import "WebScripObject+Objective-J.h"
#import "WebWindow.h"
@implementation Application
- (void)sendEvent:(NSEvent *)anEvent
{
[WebWindow enableAllWindows];
NSWindow * window = [anEvent window];
if (!window || [window isKindOfClass:[WebWindow class]])
{
NSResponder * firstResponder = window ? [window firstResponder] : [(AppController *)[self delegate] keyView];
switch ([anEvent type])
{
case NSKeyDown: return [firstResponder keyDown:anEvent];
case NSKeyUp: return [firstResponder keyUp:anEvent];
}
}
[super sendEvent:anEvent];
}
- (void)terminate:(id)sender
{
if ([[[self delegate] windowScriptObject] evaluateObjectiveJ:@"(CPApp)"] == [WebUndefined undefined])
[self _reallyTerminate:sender];
else
[[(AppController *)[self delegate] windowScriptObject] evaluateObjectiveJ:@"[CPApp terminate:nil]"];
}
- (void)_reallyTerminate:(id)sender
{
[super terminate:sender];
}
@end
-65
View File
@@ -1,65 +0,0 @@
//
// BridgedMethods.h
// NativeHost
//
// Created by Francisco Tolmasky on 10/16/09.
// Copyright 2009 280 North, Inc.. All rights reserved.
//
#import <Cocoa/Cocoa.h>
@interface BridgedMethods : NSObject
{
WebView * webView;
}
+ (NSMutableArray *)arrayFromWebScriptObject:(WebScriptObject *)incomingObject;
+ (void)enhanceWindowObject:(WebScriptObject *)aWindowObject ofWebView:(WebView *)aWebView;
@end
@interface GlobalMethods : BridgedMethods
{
}
- (id)isDesktop;
- (id)openingURLStrings;
- (id)setMainMenu:(id)arguments;
- (id)terminate;
- (id)activateIgnoringOtherApps:(NSArray *)arguments;
- (id)deactivate;
- (id)hide;
- (id)hideOtherApplications;
- (id)savePanel:(NSArray *)arguments; // FIXME: This should be implemented in Cappuccino.
- (id)openPanel; // FIXME: This should be implemented in Cappuccino.
- (id)clearRecentDocuments;
- (id)noteNewRecentDocumentPath:(NSArray *)aURL;
- (id)recentDocumentURLs;
- (id)pasteboardWithName:(NSArray *)arguments;
@end
@interface WindowMethods : BridgedMethods
{
}
- (id)miniaturize;
- (id)deminiaturize;
- (id)level;
- (id)setLevel:(NSArray *)arguments;
- (id)hasShadow;
- (id)setHasShadow:(NSArray *)arguments;
- (id)shadowStyle;
- (id)setShadowStyle:(NSArray *)arguments;
- (id)frame;
- (id)setFrame:(NSArray *)arguments;
@end
-345
View File
@@ -1,345 +0,0 @@
//
// BridgedMethods.m
// NativeHost
//
// Created by Francisco Tolmasky on 10/16/09.
// Copyright 2009 280 North, Inc.. All rights reserved.
//
#import <objc/runtime.h>
#import "Application.h"
#import "AppController.h"
#import "BridgedMethods.h"
#import "NSObject+WebAdditions.h"
#import "NSURL+Additions.h"
#import "WebWindow.h"
#import "WebPasteboardProxy.h"
static NSMutableDictionary * MethodClasses;
@implementation GlobalMethods
- (id)isDesktop
{
return [NSNumber numberWithBool:YES];
}
- (id)openingURLStrings
{
return [(AppController *)[NSApp delegate] openingURLStrings];
}
- (id)setMainMenu:(id)arguments
{
[[NSApp delegate] setMainMenuObject:[arguments objectAtIndex:0]];
return [WebUndefined undefined];
}
- (id)terminate
{
[(Application *)NSApp _reallyTerminate:self];
return [WebUndefined undefined];
}
- (id)activateIgnoringOtherApps:(NSArray *)arguments
{
id argument = [arguments objectAtIndex:0];
[(NSApplication *)NSApp activateIgnoringOtherApps:[argument isKindOfClass:[NSNumber class]] && [(NSNumber *)argument boolValue]];
return [WebUndefined undefined];
}
- (id)deactivate
{
[(NSApplication *)NSApp deactivate];
return [WebUndefined undefined];
}
- (id)hide
{
[NSApp hide:self];
return [WebUndefined undefined];
}
- (id)hideOtherApplications
{
[NSApp hideOtherApplications:self];
return [WebUndefined undefined];
}
- (id)openPanel
{
NSOpenPanel * openPanel = [NSOpenPanel openPanel];
NSInteger result = [openPanel runModal];
NSMutableString * resultObject = [NSMutableString stringWithFormat:@"({ button:%d, URLs:", result];
NSMutableArray * fileSystemURLs = [NSMutableArray array];
for (NSURL * URL in [openPanel URLs])
[fileSystemURLs addObject:[URL HTTPFileSystemURL]];
if (result == NSFileHandlingPanelOKButton)
[resultObject appendString:[NSString stringWithFormat:@"[\"%@\"] })", [fileSystemURLs componentsJoinedByString:@"\", \""]]];
else
[resultObject appendString:@"[] })"];
return [[webView windowScriptObject] evaluateWebScript:resultObject];
}
- (id)savePanel:(NSArray *)arguments
{
NSSavePanel * savePanel = [NSSavePanel savePanel];
WebScriptObject *args = [arguments objectAtIndex:0];
[savePanel setAllowedFileTypes:[BridgedMethods arrayFromWebScriptObject:[args valueForKey:@"allowedFileTypes"]]];
id allowsOtherFileTypes = [args valueForKey:@"allowsOtherFileTypes"];
[savePanel setAllowsOtherFileTypes:allowsOtherFileTypes && [allowsOtherFileTypes webBoolValue]];
id isExtensionHidden = [args valueForKey:@"isExtensionHidden"];
[savePanel setExtensionHidden:isExtensionHidden && [isExtensionHidden webBoolValue]];
id canSelectHiddenExtension = [args valueForKey:@"canSelectHiddenExtension"];
[savePanel setCanSelectHiddenExtension:canSelectHiddenExtension && canSelectHiddenExtension];
id canCreateDirectories = [args valueForKey:@"canCreateDirectories"];
[savePanel setCanCreateDirectories:canCreateDirectories && [canCreateDirectories webBoolValue]];
NSInteger result = [savePanel runModal];
return [[webView windowScriptObject] evaluateWebScript:[NSString stringWithFormat:@"({ button:%d, URL:\"%@\" })", result, [[[savePanel URL] HTTPFileSystemURL] absoluteString]]];
}
- (id)clearRecentDocuments
{
[[NSDocumentController sharedDocumentController] clearRecentDocuments:self];
return [WebUndefined undefined];
}
- (id)noteNewRecentDocumentPath:(NSArray *)arguments
{
if (![arguments count])
return [WebUndefined undefined];
NSString *aURL = [arguments objectAtIndex:0];
NSURL *fileURL = [NSURL fileSystemURLFromHTTPFileSystemString:aURL];
[[NSDocumentController sharedDocumentController] noteNewRecentDocumentURL:fileURL];
return [WebUndefined undefined];
}
- (id)recentDocumentURLs
{
NSArray *existingURLs = [[NSDocumentController sharedDocumentController] recentDocumentURLs];
NSMutableArray *urlsAsStrings = [NSMutableArray array];
for (int i=0, count = [existingURLs count]; i < count; i++)
[urlsAsStrings addObject:[[existingURLs objectAtIndex:i] absoluteString]];
return urlsAsStrings;
}
- (id)pasteboardWithName:(NSArray *)arguments
{
if (![arguments count])
return [WebUndefined undefined];
return [WebPasteboardProxy pasteboardWithName:[arguments objectAtIndex:0]];
}
@end
@implementation WindowMethods
- (id)miniaturize
{
[[webView window] miniaturize:nil];
return [WebUndefined undefined];
}
- (id)deminiaturize
{
[[webView window] deminiaturize:nil];
return [WebUndefined undefined];
}
- (id)level
{
return [NSNumber numberWithInt:[[webView window] level]];
}
- (id)setLevel:(NSArray *)arguments
{
[[webView window] setLevel:[[arguments objectAtIndex:0] intValue]];
return [WebUndefined undefined];
}
- (id)hasShadow
{
return [NSNumber numberWithBool:[[webView window] hasShadow]];
}
- (id)setHasShadow:(NSArray *)arguments
{
[[webView window] setHasShadow:[[arguments objectAtIndex:0] boolValue]];
return [WebUndefined undefined];
}
- (id)frame
{
NSRect frame = [[webView window] frame];
return [[webView windowScriptObject] evaluateWebScript:[NSString stringWithFormat:@"({ origin:{%f, %f}, size:{%f, %f}})", NSMinX(frame), NSMinY(frame), NSWidth(frame), NSHeight(frame)]];
}
- (id)setFrame:(NSArray *)arguments
{
id origin = [[arguments objectAtIndex:0] valueForKey:@"origin"],
size = [[arguments objectAtIndex:0] valueForKey:@"size"];
NSWindow * window = [webView window];
NSScreen * screen = [window screen];
if (!screen)
screen = [NSScreen mainScreen]; // Is this correct?
float height = [[size valueForKey:@"height"] floatValue];
[[webView window] setFrame:NSMakeRect([[origin valueForKey:@"x"] floatValue], NSMaxY([screen frame]) - [[origin valueForKey:@"y"] floatValue] - height, [[size valueForKey:@"width"] floatValue], height) display:YES];
/*
NSLog([webView description]);
NSLog(@"%@ %@", [window screen], NSStringFromRect([window frame]));
NSLog(@"%f - %f - %f = %f", NSMaxY([[window screen] frame]), [[origin valueForKey:@"y"] floatValue], height, NSMaxY([[window screen] frame]) - [[origin valueForKey:@"y"] floatValue] - height);
NSLog(@"FROM: %@", NSStringFromRect(NSMakeRect([[origin valueForKey:@"x"] floatValue], [[origin valueForKey:@"y"] floatValue], [[size valueForKey:@"width"] floatValue], height)));
NSLog(@" TO: %@", NSStringFromRect([[webView window] frame]));
*/
return [WebUndefined undefined];
}
- (id)shadowStyle
{
WebWindow * window = (WebWindow *)[webView window];
return [NSNumber numberWithInt:[window shadowStyle]];
}
- (id)setShadowStyle:(id)arguments
{
int type = [[arguments objectAtIndex:0] intValue];
WebWindow * window = (WebWindow *)[webView window];
[window setShadowStyle:type];
return [WebUndefined undefined];
}
@end
@interface WindowScriptObjectMethod : NSObject
{
WebView * webView;
}
- (id)initWithWebView:(WebView *)aWebView;
@end
@implementation WindowScriptObjectMethod
- (id)initWithWebView:(WebView *)aWebView
{
self = [super init];
if (self)
webView = aWebView;
return self;
}
@end
@implementation BridgedMethods
+ (NSMutableArray *)arrayFromWebScriptObject:(WebScriptObject *)incomingObject
{
if (!incomingObject)
return nil;
NSMutableArray * newItems = [[NSMutableArray alloc] init];
for (int i=0; [incomingObject webScriptValueAtIndex:i]!=[WebUndefined undefined]; i++)
{
id oneItem =[incomingObject webScriptValueAtIndex:i];
[newItems addObject:oneItem];
}
return [newItems autorelease];
}
+ (void)enhanceWindowObject:(WebScriptObject *)aWindowObject ofWebView:(WebView *)aWebView
{
NSDictionary * classMethods = [MethodClasses objectForKey:[self className]];
NSString * key = nil;
NSEnumerator * keyEnumerator = [classMethods keyEnumerator];
while (key = [keyEnumerator nextObject])
[aWindowObject setValue:[(WindowScriptObjectMethod *)[[[classMethods objectForKey:key] alloc] initWithWebView:aWebView] autorelease] forKey:key];
}
+ (void)bridgeMethod:(Method)aMethod dictionary:(NSMutableDictionary *)aDictionary
{
NSString * methodName = NSStringFromSelector(method_getName(aMethod)),
* publicMethodName = [NSString stringWithFormat:@"cp%@", [[NSString stringWithFormat:@"%@%@", [[methodName substringToIndex:1] uppercaseString], [methodName substringFromIndex:1]] stringByTrimmingCharactersInSet:[NSCharacterSet characterSetWithCharactersInString:@":"]]];
Class methodClass = objc_allocateClassPair([WindowScriptObjectMethod class], [[NSString stringWithFormat:@"WebScriptObjectMethod_%@", publicMethodName] cString], 0);
class_addMethod(methodClass, @selector(invokeDefaultMethodWithArguments:), method_getImplementation(aMethod), "@@:@");
objc_registerClassPair(methodClass);
[aDictionary setObject:methodClass forKey:publicMethodName];
}
+ (void)initialize
{
if (!MethodClasses)
MethodClasses = [[NSMutableDictionary alloc] init];
NSMutableDictionary * dictionary = [[NSMutableDictionary alloc] init];
[MethodClasses setObject:dictionary forKey:[self className]];
[dictionary release];
unsigned int methodCount = 0;
Method * methods = class_copyMethodList(self, &methodCount);
if (!methods)
return;
int index = 0;
for (; index < methodCount; ++index)
[self bridgeMethod:methods[index] dictionary:dictionary];
free(methods);
methods = NULL;
}
@end
-21
View File
@@ -1,21 +0,0 @@
//
// Console.h
// NativeHost
//
// Created by Francisco Tolmasky on 6/16/09.
// Copyright 2009 280 North, Inc.. All rights reserved.
//
#import <Cocoa/Cocoa.h>
@interface Console : NSObject
{
NSMutableAttributedString * contents;
}
+ (id)sharedConsole;
- (NSAttributedString *)contents;
@end
-69
View File
@@ -1,69 +0,0 @@
//
// Console.m
// NativeHost
//
// Created by Francisco Tolmasky on 6/16/09.
// Copyright 2009 280 North, Inc.. All rights reserved.
//
#import "Console.h"
#import "AppController.h"
@implementation Console
+ (id)sharedConsole
{
static Console * console = nil;
if (!console)
console = [[Console alloc] init];
return console;
}
- (id)init
{
self = [super init];
if (self)
contents = [[NSMutableAttributedString alloc] init];
return self;
}
- (void)dealloc
{
[contents release];
[super dealloc];
}
- (NSAttributedString *)contents
{
return contents;
}
- (void)webView:(WebView *)aWebView addMessageToConsole:(NSDictionary *)aDictionary
{
NSString * message = [aDictionary objectForKey:@"message"];
NSAttributedString *attrString = [[NSAttributedString alloc] initWithString:[NSString stringWithFormat:@"%@\n", message, nil]];
[contents appendAttributedString:attrString];
[attrString release];
NHLog(@"CONSOLE", message);
}
- (void)webView:(WebView *)aSender runJavaScriptAlertPanelWithMessage:(NSString *)aMessage initiatedByFrame:(WebFrame *)aFrame
{
WebDataSource * dataSource = [aFrame dataSource];
NSString * title = [dataSource pageTitle];
if (![title length])
title = [[[dataSource request] URL] absoluteString];
[[NSAlert alertWithMessageText:title defaultButton:@"OK" alternateButton:nil otherButton:nil informativeTextWithFormat:aMessage, nil] runModal];
}
@end
Binary file not shown.
@@ -1 +0,0 @@
280NPLIST;1.0;D;K;4;$topD;K;18;CPCibObjectDataKeyD;K;6;CP$UIDd;1;2E;E;K;8;$objectsA;S;5;$nullD;K;10;$classnameS;16;_CPCibObjectDataK;8;$classesA;S;16;_CPCibObjectDataS;8;CPObjectE;E;D;K;6;$classD;K;6;CP$UIDd;1;1E;K;28;_CPCibObjectDataNamesKeysKeyD;K;6;CP$UIDd;1;0E;K;30;_CPCibObjectDataNamesValuesKeyD;K;6;CP$UIDd;1;0E;K;30;_CPCibObjectDataClassesKeysKeyD;K;6;CP$UIDd;1;0E;K;32;_CPCibObjectDataClassesValuesKeyD;K;6;CP$UIDd;1;0E;K;30;_CPCibObjectDataConnectionsKeyD;K;6;CP$UIDd;1;4E;K;28;_CPCibObjectDataFrameworkKeyD;K;6;CP$UIDd;1;0E;K;26;_CPCibObjectDataNextOidKeyD;K;6;CP$UIDd;1;5E;K;30;_CPCibObjectDataObjectsKeysKeyD;K;6;CP$UIDd;1;6E;K;32;_CPCibObjectDataObjectsValuesKeyD;K;6;CP$UIDd;1;7E;K;26;_CPCibObjectDataOidKeysKeyD;K;6;CP$UIDd;1;8E;K;28;_CPCibObjectDataOidValuesKeyD;K;6;CP$UIDd;1;9E;K;28;_CPCibObjectDataFileOwnerKeyD;K;6;CP$UIDd;2;11E;K;33;_CPCibObjectDataVisibleWindowsKeyD;K;6;CP$UIDd;2;13E;E;D;K;10;$classnameS;7;CPArrayK;8;$classesA;S;7;CPArrayS;8;CPObjectE;E;D;K;6;$classD;K;6;CP$UIDd;1;3E;K;10;CP.objectsA;D;K;6;CP$UIDd;2;15E;E;E;D;K;6;$classD;K;6;CP$UIDd;1;3E;K;10;CP.objectsA;E;E;D;K;6;$classD;K;6;CP$UIDd;1;3E;K;10;CP.objectsA;D;K;6;CP$UIDd;2;16E;D;K;6;CP$UIDd;2;17E;D;K;6;CP$UIDd;2;18E;E;E;D;K;6;$classD;K;6;CP$UIDd;1;3E;K;10;CP.objectsA;D;K;6;CP$UIDd;2;11E;D;K;6;CP$UIDd;2;11E;D;K;6;CP$UIDd;2;11E;E;E;D;K;6;$classD;K;6;CP$UIDd;1;3E;K;10;CP.objectsA;E;E;D;K;6;$classD;K;6;CP$UIDd;1;3E;K;10;CP.objectsA;E;E;D;K;10;$classnameS;18;_CPCibCustomObjectK;8;$classesA;S;18;_CPCibCustomObjectS;8;CPObjectE;E;D;K;6;$classD;K;6;CP$UIDd;2;10E;K;27;_CPCibCustomObjectClassNameD;K;6;CP$UIDd;2;19E;E;D;K;10;$classnameS;5;CPSetK;8;$classesA;S;5;CPSetS;8;CPObjectE;E;D;K;6;$classD;K;6;CP$UIDd;2;12E;K;15;CPSetObjectsKeyD;K;6;CP$UIDd;2;20E;E;D;K;10;$classnameS;20;CPCibOutletConnectorK;8;$classesA;S;20;CPCibOutletConnectorS;14;CPCibConnectorS;8;CPObjectE;E;D;K;6;$classD;K;6;CP$UIDd;2;14E;K;24;_CPCibConnectorSourceKeyD;K;6;CP$UIDd;2;16E;K;29;_CPCibConnectorDestinationKeyD;K;6;CP$UIDd;2;18E;K;23;_CPCibConnectorLabelKeyD;K;6;CP$UIDd;2;21E;E;D;K;6;$classD;K;6;CP$UIDd;2;10E;K;27;_CPCibCustomObjectClassNameD;K;6;CP$UIDd;2;19E;E;D;K;6;$classD;K;6;CP$UIDd;2;10E;K;27;_CPCibCustomObjectClassNameD;K;6;CP$UIDd;2;22E;E;D;K;6;$classD;K;6;CP$UIDd;2;10E;K;27;_CPCibCustomObjectClassNameD;K;6;CP$UIDd;2;23E;E;S;13;CPApplicationD;K;6;$classD;K;6;CP$UIDd;1;3E;K;10;CP.objectsA;E;E;S;8;delegateS;13;NSFontManagerS;13;AppControllerE;K;9;$archiverS;15;CPKeyedArchiverK;8;$versionS;6;100000E;
-548
View File
@@ -1,548 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<archive type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="7.10">
<data>
<int key="IBDocument.SystemTarget">1050</int>
<string key="IBDocument.SystemVersion">10C540</string>
<string key="IBDocument.InterfaceBuilderVersion">732</string>
<string key="IBDocument.AppKitVersion">1038.25</string>
<string key="IBDocument.HIToolboxVersion">458.00</string>
<object class="NSMutableDictionary" key="IBDocument.PluginVersions">
<string key="NS.key.0">com.apple.InterfaceBuilder.CocoaPlugin</string>
<string key="NS.object.0">732</string>
</object>
<object class="NSMutableArray" key="IBDocument.EditedObjectIDs">
<bool key="EncodedWithXMLCoder">YES</bool>
</object>
<object class="NSArray" key="IBDocument.PluginDependencies">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
</object>
<object class="NSMutableDictionary" key="IBDocument.Metadata">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSArray" key="dict.sortedKeys" id="0">
<bool key="EncodedWithXMLCoder">YES</bool>
</object>
<object class="NSMutableArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
</object>
</object>
<object class="NSMutableArray" key="IBDocument.RootObjects" id="1048">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSCustomObject" id="1021">
<string key="NSClassName">NSApplication</string>
</object>
<object class="NSCustomObject" id="1014">
<string key="NSClassName">FirstResponder</string>
</object>
<object class="NSCustomObject" id="1050">
<string key="NSClassName">NSApplication</string>
</object>
<object class="NSCustomObject" id="755631768">
<string key="NSClassName">NSFontManager</string>
</object>
<object class="NSCustomObject" id="810129115">
<string key="NSClassName">AppController</string>
</object>
</object>
<object class="IBObjectContainer" key="IBDocument.Objects">
<object class="NSMutableArray" key="connectionRecords">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="IBConnectionRecord">
<object class="IBOutletConnection" key="connection">
<string key="label">delegate</string>
<reference key="source" ref="1050"/>
<reference key="destination" ref="810129115"/>
</object>
<int key="connectionID">519</int>
</object>
</object>
<object class="IBMutableOrderedSet" key="objectRecords">
<object class="NSArray" key="orderedObjects">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="IBObjectRecord">
<int key="objectID">0</int>
<reference key="object" ref="0"/>
<reference key="children" ref="1048"/>
<nil key="parent"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">-2</int>
<reference key="object" ref="1021"/>
<reference key="parent" ref="0"/>
<string key="objectName">File's Owner</string>
</object>
<object class="IBObjectRecord">
<int key="objectID">-1</int>
<reference key="object" ref="1014"/>
<reference key="parent" ref="0"/>
<string key="objectName">First Responder</string>
</object>
<object class="IBObjectRecord">
<int key="objectID">-3</int>
<reference key="object" ref="1050"/>
<reference key="parent" ref="0"/>
<string key="objectName">Application</string>
</object>
<object class="IBObjectRecord">
<int key="objectID">420</int>
<reference key="object" ref="755631768"/>
<reference key="parent" ref="0"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">487</int>
<reference key="object" ref="810129115"/>
<reference key="parent" ref="0"/>
</object>
</object>
</object>
<object class="NSMutableDictionary" key="flattenedProperties">
<string key="NS.key.0">-3.IBPluginDependency</string>
<string key="NS.object.0">com.apple.InterfaceBuilder.CocoaPlugin</string>
</object>
<object class="NSMutableDictionary" key="unlocalizedProperties">
<bool key="EncodedWithXMLCoder">YES</bool>
<reference key="dict.sortedKeys" ref="0"/>
<object class="NSMutableArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
</object>
</object>
<nil key="activeLocalization"/>
<object class="NSMutableDictionary" key="localizations">
<bool key="EncodedWithXMLCoder">YES</bool>
<reference key="dict.sortedKeys" ref="0"/>
<object class="NSMutableArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
</object>
</object>
<nil key="sourceID"/>
<int key="maxID">677</int>
</object>
<object class="IBClassDescriber" key="IBDocument.Classes">
<object class="NSMutableArray" key="referencedPartialClassDescriptions">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="IBPartialClassDescription">
<string key="className">AppController</string>
<string key="superclassName">NSObject</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBProjectSource</string>
<string key="minorKey">AppController.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSObject</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBProjectSource</string>
<string key="minorKey">NSObject+WebAdditions.h</string>
</object>
</object>
</object>
<object class="NSMutableArray" key="referencedPartialClassDescriptionsV3.2+">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="IBPartialClassDescription">
<string key="className">NSApplication</string>
<string key="superclassName">NSResponder</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier" id="462640452">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">AppKit.framework/Headers/NSApplication.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSApplication</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier" id="559217937">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">AppKit.framework/Headers/NSApplicationScripting.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSApplication</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier" id="185909934">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">AppKit.framework/Headers/NSColorPanel.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSApplication</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">AppKit.framework/Headers/NSHelpManager.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSApplication</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">AppKit.framework/Headers/NSPageLayout.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSApplication</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">AppKit.framework/Headers/NSUserInterfaceItemSearching.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSFontManager</string>
<string key="superclassName">NSObject</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier" id="536952554">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">AppKit.framework/Headers/NSFontManager.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSMenu</string>
<string key="superclassName">NSObject</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier" id="810670176">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">AppKit.framework/Headers/NSMenu.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSObject</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">AppKit.framework/Headers/NSAccessibility.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSObject</string>
<reference key="sourceIdentifier" ref="462640452"/>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSObject</string>
<reference key="sourceIdentifier" ref="559217937"/>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSObject</string>
<reference key="sourceIdentifier" ref="185909934"/>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSObject</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">AppKit.framework/Headers/NSControl.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSObject</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">AppKit.framework/Headers/NSDictionaryController.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSObject</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">AppKit.framework/Headers/NSDragging.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSObject</string>
<reference key="sourceIdentifier" ref="536952554"/>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSObject</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">AppKit.framework/Headers/NSFontPanel.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSObject</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">AppKit.framework/Headers/NSKeyValueBinding.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSObject</string>
<reference key="sourceIdentifier" ref="810670176"/>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSObject</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">AppKit.framework/Headers/NSNibLoading.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSObject</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">AppKit.framework/Headers/NSOutlineView.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSObject</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">AppKit.framework/Headers/NSPasteboard.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSObject</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">AppKit.framework/Headers/NSSavePanel.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSObject</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">AppKit.framework/Headers/NSTableView.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSObject</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">AppKit.framework/Headers/NSToolbarItem.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSObject</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">AppKit.framework/Headers/NSView.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSObject</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">Foundation.framework/Headers/NSArchiver.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSObject</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">Foundation.framework/Headers/NSClassDescription.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSObject</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">Foundation.framework/Headers/NSError.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSObject</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">Foundation.framework/Headers/NSFileManager.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSObject</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">Foundation.framework/Headers/NSKeyValueCoding.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSObject</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">Foundation.framework/Headers/NSKeyValueObserving.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSObject</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">Foundation.framework/Headers/NSKeyedArchiver.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSObject</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">Foundation.framework/Headers/NSObject.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSObject</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">Foundation.framework/Headers/NSObjectScripting.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSObject</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">Foundation.framework/Headers/NSPortCoder.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSObject</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">Foundation.framework/Headers/NSRunLoop.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSObject</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">Foundation.framework/Headers/NSScriptClassDescription.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSObject</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">Foundation.framework/Headers/NSScriptKeyValueCoding.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSObject</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">Foundation.framework/Headers/NSScriptObjectSpecifiers.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSObject</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">Foundation.framework/Headers/NSScriptWhoseTests.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSObject</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">Foundation.framework/Headers/NSThread.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSObject</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">Foundation.framework/Headers/NSURL.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSObject</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">Foundation.framework/Headers/NSURLConnection.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSObject</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">Foundation.framework/Headers/NSURLDownload.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSObject</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">WebKit.framework/Headers/WebDownload.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSObject</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">WebKit.framework/Headers/WebEditingDelegate.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSObject</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">WebKit.framework/Headers/WebFrameLoadDelegate.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSObject</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">WebKit.framework/Headers/WebJavaPlugIn.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSObject</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">WebKit.framework/Headers/WebPlugin.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSObject</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">WebKit.framework/Headers/WebPluginContainer.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSObject</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">WebKit.framework/Headers/WebPolicyDelegate.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSObject</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">WebKit.framework/Headers/WebResourceLoadDelegate.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSObject</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">WebKit.framework/Headers/WebScriptObject.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSObject</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">WebKit.framework/Headers/WebUIDelegate.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSResponder</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">AppKit.framework/Headers/NSInterfaceStyle.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSResponder</string>
<string key="superclassName">NSObject</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">AppKit.framework/Headers/NSResponder.h</string>
</object>
</object>
</object>
</object>
<int key="IBDocument.localizationMode">0</int>
<object class="NSMutableDictionary" key="IBDocument.PluginDeclaredDependencies">
<string key="NS.key.0">com.apple.InterfaceBuilder.CocoaPlugin.macosx</string>
<integer value="1050" key="NS.object.0"/>
</object>
<object class="NSMutableDictionary" key="IBDocument.PluginDeclaredDependencyDefaults">
<string key="NS.key.0">com.apple.InterfaceBuilder.CocoaPlugin.macosx</string>
<integer value="1050" key="NS.object.0"/>
</object>
<object class="NSMutableDictionary" key="IBDocument.PluginDeclaredDevelopmentDependencies">
<string key="NS.key.0">com.apple.InterfaceBuilder.CocoaPlugin.InterfaceBuilder3</string>
<integer value="3000" key="NS.object.0"/>
</object>
<bool key="IBDocument.PluginDeclaredDependenciesTrackSystemTargetVersion">YES</bool>
<string key="IBDocument.LastKnownRelativeProjectPath">../NativeHost.xcodeproj</string>
<int key="IBDocument.defaultPropertyAccessControl">3</int>
</data>
</archive>
-30
View File
@@ -1,30 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>English</string>
<key>CFBundleExecutable</key>
<string>${EXECUTABLE_NAME}</string>
<key>CFBundleIconFile</key>
<string>icon</string>
<key>CFBundleShortVersionString</key>
<string>0.9</string>
<key>CFBundleIdentifier</key>
<string>com.280north.${PRODUCT_NAME:identifier}</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>NativeHost</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1.0</string>
<key>NSMainNibFile</key>
<string>MainMenu</string>
<key>NSPrincipalClass</key>
<string>NSApplication</string>
</dict>
</plist>
-45
View File
@@ -1,45 +0,0 @@
require("../../common.jake");
var OS = require("os");
var task = require("jake").task
var stream = require("narwhal/term").stream;
task ("build", function()
{
if (executableExists("xcodebuild"))
{
var args = "-alltargets -configuration Release";
if (xcodebuildHasTenPointFiveSDK())
args = "-sdk macosx10.5 " + args;
else
args = "-sdk macosx " + args;
if (OS.system("xcodebuild " + args))
OS.exit(1);
rm_rf(FILE.join($BUILD_CJS_CAPPUCCINO, "support", "NativeHost.app"));
FILE.mkdirs(FILE.join($BUILD_CJS_CAPPUCCINO, "support"))
cp_r(FILE.join("build", "Release", "NativeHost.app"), FILE.join($BUILD_CJS_CAPPUCCINO, "support", "NativeHost.app"));
}
else
{
print("Building NativeHost requires Xcode.");
}
});
task ("clean", function()
{
if (OS.system("xcodebuild clean"))
OS.exit(1);
});
task ("clobber", function()
{
if (OS.system("xcodebuild clean"))
OS.exit(1);
});
task ("default", ["build"]);
-22
View File
@@ -1,22 +0,0 @@
//
// MenuBridge.h
// NativeHost
//
// Created by Francisco Tolmasky on 9/2/09.
// Copyright 2009 280 North, Inc.. All rights reserved.
//
#import <Cocoa/Cocoa.h>
@class WebScriptObject;
@interface MenuBridge : NSMenu
{
WebScriptObject * menuObject;
}
+ (id)menuBridgeWithMenuObject:(WebScriptObject *)aMenuObject;
- (id)initWithMenuObject:(WebScriptObject *)aMenuObject;
@end
-63
View File
@@ -1,63 +0,0 @@
//
// MenuBridge.m
// NativeHost
//
// Created by Francisco Tolmasky on 9/2/09.
// Copyright 2009 280 North, Inc.. All rights reserved.
//
#import "WebScripObject+Objective-J.h"
#import "MenuItemBridge.h"
#import "MenuBridge.h"
@implementation MenuBridge
+ (id)menuBridgeWithMenuObject:(WebScriptObject *)aMenuObject
{
if (!aMenuObject)
return nil;
static NSMapTable * cache = nil;
if (!cache)
cache = [[NSMapTable mapTableWithStrongToStrongObjects] retain];
MenuBridge * menuBridge = [cache objectForKey:aMenuObject];
if (!menuBridge)
{
menuBridge = [MenuBridge alloc];
[cache setObject:menuBridge forKey:aMenuObject];
[[menuBridge initWithMenuObject:aMenuObject] autorelease];
}
return menuBridge;
}
- (id)initWithMenuObject:(WebScriptObject *)aMenuObject
{
self = [super initWithTitle:[aMenuObject bridgeSelector:@selector(title)]];
if (self)
{
menuObject = aMenuObject;
NSInteger index = 0,
count = [[aMenuObject bridgeSelector:@selector(numberOfItems)] intValue];
for (; index < count; ++index)
[self addItem:[[[MenuItemBridge alloc] initWithMenuItemObject:[aMenuObject bridgeSelector:@selector(itemAtIndex:) withObject:[NSNumber numberWithInt:index]]] autorelease]];
}
return self;
}
- (void)performActionForItemAtIndex:(NSInteger)anIndex
{
[menuObject bridgeSelector:@selector(performActionForItemAtIndex:) withObject:[NSNumber numberWithInt:anIndex]];
}
@end
-24
View File
@@ -1,24 +0,0 @@
//
// ReflectMenuItem.h
// NativeHost
//
// Created by Francisco Tolmasky on 9/2/09.
// Copyright 2009 280 North, Inc.. All rights reserved.
//
#import <Cocoa/Cocoa.h>
@class WebScriptObject;
@interface MenuItemBridge : NSMenuItem
{
WebScriptObject * menuItemObject;
}
+ (id)menuItemBridgeWithMenuItemObject:(WebScriptObject *)aMenuItemObject;
- (id)initWithMenuItemObject:(WebScriptObject *)aMenuItemObject;
- (void)updateFromMenuItemObject;
@end
-77
View File
@@ -1,77 +0,0 @@
//
// ReflectMenuItem.m
// NativeHost
//
// Created by Francisco Tolmasky on 9/2/09.
// Copyright 2009 280 North, Inc.. All rights reserved.
//
#import "WebScripObject+Objective-J.h"
#import "MenuBridge.h"
#import "MenuItemBridge.h"
@implementation MenuItemBridge
+ (id)menuItemBridgeWithMenuItemObject:(WebScriptObject *)aMenuItemObject
{
if (!aMenuItemObject)
return nil;
static NSMapTable * cache = nil;
if (!cache)
cache = [[NSMapTable mapTableWithStrongToStrongObjects] retain];
MenuItemBridge * menuItemBridge = [cache objectForKey:aMenuItemObject];
if (!menuItemBridge)
{
menuItemBridge = [MenuBridge alloc];
[cache setObject:menuItemBridge forKey:aMenuItemObject];
[[menuItemBridge initWithMenuItemObject:aMenuItemObject] autorelease];
}
return menuItemBridge;
}
- (id)initWithMenuItemObject:(WebScriptObject *)aMenuItemObject
{
if ([[aMenuItemObject bridgeSelector:@selector(isSeparatorItem)] boolValue])
return [[NSMenuItem separatorItem] retain];
self = [super init];
if (self)
{
menuItemObject = aMenuItemObject;
[self updateFromMenuItemObject];
}
return self;
}
/*
- (BOOL)isSeparatorItem
{
return [[menuItemObject bridgeSelector:@selector(isSeparatorItem)] boolValue];
}
*/
- (void)updateFromMenuItemObject
{
[self setTitle:[menuItemObject bridgeSelector:@selector(title)]];
[self setSubmenu:[MenuBridge menuBridgeWithMenuObject:[menuItemObject bridgeSelector:@selector(submenu)]]];
[self setKeyEquivalent:[menuItemObject bridgeSelector:@selector(keyEquivalent)]];
[self setKeyEquivalentModifierMask:[[menuItemObject evaluateObjectiveJ:[NSString stringWithFormat:@"(function() { var mask = %u; return (((mask & CPAlphaShiftKeyMask) ? %u : 0) | ((mask & CPShiftKeyMask) ? %u : 0) | ((mask & CPControlKeyMask) ? %u : 0) | ((mask & CPAlternateKeyMask) ? %u : 0) | ((mask & CPCommandKeyMask) ? %u : 0) | ((mask & CPNumericPadKeyMask) ? %u : 0) | ((mask & CPHelpKeyMask) ? %u : 0) | ((mask & CPFunctionKeyMask) ? %u : 0)) }())", [[menuItemObject bridgeSelector:@selector(keyEquivalentModifierMask)] unsignedIntegerValue], NSAlphaShiftKeyMask, NSShiftKeyMask, NSControlKeyMask, NSAlternateKeyMask, NSCommandKeyMask, NSNumericPadKeyMask, NSHelpKeyMask, NSFunctionKeyMask, NSDeviceIndependentModifierFlagsMask]] unsignedIntegerValue]];[self setAction:@selector(bridgeAction:)];
[self setTarget:self];
[self setAction:@selector(bridgeAction:)];
}
// This exists so that the menu items are enabled.
- (void)bridgeAction:(id)aSender
{
}
@end
-16
View File
@@ -1,16 +0,0 @@
//
// NSObject+WebAdditions.h
// NativeHost
//
// Created by Francisco Tolmasky on 11/16/09.
// Copyright 2009 280 North, Inc.. All rights reserved.
//
#import <Cocoa/Cocoa.h>
@interface NSObject (WebAdditions)
- (BOOL)webBoolValue;
@end
-19
View File
@@ -1,19 +0,0 @@
//
// NSObject+WebAdditions.m
// NativeHost
//
// Created by Francisco Tolmasky on 11/16/09.
// Copyright 2009 280 North, Inc.. All rights reserved.
//
#import "NSObject+WebAdditions.h"
@implementation NSObject (WebAdditions)
- (BOOL)webBoolValue
{
return [self isKindOfClass:[NSNumber class]] && [(NSNumber *)self boolValue];
}
@end
-17
View File
@@ -1,17 +0,0 @@
//
// NSURL+Additions.h
// NativeHost
//
// Created by Francisco Tolmasky on 6/3/09.
// Copyright 2009 280 North, Inc. All rights reserved.
//
#import <Cocoa/Cocoa.h>
@interface NSURL (Additions)
- (NSURL *)HTTPFileSystemURL;
+ (NSURL *)fileSystemURLFromHTTPFileSystemString:(NSString *)aString;
@end
-36
View File
@@ -1,36 +0,0 @@
//
// NSURL+Additions.m
// NativeHost
//
// Created by Francisco Tolmasky on 6/3/09.
// Copyright 2009 280 North, Inc. All rights reserved.
//
#import "NSURL+Additions.h"
#import "AppController.h"
@implementation NSURL (Additions)
- (NSURL *)HTTPFileSystemURL
{
if ([[self scheme] caseInsensitiveCompare:@"file"] == NSOrderedSame)
return [[[NSURL alloc] initWithScheme:@"http"
host:[NSString stringWithFormat:@"127.0.0.1:%d", SERVER_PORT]
path:[@"/filesystem/" stringByAppendingString:[self path]]] autorelease];
return [[self copy] autorelease];
}
+ (NSURL *)fileSystemURLFromHTTPFileSystemString:(NSString *)aString
{
NSURL *httpURL = [NSURL URLWithString:aString];
NSString *path = [httpURL path];
NSRange range = [path rangeOfString:@"/filesystem"];
if (range.location == 0 && NSMaxRange(range) < [path length])
path = [path substringFromIndex:[@"/filesystem" length]];
return [[[NSURL alloc] initFileURLWithPath:path] autorelease];
}
@end
@@ -1,424 +0,0 @@
// !$*UTF8*$!
{
archiveVersion = 1;
classes = {
};
objectVersion = 46;
objects = {
/* Begin PBXBuildFile section */
1DDD58160DA1D0A300B32029 /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = 1DDD58140DA1D0A300B32029 /* MainMenu.xib */; };
4D55A7941180F1E000B5187D /* icon.icns in Resources */ = {isa = PBXBuildFile; fileRef = 4D55A7931180F1BE00B5187D /* icon.icns */; };
8D11072B0486CEB800E47090 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 089C165CFE840E0CC02AAC07 /* InfoPlist.strings */; };
8D11072D0486CEB800E47090 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 29B97316FDCFA39411CA2CEA /* main.m */; settings = {ATTRIBUTES = (); }; };
8D11072F0486CEB800E47090 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */; };
9E2E533A103B33CB00DF2D13 /* Server.m in Sources */ = {isa = PBXBuildFile; fileRef = 9E2E5339103B33CB00DF2D13 /* Server.m */; };
9E43AC84104DB51400263989 /* WebScripObject+Objective-J.m in Sources */ = {isa = PBXBuildFile; fileRef = 9E43AC83104DB51400263989 /* WebScripObject+Objective-J.m */; };
9E44CA9D0FD798FE00860A54 /* NSURL+Additions.m in Sources */ = {isa = PBXBuildFile; fileRef = 9E44CA9C0FD798FE00860A54 /* NSURL+Additions.m */; };
9E4EBB4210892BDE0091C8E9 /* BridgedMethods.m in Sources */ = {isa = PBXBuildFile; fileRef = 9E4EBB4110892BDE0091C8E9 /* BridgedMethods.m */; };
9E52D2F9119B05EF00B831FC /* AppController+WebPolicyDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 9E52D2F8119B05EF00B831FC /* AppController+WebPolicyDelegate.m */; };
9E535D05104F6F4900C119FA /* AppController+MainMenu.m in Sources */ = {isa = PBXBuildFile; fileRef = 9E535D04104F6F4900C119FA /* AppController+MainMenu.m */; };
9E535D32104F73FB00C119FA /* MenuBridge.m in Sources */ = {isa = PBXBuildFile; fileRef = 9E535D31104F73FB00C119FA /* MenuBridge.m */; };
9E535D37104F761F00C119FA /* MenuItemBridge.m in Sources */ = {isa = PBXBuildFile; fileRef = 9E535D36104F761F00C119FA /* MenuItemBridge.m */; };
9E55CFE50FE8750C007D1D64 /* Console.m in Sources */ = {isa = PBXBuildFile; fileRef = 9E55CFE40FE8750C007D1D64 /* Console.m */; };
9E5D4F0D1090FB6E00E76B38 /* WebWindow.m in Sources */ = {isa = PBXBuildFile; fileRef = 9E5D4F0C1090FB6E00E76B38 /* WebWindow.m */; };
9E9DD6C00FC93C7A0001EF2E /* WebKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9E9DD6BF0FC93C7A0001EF2E /* WebKit.framework */; };
9EA1BEF7107E7EE500CDE684 /* Application.m in Sources */ = {isa = PBXBuildFile; fileRef = 9EA1BEF6107E7EE500CDE684 /* Application.m */; };
9EB99C960FD8968100AA94A2 /* AppController.m in Sources */ = {isa = PBXBuildFile; fileRef = 9EB99C950FD8968100AA94A2 /* AppController.m */; };
9EBC421E10B1D07100C2AE33 /* NSObject+WebAdditions.m in Sources */ = {isa = PBXBuildFile; fileRef = 9EBC421D10B1D07100C2AE33 /* NSObject+WebAdditions.m */; };
9ED96C8A1020072300D24B9C /* AppController+WebUIDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 9ED96C871020072300D24B9C /* AppController+WebUIDelegate.m */; };
9ED96C8B1020072300D24B9C /* AppController+WebFrameLoadDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 9ED96C881020072300D24B9C /* AppController+WebFrameLoadDelegate.m */; };
9ED96C8C1020072300D24B9C /* AppController+WebResourceLoadDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 9ED96C891020072300D24B9C /* AppController+WebResourceLoadDelegate.m */; };
AD8D31C6108F98B00008F7C4 /* SSCrypto.m in Sources */ = {isa = PBXBuildFile; fileRef = AD8D31C5108F98B00008F7C4 /* SSCrypto.m */; };
AD8D31C9108F98E40008F7C4 /* libssl.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = AD8D31C8108F98E40008F7C4 /* libssl.dylib */; };
AD8D31CB108F98EF0008F7C4 /* libcrypto.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = AD8D31CA108F98EF0008F7C4 /* libcrypto.dylib */; };
AD8D350F109040300008F7C4 /* IOKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = AD8D350E109040300008F7C4 /* IOKit.framework */; };
ADCCEF6810D43C970055BDFD /* WebPasteboardProxy.m in Sources */ = {isa = PBXBuildFile; fileRef = ADCCEF3310D4370F0055BDFD /* WebPasteboardProxy.m */; };
/* End PBXBuildFile section */
/* Begin PBXFileReference section */
089C165DFE840E0CC02AAC07 /* English */ = {isa = PBXFileReference; fileEncoding = 10; lastKnownFileType = text.plist.strings; name = English; path = English.lproj/InfoPlist.strings; sourceTree = "<group>"; };
1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = /System/Library/Frameworks/Cocoa.framework; sourceTree = "<absolute>"; };
13E42FB307B3F0F600E4EEF1 /* CoreData.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreData.framework; path = /System/Library/Frameworks/CoreData.framework; sourceTree = "<absolute>"; };
1DDD58150DA1D0A300B32029 /* English */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = English; path = English.lproj/MainMenu.xib; sourceTree = "<group>"; };
29B97316FDCFA39411CA2CEA /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; };
29B97324FDCFA39411CA2CEA /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = /System/Library/Frameworks/AppKit.framework; sourceTree = "<absolute>"; };
29B97325FDCFA39411CA2CEA /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = /System/Library/Frameworks/Foundation.framework; sourceTree = "<absolute>"; };
32CA4F630368D1EE00C91783 /* NativeHost_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NativeHost_Prefix.pch; sourceTree = "<group>"; };
4D55A7931180F1BE00B5187D /* icon.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; path = icon.icns; sourceTree = "<group>"; };
8D1107310486CEB800E47090 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
8D1107320486CEB800E47090 /* NativeHost.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = NativeHost.app; sourceTree = BUILT_PRODUCTS_DIR; };
9E2E5338103B33CB00DF2D13 /* Server.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Server.h; sourceTree = "<group>"; };
9E2E5339103B33CB00DF2D13 /* Server.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Server.m; sourceTree = "<group>"; };
9E43AC82104DB51400263989 /* WebScripObject+Objective-J.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "WebScripObject+Objective-J.h"; sourceTree = "<group>"; };
9E43AC83104DB51400263989 /* WebScripObject+Objective-J.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "WebScripObject+Objective-J.m"; sourceTree = "<group>"; };
9E44CA9B0FD798FE00860A54 /* NSURL+Additions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSURL+Additions.h"; sourceTree = "<group>"; };
9E44CA9C0FD798FE00860A54 /* NSURL+Additions.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSURL+Additions.m"; sourceTree = "<group>"; };
9E4EBB4010892BDE0091C8E9 /* BridgedMethods.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BridgedMethods.h; sourceTree = "<group>"; };
9E4EBB4110892BDE0091C8E9 /* BridgedMethods.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BridgedMethods.m; sourceTree = "<group>"; };
9E52D2F8119B05EF00B831FC /* AppController+WebPolicyDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "AppController+WebPolicyDelegate.m"; sourceTree = "<group>"; };
9E535D04104F6F4900C119FA /* AppController+MainMenu.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "AppController+MainMenu.m"; sourceTree = "<group>"; };
9E535D30104F73FB00C119FA /* MenuBridge.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MenuBridge.h; sourceTree = "<group>"; };
9E535D31104F73FB00C119FA /* MenuBridge.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MenuBridge.m; sourceTree = "<group>"; };
9E535D35104F761F00C119FA /* MenuItemBridge.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MenuItemBridge.h; sourceTree = "<group>"; };
9E535D36104F761F00C119FA /* MenuItemBridge.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MenuItemBridge.m; sourceTree = "<group>"; };
9E55CFE30FE8750C007D1D64 /* Console.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Console.h; sourceTree = "<group>"; };
9E55CFE40FE8750C007D1D64 /* Console.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Console.m; sourceTree = "<group>"; };
9E5D4F0B1090FB6E00E76B38 /* WebWindow.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebWindow.h; sourceTree = "<group>"; };
9E5D4F0C1090FB6E00E76B38 /* WebWindow.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = WebWindow.m; sourceTree = "<group>"; };
9E9DD6BF0FC93C7A0001EF2E /* WebKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = WebKit.framework; path = System/Library/Frameworks/WebKit.framework; sourceTree = SDKROOT; };
9EA1BEF5107E7EE500CDE684 /* Application.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Application.h; sourceTree = "<group>"; };
9EA1BEF6107E7EE500CDE684 /* Application.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Application.m; sourceTree = "<group>"; };
9EB99C940FD8968100AA94A2 /* AppController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AppController.h; sourceTree = "<group>"; };
9EB99C950FD8968100AA94A2 /* AppController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AppController.m; sourceTree = "<group>"; };
9EBC421C10B1D07100C2AE33 /* NSObject+WebAdditions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSObject+WebAdditions.h"; sourceTree = "<group>"; };
9EBC421D10B1D07100C2AE33 /* NSObject+WebAdditions.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSObject+WebAdditions.m"; sourceTree = "<group>"; };
9ED96C871020072300D24B9C /* AppController+WebUIDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "AppController+WebUIDelegate.m"; sourceTree = "<group>"; };
9ED96C881020072300D24B9C /* AppController+WebFrameLoadDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "AppController+WebFrameLoadDelegate.m"; sourceTree = "<group>"; };
9ED96C891020072300D24B9C /* AppController+WebResourceLoadDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "AppController+WebResourceLoadDelegate.m"; sourceTree = "<group>"; };
AD8D31C4108F98B00008F7C4 /* SSCrypto.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SSCrypto.h; sourceTree = "<group>"; };
AD8D31C5108F98B00008F7C4 /* SSCrypto.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SSCrypto.m; sourceTree = "<group>"; };
AD8D31C8108F98E40008F7C4 /* libssl.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libssl.dylib; path = /usr/lib/libssl.dylib; sourceTree = "<absolute>"; };
AD8D31CA108F98EF0008F7C4 /* libcrypto.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libcrypto.dylib; path = /usr/lib/libcrypto.dylib; sourceTree = "<absolute>"; };
AD8D350E109040300008F7C4 /* IOKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = IOKit.framework; path = /System/Library/Frameworks/IOKit.framework; sourceTree = "<absolute>"; };
ADCCEF3210D4370F0055BDFD /* WebPasteboardProxy.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebPasteboardProxy.h; sourceTree = "<group>"; };
ADCCEF3310D4370F0055BDFD /* WebPasteboardProxy.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = WebPasteboardProxy.m; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
8D11072E0486CEB800E47090 /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
8D11072F0486CEB800E47090 /* Cocoa.framework in Frameworks */,
9E9DD6C00FC93C7A0001EF2E /* WebKit.framework in Frameworks */,
AD8D31C9108F98E40008F7C4 /* libssl.dylib in Frameworks */,
AD8D31CB108F98EF0008F7C4 /* libcrypto.dylib in Frameworks */,
AD8D350F109040300008F7C4 /* IOKit.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXFrameworksBuildPhase section */
/* Begin PBXGroup section */
080E96DDFE201D6D7F000001 /* Classes */ = {
isa = PBXGroup;
children = (
9E535D04104F6F4900C119FA /* AppController+MainMenu.m */,
9ED96C881020072300D24B9C /* AppController+WebFrameLoadDelegate.m */,
9ED96C891020072300D24B9C /* AppController+WebResourceLoadDelegate.m */,
9ED96C871020072300D24B9C /* AppController+WebUIDelegate.m */,
9E52D2F8119B05EF00B831FC /* AppController+WebPolicyDelegate.m */,
9EB99C940FD8968100AA94A2 /* AppController.h */,
9EB99C950FD8968100AA94A2 /* AppController.m */,
9EA1BEF5107E7EE500CDE684 /* Application.h */,
9EA1BEF6107E7EE500CDE684 /* Application.m */,
9E55CFE30FE8750C007D1D64 /* Console.h */,
9E55CFE40FE8750C007D1D64 /* Console.m */,
9E2E5338103B33CB00DF2D13 /* Server.h */,
9E2E5339103B33CB00DF2D13 /* Server.m */,
AD8D31C4108F98B00008F7C4 /* SSCrypto.h */,
AD8D31C5108F98B00008F7C4 /* SSCrypto.m */,
9E5D4F0B1090FB6E00E76B38 /* WebWindow.h */,
9E5D4F0C1090FB6E00E76B38 /* WebWindow.m */,
9E1E34190FCC82A5007F8CA0 /* Bridge */,
);
name = Classes;
sourceTree = "<group>";
};
1058C7A0FEA54F0111CA2CBB /* Linked Frameworks */ = {
isa = PBXGroup;
children = (
AD8D31CA108F98EF0008F7C4 /* libcrypto.dylib */,
AD8D31C8108F98E40008F7C4 /* libssl.dylib */,
1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */,
AD8D350E109040300008F7C4 /* IOKit.framework */,
);
name = "Linked Frameworks";
sourceTree = "<group>";
};
1058C7A2FEA54F0111CA2CBB /* Other Frameworks */ = {
isa = PBXGroup;
children = (
29B97324FDCFA39411CA2CEA /* AppKit.framework */,
13E42FB307B3F0F600E4EEF1 /* CoreData.framework */,
29B97325FDCFA39411CA2CEA /* Foundation.framework */,
9E9DD6BF0FC93C7A0001EF2E /* WebKit.framework */,
);
name = "Other Frameworks";
sourceTree = "<group>";
};
19C28FACFE9D520D11CA2CBB /* Products */ = {
isa = PBXGroup;
children = (
8D1107320486CEB800E47090 /* NativeHost.app */,
);
name = Products;
sourceTree = "<group>";
};
29B97314FDCFA39411CA2CEA /* NativeHost */ = {
isa = PBXGroup;
children = (
080E96DDFE201D6D7F000001 /* Classes */,
29B97315FDCFA39411CA2CEA /* Other Sources */,
29B97317FDCFA39411CA2CEA /* Resources */,
29B97323FDCFA39411CA2CEA /* Frameworks */,
19C28FACFE9D520D11CA2CBB /* Products */,
);
name = NativeHost;
sourceTree = "<group>";
};
29B97315FDCFA39411CA2CEA /* Other Sources */ = {
isa = PBXGroup;
children = (
29B97316FDCFA39411CA2CEA /* main.m */,
32CA4F630368D1EE00C91783 /* NativeHost_Prefix.pch */,
);
name = "Other Sources";
sourceTree = "<group>";
};
29B97317FDCFA39411CA2CEA /* Resources */ = {
isa = PBXGroup;
children = (
4D55A7931180F1BE00B5187D /* icon.icns */,
8D1107310486CEB800E47090 /* Info.plist */,
089C165CFE840E0CC02AAC07 /* InfoPlist.strings */,
1DDD58140DA1D0A300B32029 /* MainMenu.xib */,
);
name = Resources;
sourceTree = "<group>";
};
29B97323FDCFA39411CA2CEA /* Frameworks */ = {
isa = PBXGroup;
children = (
1058C7A0FEA54F0111CA2CBB /* Linked Frameworks */,
1058C7A2FEA54F0111CA2CBB /* Other Frameworks */,
);
name = Frameworks;
sourceTree = "<group>";
};
9E1E34190FCC82A5007F8CA0 /* Bridge */ = {
isa = PBXGroup;
children = (
9E535DB7104F923E00C119FA /* Menus */,
9E4EBB4010892BDE0091C8E9 /* BridgedMethods.h */,
9E4EBB4110892BDE0091C8E9 /* BridgedMethods.m */,
9EBC421C10B1D07100C2AE33 /* NSObject+WebAdditions.h */,
9EBC421D10B1D07100C2AE33 /* NSObject+WebAdditions.m */,
9E44CA9B0FD798FE00860A54 /* NSURL+Additions.h */,
9E44CA9C0FD798FE00860A54 /* NSURL+Additions.m */,
ADCCEF3210D4370F0055BDFD /* WebPasteboardProxy.h */,
ADCCEF3310D4370F0055BDFD /* WebPasteboardProxy.m */,
9E43AC82104DB51400263989 /* WebScripObject+Objective-J.h */,
9E43AC83104DB51400263989 /* WebScripObject+Objective-J.m */,
);
name = Bridge;
sourceTree = "<group>";
};
9E535DB7104F923E00C119FA /* Menus */ = {
isa = PBXGroup;
children = (
9E535D30104F73FB00C119FA /* MenuBridge.h */,
9E535D31104F73FB00C119FA /* MenuBridge.m */,
9E535D35104F761F00C119FA /* MenuItemBridge.h */,
9E535D36104F761F00C119FA /* MenuItemBridge.m */,
);
name = Menus;
sourceTree = "<group>";
};
/* End PBXGroup section */
/* Begin PBXNativeTarget section */
8D1107260486CEB800E47090 /* NativeHost */ = {
isa = PBXNativeTarget;
buildConfigurationList = C01FCF4A08A954540054247B /* Build configuration list for PBXNativeTarget "NativeHost" */;
buildPhases = (
8D1107290486CEB800E47090 /* Resources */,
8D11072C0486CEB800E47090 /* Sources */,
8D11072E0486CEB800E47090 /* Frameworks */,
);
buildRules = (
);
dependencies = (
);
name = NativeHost;
productInstallPath = "$(HOME)/Applications";
productName = NativeHost;
productReference = 8D1107320486CEB800E47090 /* NativeHost.app */;
productType = "com.apple.product-type.application";
};
/* End PBXNativeTarget section */
/* Begin PBXProject section */
29B97313FDCFA39411CA2CEA /* Project object */ = {
isa = PBXProject;
attributes = {
LastUpgradeCheck = 0440;
};
buildConfigurationList = C01FCF4E08A954540054247B /* Build configuration list for PBXProject "NativeHost" */;
compatibilityVersion = "Xcode 3.2";
developmentRegion = English;
hasScannedForEncodings = 1;
knownRegions = (
en,
);
mainGroup = 29B97314FDCFA39411CA2CEA /* NativeHost */;
projectDirPath = "";
projectRoot = "";
targets = (
8D1107260486CEB800E47090 /* NativeHost */,
);
};
/* End PBXProject section */
/* Begin PBXResourcesBuildPhase section */
8D1107290486CEB800E47090 /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
8D11072B0486CEB800E47090 /* InfoPlist.strings in Resources */,
1DDD58160DA1D0A300B32029 /* MainMenu.xib in Resources */,
4D55A7941180F1E000B5187D /* icon.icns in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXResourcesBuildPhase section */
/* Begin PBXSourcesBuildPhase section */
8D11072C0486CEB800E47090 /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
9E535D05104F6F4900C119FA /* AppController+MainMenu.m in Sources */,
9ED96C8B1020072300D24B9C /* AppController+WebFrameLoadDelegate.m in Sources */,
9ED96C8C1020072300D24B9C /* AppController+WebResourceLoadDelegate.m in Sources */,
9ED96C8A1020072300D24B9C /* AppController+WebUIDelegate.m in Sources */,
9EB99C960FD8968100AA94A2 /* AppController.m in Sources */,
9EA1BEF7107E7EE500CDE684 /* Application.m in Sources */,
9E4EBB4210892BDE0091C8E9 /* BridgedMethods.m in Sources */,
9E55CFE50FE8750C007D1D64 /* Console.m in Sources */,
8D11072D0486CEB800E47090 /* main.m in Sources */,
9E535D32104F73FB00C119FA /* MenuBridge.m in Sources */,
9E535D37104F761F00C119FA /* MenuItemBridge.m in Sources */,
9EBC421E10B1D07100C2AE33 /* NSObject+WebAdditions.m in Sources */,
9E44CA9D0FD798FE00860A54 /* NSURL+Additions.m in Sources */,
9E2E533A103B33CB00DF2D13 /* Server.m in Sources */,
AD8D31C6108F98B00008F7C4 /* SSCrypto.m in Sources */,
ADCCEF6810D43C970055BDFD /* WebPasteboardProxy.m in Sources */,
9E43AC84104DB51400263989 /* WebScripObject+Objective-J.m in Sources */,
9E5D4F0D1090FB6E00E76B38 /* WebWindow.m in Sources */,
9E52D2F9119B05EF00B831FC /* AppController+WebPolicyDelegate.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXSourcesBuildPhase section */
/* Begin PBXVariantGroup section */
089C165CFE840E0CC02AAC07 /* InfoPlist.strings */ = {
isa = PBXVariantGroup;
children = (
089C165DFE840E0CC02AAC07 /* English */,
);
name = InfoPlist.strings;
sourceTree = "<group>";
};
1DDD58140DA1D0A300B32029 /* MainMenu.xib */ = {
isa = PBXVariantGroup;
children = (
1DDD58150DA1D0A300B32029 /* English */,
);
name = MainMenu.xib;
sourceTree = "<group>";
};
/* End PBXVariantGroup section */
/* Begin XCBuildConfiguration section */
C01FCF4B08A954540054247B /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
COMBINE_HIDPI_IMAGES = YES;
COPY_PHASE_STRIP = NO;
GCC_DYNAMIC_NO_PIC = NO;
GCC_MODEL_TUNING = G5;
GCC_OPTIMIZATION_LEVEL = 0;
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = NativeHost_Prefix.pch;
GCC_PREPROCESSOR_DEFINITIONS = "ACTIVATION=0";
GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
INFOPLIST_FILE = Info.plist;
INFOPLIST_PREPROCESS = YES;
INFOPLIST_PREPROCESSOR_DEFINITIONS = "ACTIVATION=0";
INSTALL_PATH = "$(HOME)/Applications";
PRODUCT_NAME = NativeHost;
};
name = Debug;
};
C01FCF4C08A954540054247B /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
COMBINE_HIDPI_IMAGES = YES;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
GCC_MODEL_TUNING = G5;
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = NativeHost_Prefix.pch;
GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
INFOPLIST_FILE = Info.plist;
INFOPLIST_PREPROCESS = YES;
INFOPLIST_PREPROCESSOR_DEFINITIONS = "ACTIVATION=0";
INSTALL_PATH = "$(HOME)/Applications";
PRODUCT_NAME = NativeHost;
};
name = Release;
};
C01FCF4F08A954540054247B /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ARCHS = "$(ARCHS_STANDARD_32_BIT)";
GCC_C_LANGUAGE_STANDARD = c99;
GCC_OPTIMIZATION_LEVEL = 0;
GCC_VERSION = 4.2;
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = macosx;
};
name = Debug;
};
C01FCF5008A954540054247B /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ARCHS = "$(ARCHS_STANDARD_32_BIT)";
GCC_C_LANGUAGE_STANDARD = c99;
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
SDKROOT = macosx;
};
name = Release;
};
/* End XCBuildConfiguration section */
/* Begin XCConfigurationList section */
C01FCF4A08A954540054247B /* Build configuration list for PBXNativeTarget "NativeHost" */ = {
isa = XCConfigurationList;
buildConfigurations = (
C01FCF4B08A954540054247B /* Debug */,
C01FCF4C08A954540054247B /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
C01FCF4E08A954540054247B /* Build configuration list for PBXProject "NativeHost" */ = {
isa = XCConfigurationList;
buildConfigurations = (
C01FCF4F08A954540054247B /* Debug */,
C01FCF5008A954540054247B /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
/* End XCConfigurationList section */
};
rootObject = 29B97313FDCFA39411CA2CEA /* Project object */;
}
-8
View File
@@ -1,8 +0,0 @@
//
// Prefix header for all source files of the 'NativeHost' target in the 'NativeHost' project
//
#ifdef __OBJC__
#import <Cocoa/Cocoa.h>
#import <WebKit/WebKit.h>
#endif
-116
View File
@@ -1,116 +0,0 @@
/*
Copyright (c) 2003-2006, Septicus Software All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
* Neither the name of Septicus Software nor the names of its contributors
may be used to endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
//
// SSCrypto.h
//
// Created by Ed Silva on Sat May 31 2003.
// Copyright (c) 2003-2006 Septicus Software. All rights reserved.
//
#import <Foundation/Foundation.h>
#import <openssl/evp.h>
#import <openssl/rand.h>
#import <openssl/rsa.h>
#import <openssl/engine.h>
#import <openssl/sha.h>
#import <openssl/pem.h>
#import <openssl/bio.h>
#import <openssl/err.h>
#import <openssl/ssl.h>
#import <openssl/md5.h>
@interface NSData (HexDump)
- (NSString *)encodeBase64;
- (NSString *)encodeBase64WithNewlines:(BOOL)encodeWithNewlines;
- (NSData *)decodeBase64;
- (NSData *)decodeBase64WithNewLines:(BOOL)decodeWithNewLines;
- (NSString *)hexval;
- (NSString *)hexdump;
@end
@interface SSCrypto : NSObject
{
NSData *symmetricKey;
NSData *cipherText;
NSData *clearText;
NSData *publicKey;
NSData *privateKey;
BOOL isSymmetric;
}
- (id)init;
- (id)initWithSymmetricKey:(NSData *)k;
- (id)initWithPublicKey:(NSData *)pub;
- (id)initWithPrivateKey:(NSData *)priv;
- (id)initWithPublicKey:(NSData *)pub privateKey:(NSData *)priv;
- (BOOL)isSymmetric;
- (void)setIsSymmetric:(BOOL)flag;
- (NSData *)symmetricKey;
- (void)setSymmetricKey:(NSData *)k;
- (NSData *)publicKey;
- (void)setPublicKey:(NSData *)k;
- (NSData *)privateKey;
- (void)setPrivateKey:(NSData *)k;
- (NSData *)clearTextAsData;
- (NSString *)clearTextAsString;
- (void)setClearTextWithData:(NSData *)c;
- (void)setClearTextWithString:(NSString *)c;
- (NSData *)cipherTextAsData;
- (NSString *)cipherTextAsString;
- (void)setCipherText:(NSData *)c;
- (NSData *)decrypt;
- (NSData *)decrypt:(NSString *)cipherName;
- (NSData *)verify;
- (NSData *)encrypt;
- (NSData *)encrypt:(NSString *)cipherName;
- (NSData *)sign;
- (NSData *)digest:(NSString *)digestName;
+ (NSData *)generateRSAPrivateKeyWithLength:(int)length;
+ (NSData *)generateRSAPublicKeyFromPrivateKey:(NSData *)privateKey;
+ (NSData *)getKeyDataWithLength:(int)length;
+ (NSData *)getKeyDataWithLength:(int)length fromPassword:(NSString *)pass withSalt:(NSString *)salt;
+ (NSData *)getKeyDataWithLength:(int)length fromPassword:(NSString *)pass withSalt:(NSString *)salt withIterations:(int)count;
+ (NSData *)getSHA1ForData:(NSData *)d;
+ (NSData *)getMD5ForData:(NSData *)d;
@end
File diff suppressed because it is too large. Load diff
-21
View File
@@ -1,21 +0,0 @@
//
// Server.h
// NativeHost
//
// Created by Francisco Tolmasky on 8/18/09.
// Copyright 2009 280 North, Inc.. All rights reserved.
//
#import <Cocoa/Cocoa.h>
@interface Server : NSObject
{
NSFileHandle * outputFile;
NSFileHandle * errorFile;
NSTask * process;
}
- (BOOL)start;
- (void)stop;
@end
-193
View File
@@ -1,193 +0,0 @@
//
// Server.m
// NativeHost
//
// Created by Francisco Tolmasky on 8/18/09.
// Copyright 2009 280 North, Inc.. All rights reserved.
//
#import "Server.h"
#import "AppController.h"
#import <sys/socket.h>
#import <netinet/in.h>
@implementation Server
- (BOOL)start
{
NSBundle *mainBundle = [NSBundle mainBundle];
NSString *serverPath = [mainBundle pathForResource:@"NativeHostServer" ofType:@"" inDirectory:@"Server"];
if (!serverPath)
{
return YES;
}
// find an available port
struct sockaddr_in addr;
int sockfd;
int attempts = 0;
while (SERVER_PORT == 9191 && attempts++ < 5)
{
// Create a socket
sockfd = socket( AF_INET, SOCK_STREAM, 0 );
// Setup its address structure
bzero( &addr, sizeof(struct sockaddr_in));
addr.sin_family = AF_INET;
addr.sin_addr.s_addr = htonl( INADDR_ANY );
addr.sin_port = htons( 0 );
// Bind it to an address and port
bind( sockfd, (struct sockaddr *)&addr, sizeof(struct sockaddr));
// Set it listening for connections
listen( sockfd, 5 );
// Find out what port the socket was bound to
socklen_t namelen = sizeof(struct sockaddr_in);
getsockname( sockfd, (struct sockaddr *)&addr, &namelen );
if (addr.sin_port <= 1024)
addr.sin_port = 9191;
else
SERVER_PORT = addr.sin_port;
shutdown(sockfd, 2);
}
if (SERVER_PASSWORD == nil)
{
CFUUIDRef uuidObj = CFUUIDCreate(nil);
SERVER_PASSWORD = (NSString*)CFUUIDCreateString(nil, uuidObj);
CFRelease(uuidObj);
}
if (SERVER_USER == nil)
{
CFUUIDRef uuidObj = CFUUIDCreate(nil);
SERVER_USER = (NSString*)CFUUIDCreateString(nil, uuidObj);
CFRelease(uuidObj);
// usernames can't have "-" in them
SERVER_USER = [[SERVER_USER autorelease] stringByReplacingOccurrencesOfString:@"-" withString:@""];
}
// setup environment variables
NSDictionary *env = [[[NSProcessInfo processInfo] environment] mutableCopy];
[env setValue:[mainBundle resourcePath] forKey:@"NATIVEHOST_RESOURCES"];
[env setValue:[[NSNumber numberWithInt:SERVER_PORT] stringValue] forKey:@"NATIVEHOST_SERVER_PORT"];
[env setValue:SERVER_USER forKey:@"NATIVEHOST_SERVER_USER"];
[env setValue:SERVER_PASSWORD forKey:@"NATIVEHOST_SERVER_PASSWORD"];
// create pipes for stdout and stderr
NSPipe * outputPipe = [NSPipe pipe];
outputFile = [outputPipe fileHandleForReading];
NSPipe * errorPipe = [NSPipe pipe];
errorFile = [errorPipe fileHandleForReading];
// setup the process
process = [[NSTask alloc] init];
[process setLaunchPath:serverPath];
[process setStandardOutput:outputPipe];
[process setStandardError:errorPipe];
[process setEnvironment:env];
[env release];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(serverDidTerminate:)
name:NSTaskDidTerminateNotification
object:process];
[process launch];
BOOL didStartup = NO;
NSData * data = nil;
while (!didStartup && (data = [outputFile availableData]) && [data length])
{
NSString * string = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding];
if (string)
{
NHLog(@"SERVER-OUT", string);
didStartup = [string rangeOfString:@"Jack is starting up"].location != NSNotFound;
[string release];
}
}
NSLog(@"Server has started.");
[[NSNotificationCenter defaultCenter]
addObserver:self
selector:@selector(didReadStdOut:)
name:NSFileHandleReadCompletionNotification
object:outputFile];
[[NSNotificationCenter defaultCenter]
addObserver:self
selector:@selector(didReadStdErr:)
name:NSFileHandleReadCompletionNotification
object:errorFile];
[outputFile readInBackgroundAndNotify];
[errorFile readInBackgroundAndNotify];
return didStartup;
}
- (void)stop
{
[process terminate];
}
- (void)didReadStdOut:(NSNotification *)aNotification
{
NSString * string = [[NSString alloc] initWithData:[[aNotification userInfo] objectForKey:NSFileHandleNotificationDataItem]
encoding:NSASCIIStringEncoding];
NHLog(@"SERVER-OUT", string);
[string release];
[outputFile readInBackgroundAndNotify];
}
- (void)didReadStdErr:(NSNotification *)aNotification
{
NSString * string = [[NSString alloc] initWithData:[[aNotification userInfo] objectForKey:NSFileHandleNotificationDataItem]
encoding:NSASCIIStringEncoding];
NHLog(@"SERVER-ERR", string);
[string release];
[errorFile readInBackgroundAndNotify];
}
- (void)serverDidTerminate:(NSNotification *)note
{
if ([process terminationStatus] != 0)
{
NSString *appName = [[[NSBundle mainBundle] localizedInfoDictionary] objectForKey:@"CFBundleDisplayName"];
if (appName == nil)
appName = [[NSProcessInfo processInfo] processName];
if (SERVER_PORT != 9191 && [self start])
{
NSRunAlertPanel(@"Unexpected Error",
[NSString stringWithFormat:@"%@ was not able to complete the last action you performed. Try again, and report the problem if it continues to occur.", appName],
@"OK", nil, nil);
}
else
{
NSRunAlertPanel(@"Unexpected Error",
[NSString stringWithFormat:@"A fatal error occurred. %@ could not recover and must terminate.", appName],
@"Terminate", nil, nil);
exit(1);
}
}
}
- (void)dealloc
{
[process release];
[super dealloc];
}
@end
-19
View File
@@ -1,19 +0,0 @@
//
// WebPasteboardProxy.h
// NativeHost
//
// Created by Ross Boucher on 12/12/09.
// Copyright 2009 280 North. All rights reserved.
//
#import <Cocoa/Cocoa.h>
@interface WebPasteboardProxy : NSObject
{
NSPasteboard *pasteboard;
}
+ (id)pasteboardWithName:(NSString *)aName;
@end
-95
View File
@@ -1,95 +0,0 @@
//
// WebPasteboardProxy.m
// NativeHost
//
// Created by Ross Boucher on 12/12/09.
// Copyright 2009 280 North. All rights reserved.
//
#import "WebPasteboardProxy.h"
#import "WebScripObject+Objective-J.h"
#import "BridgedMethods.h"
NSMutableDictionary *WebPasteboardDictionary = nil;
@implementation WebPasteboardProxy
+ (void)initialize
{
WebPasteboardDictionary = [[NSMutableDictionary dictionary] retain];
}
+ (BOOL)isSelectorExcludedFromWebScript:(SEL)aSelector
{
return NO;
}
+ (id)pasteboardWithName:(NSString *)aName
{
if ([aName isEqual:@"CPGeneralPboard"])
return [self pasteboardWithName:NSGeneralPboard];
id proxy = [WebPasteboardDictionary objectForKey:aName];
if (!proxy)
{
proxy = [[self alloc] initWithPasteboard:[NSPasteboard pasteboardWithName:aName]];
[WebPasteboardDictionary setObject:proxy forKey:aName];
[proxy release];
}
return proxy;
}
- (id)initWithPasteboard:(NSPasteboard *)aPasteboard
{
if (self = [super init])
{
pasteboard = [aPasteboard retain];
}
return self;
}
- (void)dealloc
{
[pasteboard release];
[super dealloc];
}
- (int)changeCount
{
return [pasteboard changeCount];
}
- (void)declareTypes:(WebScriptObject *)args
{
[pasteboard declareTypes:[BridgedMethods arrayFromWebScriptObject:args] owner:self];
}
- (void)addTypes:(WebScriptObject *)args
{
[pasteboard addTypes:[BridgedMethods arrayFromWebScriptObject:args ] owner:self];
}
- (NSArray *)types
{
return [pasteboard types];
}
- (NSString *)stringForType:(NSString *)aType
{
return [pasteboard stringForType:aType];
}
- (void)pasteboard:(NSPasteboard *)aPasteboard provideDataForType:(NSString *)aType
{
NSString *name = aPasteboard == [NSPasteboard generalPasteboard] ? @"CPGeneralPboard" : [aPasteboard name];
NSString *data = [[[NSApp delegate] windowScriptObject] evaluateObjectiveJReturningString:
[NSString stringWithFormat:@"[[CPPasteboard pasteboardWithName:'%@'] stringForType:'%@']", name, aType]
];
[aPasteboard setString:data forType:aType];
}
@end
@@ -1,22 +0,0 @@
//
// WebScripObject+Objective-J.h
// NativeHost
//
// Created by Francisco Tolmasky on 9/1/09.
// Copyright 2009 280 North, Inc.. All rights reserved.
//
#import <Cocoa/Cocoa.h>
#import <WebKit/WebKit.h>
@interface WebScriptObject (ObjectiveJ)
- (id)evaluateObjectiveJ:(NSString *)aString;
- (NSString *)evaluateObjectiveJReturningString:(NSString *)aString;
- (id)bridgeSelector:(SEL)aSelector;
- (id)bridgeSelector:(SEL)aSelector withObject:(id)anObject;
- (id)bridgeSelector:(SEL)aSelector withObjects:(NSArray *)array;
@end
@@ -1,46 +0,0 @@
//
// WebScripObject+Objective-J.m
// NativeHost
//
// Created by Francisco Tolmasky on 9/1/09.
// Copyright 2009 280 North, Inc.. All rights reserved.
//
#import "WebScripObject+Objective-J.h"
@implementation WebScriptObject (ObjectiveJ)
- (id)evaluateObjectiveJ:(NSString *)aString
{
return [self evaluateWebScript:[NSString stringWithFormat:@"(ObjectiveJ.eval(decodeURIComponent(\"%@\")))", [aString stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding], nil]];
}
- (NSString *)evaluateObjectiveJReturningString:(NSString *)aString
{
return [self evaluateWebScript:[NSString stringWithFormat:@"String(ObjectiveJ.eval(decodeURIComponent(\"%@\")))", [aString stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding], nil]];
}
- (id)bridgeSelector:(SEL)aSelector
{
return [self bridgeSelector:aSelector withObjects:nil];
}
- (id)bridgeSelector:(SEL)aSelector withObject:(id)anObject
{
return [self bridgeSelector:aSelector withObjects:[NSArray arrayWithObject:anObject]];
}
- (id)bridgeSelector:(SEL)aSelector withObjects:(NSArray *)objects
{
[self evaluateWebScript:@"objj_object.prototype.__objj_msgSend = function() { return objj_msgSend.apply(null, arguments); }"];
NSArray * arguments = [NSArray arrayWithObjects:self, NSStringFromSelector(aSelector), nil];
if (objects)
arguments = [arguments arrayByAddingObjectsFromArray:objects];
return [self callWebScriptMethod:@"__objj_msgSend" withArguments:arguments];
}
@end
-44
View File
@@ -1,44 +0,0 @@
//
// WebWindow.h
// NativeHost
//
// Created by Francisco Tolmasky on 10/18/09.
// Copyright 2009 280 North, Inc.. All rights reserved.
//
#import <Cocoa/Cocoa.h>
typedef enum _CPWindowShadowStyle
{
CPStandardWindowShadowStyle = 0,
CPMenuWindowShadowStyle = 1,
CPPanelWindowShadowStyle = 2,
CPCustomWindowShadowStyle = 3
} CPWindowShadowStyle;
@interface WebWindow : NSWindow
{
NSView * leftMouseDownView;
NSView * rightMouseDownView;
WebView * webView;
NSView * shadowView;
BOOL hasShadow;
CPWindowShadowStyle shadowStyle;
}
+ (WebWindow *)webWindow;
- (WebView *)webView;
- (BOOL)hitTest:(NSPoint)aPoint;
- (BOOL)hasShadow;
- (void)setHasShadow:(BOOL)shouldHaveShadow;
- (void)setShadowStyle:(CPWindowShadowStyle)aStyle;
- (CPWindowShadowStyle)shadowStyle;
@end
-515
View File
@@ -1,515 +0,0 @@
//
// WebWindow.m
// NativeHost
//
// Created by Francisco Tolmasky on 10/18/09.
// Copyright 2009 280 North, Inc.. All rights reserved.
//
#import "WebWindow.h"
static NSMutableArray * DisabledWindows;
CFMachPortRef tap_port;
CGEventRef headTapCallback(CGEventTapProxy proxy, CGEventType type, CGEventRef event, void *refcon)
{
// It's dangerous to fail in this code: could disable mousedown system-wide. So just try catch it all.
@try
{
if (type == kCGEventLeftMouseDown)
{
CGPoint location = CGEventGetLocation(event);
NSPoint NSLocation = NSMakePoint(location.x, location.y);
for (NSWindow * window in [NSApp windows])
{
if ([window isKindOfClass:[WebWindow class]] && ![(WebWindow *)window hitTest:NSLocation])
{
[window setIgnoresMouseEvents:YES];
[window performSelector:@selector(setIgnoresMouseEvents:) withObject:NO afterDelay:1.0];
[DisabledWindows addObject:window];
}
}
}
else if (type == kCGEventTapDisabledByTimeout)
CGEventTapEnable(tap_port, YES);
}
@catch (NSException * anException)
{
}
return event;
}
@interface WebWindowContentView : NSView
{
}
@end
@implementation WebWindow
+ (void)enableAllWindows
{
[DisabledWindows makeObjectsPerformSelector:@selector(stopIgnoringMouseEvents)];
[DisabledWindows removeAllObjects];
}
+ (void)initialize
{
if (self != [WebWindow class])
return;
DisabledWindows = [[NSMutableArray alloc] init];
//| CGEventMaskBit(kCGEventTapDisabledByTimeout)
tap_port = CGEventTapCreate(kCGSessionEventTap, kCGHeadInsertEventTap,
kCGEventTapOptionDefault,
CGEventMaskBit(kCGEventLeftMouseDown),
headTapCallback, NULL);
if (NULL == tap_port)
{
fprintf(stderr, "Error creating event tap\n");
return;
}
/* Create a run loop source from the tap port, add it to my run loop
* and start executing the loop
*/
CFRunLoopSourceRef tap_source = CFMachPortCreateRunLoopSource(kCFAllocatorDefault, tap_port, 0);
if (NULL == tap_source)
{
fprintf(stderr, "Error converting port to run loop source\n");
if (tap_port != NULL)
CFRelease(tap_port);
return;
}
CFRunLoopAddSource(CFRunLoopGetCurrent(), tap_source, kCFRunLoopCommonModes);
}
- (id)initWithContentRect:(NSRect)aContentRect styleMask:(NSUInteger)windowStyle backing:(NSBackingStoreType)aBufferingType defer:(BOOL)shouldDeferCreation
{
self = [super initWithContentRect:aContentRect styleMask:NSBorderlessWindowMask backing:aBufferingType defer:shouldDeferCreation];
if (self)
{
id delegate = [NSApp delegate];
shadowView = [[WebWindowContentView alloc] init];
[self setContentView:shadowView];
webView = [[WebView alloc] initWithFrame:NSZeroRect];
[webView setDrawsBackground:NO];
[webView setUIDelegate:delegate];
[webView setFrameLoadDelegate:delegate];
[webView setResourceLoadDelegate:delegate];
[webView setPolicyDelegate:delegate];
[webView setShouldCloseWithWindow:YES];
[shadowView addSubview:webView];
[self setBackgroundColor:[NSColor clearColor]];
[self setOpaque:NO];
[self setIgnoresMouseEvents:NO];
[self setReleasedWhenClosed:YES];
[super setHasShadow:NO];
}
return self;
}
- (void)setFrame:(NSRect)aFrame display:(BOOL)shouldDisplay
{
[webView setFrame:NSMakeRect(33.0, 33.0, NSWidth(aFrame), NSHeight(aFrame))];
[super setFrame:NSInsetRect(aFrame, -33.0, -33.0) display:YES];
}
- (void)dealloc
{
[[NSNotificationCenter defaultCenter] removeObserver:self name:NSWindowDidResizeNotification object:self];
[[NSNotificationCenter defaultCenter] removeObserver:self name:NSWindowDidBecomeKeyNotification object:self];
[[NSNotificationCenter defaultCenter] removeObserver:self name:NSWindowDidResignKeyNotification object:self];
[shadowView release];
[webView release];
[super dealloc];
}
- (BOOL)canBecomeKeyWindow
{
// Necessary since this apparently returns NO for borderless windows.
return YES;
}
- (NSView *)webHitTest:(NSPoint)aPoint
{
NSPoint locationInWebView = [[self contentView] convertPoint:aPoint fromView:nil];
return [(NSView *)[self contentView] hitTest:locationInWebView];
}
- (void)sendEvent:(NSEvent *)anEvent
{
NSInteger type = [anEvent type];
if (type == NSLeftMouseDown)
{
NSView * view = [self webHitTest:[anEvent locationInWindow]];
leftMouseDownView = view;
[view mouseDown:anEvent];
}
else if (type == NSLeftMouseDragged)
[leftMouseDownView mouseDragged:anEvent];
else if (type == NSLeftMouseUp)
[leftMouseDownView mouseUp:anEvent];
else if (type == NSRightMouseDown)
{
NSView * view = [self webHitTest:[anEvent locationInWindow]];
rightMouseDownView = view;
[view rightMouseDown:anEvent];
}
else if (type == NSRightMouseDragged)
[rightMouseDownView rightMouseDragged:anEvent];
else if (type == NSRightMouseUp)
[rightMouseDownView rightMouseUp:anEvent];
else
[super sendEvent:anEvent];
// FIXME: other
}
// Override this to avoid the beep from unhandled events.
- (void)keyDown:(NSEvent *)anEvent
{
}
+ (WebWindow *)webWindow
{
return [[WebWindow alloc] initWithContentRect:NSZeroRect styleMask:NSBorderlessWindowMask backing:NSBackingStoreBuffered defer:YES];
}
- (WebView *)webView
{
return webView;
}
- (void)updateShadow
{
[super setHasShadow:hasShadow && shadowStyle == CPCustomWindowShadowStyle];
[shadowView setNeedsDisplay:YES];
}
- (BOOL)hasShadow
{
return hasShadow;
}
- (void)setHasShadow:(BOOL)shouldHaveShadow
{
if (hasShadow == shouldHaveShadow)
return;
hasShadow = shouldHaveShadow;
[self updateShadow];
}
- (CPWindowShadowStyle)shadowStyle
{
return shadowStyle;
}
- (void)setShadowStyle:(CPWindowShadowStyle)aStyle
{
if (shadowStyle == aStyle)
return;
shadowStyle = aStyle;
[self updateShadow];
}
- (BOOL)hitTest:(NSPoint)aPoint
{
NSInteger windowNumber = [[[webView windowScriptObject] valueForKey:@"cpWindowNumber"] intValue];
#if LOGGING
WebScriptObject * frame = [[[NSApp delegate] windowScriptObject] evaluateWebScript:[NSString stringWithFormat:@"(objj_msgSend(objj_msgSend(CPApp, \"windowWithWindowNumber:\", %d), \"frame\"))", windowNumber]],
* origin = [frame valueForKey:@"origin"],
* size = [frame valueForKey:@"size"];
NSLog(@"(%f, %f) in { %f, %f, %f, %f }", aPoint.x, aPoint.y, [[origin valueForKey:@"x"] floatValue], [[origin valueForKey:@"y"] floatValue], [[size valueForKey:@"width"] floatValue], [[size valueForKey:@"height"] floatValue]);
#endif
return [[[[NSApp delegate] windowScriptObject] evaluateWebScript:[NSString stringWithFormat:@"(CGRectContainsPoint(objj_msgSend(objj_msgSend(CPApp, \"windowWithWindowNumber:\", %d), \"frame\"), CGPointMake(%f, %f)))", windowNumber, aPoint.x, aPoint.y]] boolValue];
}
- (void)stopIgnoringMouseEvents
{
[self setIgnoresMouseEvents:NO];
}
- (void)becomeKeyWindow
{
[super becomeKeyWindow];
[self updateShadow];
}
- (void)resignKeyWindow
{
[super resignKeyWindow];
[self updateShadow];
}
@end
@interface NSImage (Additions)
- (void)drawInRect:(NSRect)aRect slices:(CGFloat [])slices;
@end
@implementation NSImage (Additions)
- (void)drawInRect:(NSRect)aRect slices:(CGFloat [])slices
{
NSRect imageBounds = NSMakeRect(0.0, 0.0, [self size].width, [self size].height);
[self drawInRect:NSMakeRect(0.0, 0.0, slices[0], slices[1])
fromRect:NSMakeRect(0.0, 0.0, slices[0], slices[1])
operation:NSCompositeSourceOver
fraction:1.0];
[self drawInRect:NSMakeRect(NSMaxX(aRect) - slices[2], 0.0, slices[2], slices[1])
fromRect:NSMakeRect(NSMaxX(imageBounds) - slices[2], 0.0, slices[2], slices[1])
operation:NSCompositeSourceOver
fraction:1.0];
[self drawInRect:NSMakeRect(0.0, NSMaxY(aRect) - slices[3], slices[0], slices[3])
fromRect:NSMakeRect(0.0, NSMaxY(imageBounds) - slices[3], slices[0], slices[3])
operation:NSCompositeSourceOver
fraction:1.0];
[self drawInRect:NSMakeRect(NSMaxX(aRect) - slices[2], NSMaxY(aRect) - slices[3], slices[2], slices[3])
fromRect:NSMakeRect(NSMaxX(imageBounds) - slices[2], NSMaxY(imageBounds) - slices[3], slices[2], slices[3])
operation:NSCompositeSourceOver
fraction:1.0];
[self drawInRect:NSMakeRect(slices[0], 0.0, NSWidth(aRect) - slices[0] - slices[2], slices[1])
fromRect:NSMakeRect(slices[0], 0.0, 1.0, slices[1])
operation:NSCompositeSourceOver
fraction:1.0];
[self drawInRect:NSMakeRect(0.0, slices[1], slices[0], NSHeight(aRect) - slices[1] - slices[3])
fromRect:NSMakeRect(0.0, slices[1], slices[0], 1.0)
operation:NSCompositeSourceOver
fraction:1.0];
[self drawInRect:NSMakeRect(NSMaxX(aRect) - slices[2], slices[1], slices[2], NSHeight(aRect) - slices[1] - slices[3])
fromRect:NSMakeRect(NSMaxX(imageBounds) - slices[2], slices[1], slices[2], 1.0)
operation:NSCompositeSourceOver
fraction:1.0];
[self drawInRect:NSMakeRect(slices[0], NSMaxY(aRect) - slices[3], NSWidth(aRect) - slices[0] - slices[2], slices[3])
fromRect:NSMakeRect(slices[0], NSMaxY(imageBounds) - slices[3], 1.0, slices[3])
operation:NSCompositeSourceOver
fraction:1.0];
}
@end
@implementation WebWindowContentView : NSView
{
}
static float OUTlINE_HORIZONTAL_INSET = 33.0;
static float OUTlINE_VERTICAL_INSET = 33.0;
- (void)drawStandardActiveShadowInRect:(NSRect)aRect
{
CGContextRef context = [[NSGraphicsContext currentContext] graphicsPort];
CGRect bounds = CGRectInset(*(CGRect *)&aRect, OUTlINE_HORIZONTAL_INSET - 0.5, OUTlINE_VERTICAL_INSET - 0.5);
CGColorRef shadowColor = CGColorCreateGenericGray(0.0, 0.8);
CGContextSetShadowWithColor (context, CGSizeMake(0.0, -10.0), 100.0, shadowColor);
CGColorRelease(shadowColor);
CGColorRef fillColor = CGColorCreateGenericGray(1.0, 1.0);
CGColorRef strokeColor = CGColorCreateGenericGray(0.0, 0.2);
CGContextSetFillColorWithColor(context, fillColor);
CGContextSetStrokeColorWithColor(context, strokeColor);
CGColorRelease(fillColor);
CGColorRelease(strokeColor);
CGContextBeginPath(context);
CGContextAddArc(context, CGRectGetMinX(bounds) + 5.0, CGRectGetMaxY(bounds) - 5.0, 5.0, M_PI, M_PI_2, YES);
CGContextAddArc(context, CGRectGetMaxX(bounds) - 5.0, CGRectGetMaxY(bounds) - 5.0, 5.0, M_PI_2, 0, YES);
CGContextAddLineToPoint(context, CGRectGetMaxX(bounds), CGRectGetMinY(bounds));
CGContextAddLineToPoint(context, CGRectGetMinX(bounds), CGRectGetMinY(bounds));
CGContextClosePath(context);
CGContextDrawPath(context, kCGPathFillStroke);
}
- (void)drawStandardInactiveShadowInRect:(NSRect)aRect
{
CGContextRef context = [[NSGraphicsContext currentContext] graphicsPort];
CGRect bounds = CGRectInset(*(CGRect *)&aRect, OUTlINE_HORIZONTAL_INSET - 0.5, OUTlINE_VERTICAL_INSET - 0.5);
CGColorRef shadowColor = CGColorCreateGenericGray(0.0, 0.5);
CGContextSetShadowWithColor (context, CGSizeMake(0.0, -10.0), 40.0, shadowColor);
CGColorRelease(shadowColor);
CGColorRef fillColor = CGColorCreateGenericGray(1.0, 1.0);
CGColorRef strokeColor = CGColorCreateGenericGray(0.0, 0.2);
CGContextSetFillColorWithColor(context, fillColor);
CGContextSetStrokeColorWithColor(context, strokeColor);
CGColorRelease(fillColor);
CGColorRelease(strokeColor);
CGContextBeginPath(context);
CGContextAddArc(context, CGRectGetMinX(bounds) + 5.0, CGRectGetMaxY(bounds) - 5.0, 5.0, M_PI, M_PI_2, YES);
CGContextAddArc(context, CGRectGetMaxX(bounds) - 5.0, CGRectGetMaxY(bounds) - 5.0, 5.0, M_PI_2, 0, YES);
CGContextAddLineToPoint(context, CGRectGetMaxX(bounds), CGRectGetMinY(bounds));
CGContextAddLineToPoint(context, CGRectGetMinX(bounds), CGRectGetMinY(bounds));
CGContextClosePath(context);
CGContextDrawPath(context, kCGPathFillStroke);
}
- (void)drawMenuShadowInRect:(NSRect)aRect
{
CGContextRef context = [[NSGraphicsContext currentContext] graphicsPort];
CGRect bounds = CGRectInset(*(CGRect *)&aRect, OUTlINE_HORIZONTAL_INSET - 0.5, OUTlINE_VERTICAL_INSET - 0.5);
CGColorRef shadowColor = CGColorCreateGenericGray(0.0, 0.5);
CGContextSetShadowWithColor (context, CGSizeMake(0.0, -10.0), 30.0, shadowColor);
CGColorRelease(shadowColor);
CGColorRef fillColor = CGColorCreateGenericGray(1.0, 1.0);
CGColorRef strokeColor = CGColorCreateGenericGray(0.0, 0.2);
CGContextSetFillColorWithColor(context, fillColor);
CGContextSetStrokeColorWithColor(context, strokeColor);
CGColorRelease(fillColor);
CGColorRelease(strokeColor);
CGContextBeginPath(context);
CGContextAddArc(context, CGRectGetMinX(bounds) + 3.0, CGRectGetMaxY(bounds) - 3.0, 2.0, M_PI, M_PI_2, YES);
CGContextAddArc(context, CGRectGetMaxX(bounds) - 3.0, CGRectGetMaxY(bounds) - 3.0, 2.0, M_PI_2, 0, YES);
CGContextAddArc(context, CGRectGetMaxX(bounds) - 3.0, CGRectGetMinY(bounds) + 3.0, 2.0, 0, 3 * M_PI_2, YES);
CGContextAddArc(context, CGRectGetMinX(bounds) + 3.0, CGRectGetMinY(bounds) + 3.0, 2.0, 3 * M_PI_2, M_PI, YES);
CGContextClosePath(context);
CGContextDrawPath(context, kCGPathFill);//Stroke);
/*
CGContextBeginPath(context);
CGContextAddArc(context, CGRectGetMinX(bounds) + 3.0, CGRectGetMaxY(bounds) - 3.0, 2.0, M_PI, M_PI_2, YES);
CGContextAddArc(context, CGRectGetMaxX(bounds) - 3.0, CGRectGetMaxY(bounds) - 3.0, 2.0, M_PI_2, 0, YES);
CGContextAddArc(context, CGRectGetMaxX(bounds) - 3.0, CGRectGetMinY(bounds) + 3.0, 2.0, 0, 3 * M_PI_2, YES);
CGContextAddArc(context, CGRectGetMinX(bounds) + 3.0, CGRectGetMinY(bounds) + 3.0, 2.0, 3 * M_PI_2, M_PI, YES);
CGContextClosePath(context);
CGContextSetFillColorWithColor(context, CGColorGetConstantColor(kCGColorClear));
CGContextSetBlendMode(context, kCGBlendModeCopy);
CGContextDrawPath(context, kCGPathFill);
*/
}
- (NSImage *)shadowImageWithSelector:(SEL)aSelector
{
static NSMutableDictionary * images = nil;
if (!images)
images = [[NSMutableDictionary alloc] init];
NSString * name = NSStringFromSelector(aSelector);
NSImage * image = [images objectForKey:name];
if (!image)
{
image = [[NSImage alloc] initWithSize:NSMakeSize(100.0, 100.0)];
[image lockFocus];
objc_msgSend(self, aSelector, NSMakeRect(0.0, 0.0, 100.0, 100.0));
[image unlockFocus];
[images setObject:image forKey:name];
[image release];
}
return image;
}
- (void)drawShadowWithSelector:(SEL)aSelector inRect:(NSRect)aRect
{
CGFloat slices[] = { 40.0, 49.0, 40.0, 49.0 };
if (NSWidth(aRect) > 100.0 || NSHeight(aRect) > 100.0)
[[self shadowImageWithSelector:aSelector] drawInRect:aRect slices:slices];
else
objc_msgSend(self, aSelector, aRect);
}
- (void)drawRect:(NSRect)aRect
{
WebWindow * window = (WebWindow *)[self window];
NSRect bounds = [self bounds];
if (![window hasShadow])
return;
if ([window shadowStyle] == CPStandardWindowShadowStyle)
if ([window isKeyWindow])
return [self drawShadowWithSelector:@selector(drawStandardActiveShadowInRect:) inRect:bounds];
else
return [self drawShadowWithSelector:@selector(drawStandardInactiveShadowInRect:) inRect:bounds];
if ([window shadowStyle] == CPMenuWindowShadowStyle)
return [self drawShadowWithSelector:@selector(drawMenuShadowInRect:) inRect:bounds];
}
@end
Binary file not shown.
-23
View File
@@ -1,23 +0,0 @@
//
// main.m
// NativeHost
//
// Created by Francisco Tolmasky on 5/24/09.
// Copyright 280 North, Inc. 2009. All rights reserved.
//
#import <Cocoa/Cocoa.h>
#import "Application.h"
int interactive = 0;
int main(int argc, char *argv[])
{
if (argc > 1 && strcmp(argv[1], "-i") == 0) {
interactive = 1;
}
[Application sharedApplication];
return NSApplicationMain(argc, (const char **) argv);
}
@@ -82,18 +82,6 @@ task ("deploy", ["release"], function()
printResults("Deployment")
});
task ("desktop", ["release"], function()
{
FILE.mkdirs(FILE.join("Build", "Desktop", projectName));
require("cappuccino/nativehost").buildNativeHost(FILE.join("Build", "Release", projectName), FILE.join("Build", "Desktop", projectName, "__project.nameasidentifier__.app"));
printResults("Desktop")
});
task ("run-desktop", ["desktop"], function()
{
OS.system([FILE.join("Build", "Desktop", projectName, "__project.nameasidentifier__.app", "Contents", "MacOS", "NativeHost"), "-i"]);
});
function printResults(configuration)
{
print("----------------------------");