diff options
author | evan@chromium.org <evan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-04-15 15:18:15 +0000 |
---|---|---|
committer | evan@chromium.org <evan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-04-15 15:18:15 +0000 |
commit | d1b229dc75dbe281e3d7e4c2fdcbbe42f7457bd0 (patch) | |
tree | 800d5eeb16a56ee1f3289bb5593ee01ee7e477c3 /third_party/mozilla/include | |
parent | 02dc82f90acb51ca3c1b3277782656f94ff9dad7 (diff) | |
download | chromium_src-d1b229dc75dbe281e3d7e4c2fdcbbe42f7457bd0.zip chromium_src-d1b229dc75dbe281e3d7e4c2fdcbbe42f7457bd0.tar.gz chromium_src-d1b229dc75dbe281e3d7e4c2fdcbbe42f7457bd0.tar.bz2 |
Move third_pary/mozilla/include up one directory.
This allows the license checker to find the README.
BUG=39240
Review URL: http://codereview.chromium.org/1596025
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@44655 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'third_party/mozilla/include')
-rw-r--r-- | third_party/mozilla/include/NSPasteboard+Utils.h | 58 | ||||
-rw-r--r-- | third_party/mozilla/include/NSPasteboard+Utils.mm | 278 | ||||
-rw-r--r-- | third_party/mozilla/include/NSScreen+Utils.h | 45 | ||||
-rw-r--r-- | third_party/mozilla/include/NSScreen+Utils.m | 59 | ||||
-rw-r--r-- | third_party/mozilla/include/NSString+Utils.h | 101 | ||||
-rw-r--r-- | third_party/mozilla/include/NSString+Utils.m | 362 | ||||
-rw-r--r-- | third_party/mozilla/include/NSURL+Utils.h | 51 | ||||
-rw-r--r-- | third_party/mozilla/include/NSURL+Utils.m | 148 | ||||
-rw-r--r-- | third_party/mozilla/include/NSWorkspace+Utils.h | 64 | ||||
-rw-r--r-- | third_party/mozilla/include/NSWorkspace+Utils.m | 187 | ||||
-rw-r--r-- | third_party/mozilla/include/README.chromium | 44 |
11 files changed, 0 insertions, 1397 deletions
diff --git a/third_party/mozilla/include/NSPasteboard+Utils.h b/third_party/mozilla/include/NSPasteboard+Utils.h deleted file mode 100644 index 5c2f1e1..0000000 --- a/third_party/mozilla/include/NSPasteboard+Utils.h +++ /dev/null @@ -1,58 +0,0 @@ -/* ***** BEGIN LICENSE BLOCK ***** - * Version: MPL 1.1/GPL 2.0/LGPL 2.1 - * - * The contents of this file are subject to the Mozilla Public License Version - * 1.1 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License - * for the specific language governing rights and limitations under the - * License. - * - * The Original Code is Chimera code. - * - * The Initial Developer of the Original Code is - * Netscape Communications Corporation. - * Portions created by the Initial Developer are Copyright (C) 2002 - * the Initial Developer. All Rights Reserved. - * - * Contributor(s): - * Simon Fraser <sfraser@netscape.com> - * Bruce Davidson <Bruce.Davidson@ipl.com> - * - * Alternatively, the contents of this file may be used under the terms of - * either the GNU General Public License Version 2 or later (the "GPL"), or - * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), - * in which case the provisions of the GPL or the LGPL are applicable instead - * of those above. If you wish to allow use of your version of this file only - * under the terms of either the GPL or the LGPL, and not to allow others to - * use your version of this file under the terms of the MPL, indicate your - * decision by deleting the provisions above and replace them with the notice - * and other provisions required by the GPL or the LGPL. If you do not delete - * the provisions above, a recipient may use your version of this file under - * the terms of any one of the MPL, the GPL or the LGPL. - * - * ***** END LICENSE BLOCK ***** */ - -#import <AppKit/AppKit.h> - -extern NSString* const kCorePasteboardFlavorType_url; -extern NSString* const kCorePasteboardFlavorType_urln; -extern NSString* const kCorePasteboardFlavorType_urld; - -extern NSString* const kCaminoBookmarkListPBoardType; -extern NSString* const kWebURLsWithTitlesPboardType; - -@interface NSPasteboard(ChimeraPasteboardURLUtils) - -- (int) declareURLPasteboardWithAdditionalTypes:(NSArray*)additionalTypes owner:(id)newOwner; -- (void) setDataForURL:(NSString*)url title:(NSString*)title; - -- (void) setURLs:(NSArray*)inUrls withTitles:(NSArray*)inTitles; -- (void) getURLs:(NSArray**)outUrls andTitles:(NSArray**)outTitles; -- (BOOL) containsURLData; - -@end - diff --git a/third_party/mozilla/include/NSPasteboard+Utils.mm b/third_party/mozilla/include/NSPasteboard+Utils.mm deleted file mode 100644 index 2a7ee5e..0000000 --- a/third_party/mozilla/include/NSPasteboard+Utils.mm +++ /dev/null @@ -1,278 +0,0 @@ -/* ***** BEGIN LICENSE BLOCK ***** - * Version: MPL 1.1/GPL 2.0/LGPL 2.1 - * - * The contents of this file are subject to the Mozilla Public License Version - * 1.1 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License - * for the specific language governing rights and limitations under the - * License. - * - * The Original Code is Chimera code. - * - * The Initial Developer of the Original Code is - * Netscape Communications Corporation. - * Portions created by the Initial Developer are Copyright (C) 2002 - * the Initial Developer. All Rights Reserved. - * - * Contributor(s): - * Simon Fraser <sfraser@netscape.com> - * Bruce Davidson <Bruce.Davidson@ipl.com> - * - * Alternatively, the contents of this file may be used under the terms of - * either the GNU General Public License Version 2 or later (the "GPL"), or - * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), - * in which case the provisions of the GPL or the LGPL are applicable instead - * of those above. If you wish to allow use of your version of this file only - * under the terms of either the GPL or the LGPL, and not to allow others to - * use your version of this file under the terms of the MPL, indicate your - * decision by deleting the provisions above and replace them with the notice - * and other provisions required by the GPL or the LGPL. If you do not delete - * the provisions above, a recipient may use your version of this file under - * the terms of any one of the MPL, the GPL or the LGPL. - * - * ***** END LICENSE BLOCK ***** */ - -#import "NSPasteboard+Utils.h" -#import "NSURL+Utils.h" -#import "NSString+Utils.h" - -NSString* const kCorePasteboardFlavorType_url = @"CorePasteboardFlavorType 0x75726C20"; // 'url ' url -NSString* const kCorePasteboardFlavorType_urln = @"CorePasteboardFlavorType 0x75726C6E"; // 'urln' title -NSString* const kCorePasteboardFlavorType_urld = @"CorePasteboardFlavorType 0x75726C64"; // 'urld' URL description - -NSString* const kCaminoBookmarkListPBoardType = @"MozBookmarkType"; // list of Camino bookmark UIDs -NSString* const kWebURLsWithTitlesPboardType = @"WebURLsWithTitlesPboardType"; // Safari-compatible URL + title arrays - -@interface NSPasteboard(ChimeraPasteboardURLUtilsPrivate) - -- (NSString*)cleanedStringWithPasteboardString:(NSString*)aString; - -@end - -@implementation NSPasteboard(ChimeraPasteboardURLUtilsPrivate) - -// -// Utility method to ensure strings we're using in |containsURLData| -// and |getURLs:andTitles| are free of internal control characters -// and leading/trailing whitespace -// -- (NSString*)cleanedStringWithPasteboardString:(NSString*)aString -{ - NSString* cleanString = [aString stringByRemovingCharactersInSet:[NSCharacterSet controlCharacterSet]]; - return [cleanString stringByTrimmingWhitespace]; -} - -@end - -@implementation NSPasteboard(ChimeraPasteboardURLUtils) - -- (int)declareURLPasteboardWithAdditionalTypes:(NSArray*)additionalTypes owner:(id)newOwner -{ - NSArray* allTypes = [additionalTypes arrayByAddingObjectsFromArray: - [NSArray arrayWithObjects: - kWebURLsWithTitlesPboardType, - NSURLPboardType, - NSStringPboardType, - kCorePasteboardFlavorType_url, - kCorePasteboardFlavorType_urln, - nil]]; - return [self declareTypes:allTypes owner:newOwner]; -} - -// -// Copy a single URL (with an optional title) to the clipboard in all relevant -// formats. Convenience method for clients that can only ever deal with one -// URL and shouldn't have to build up the arrays for setURLs:withTitles:. -// -- (void)setDataForURL:(NSString*)url title:(NSString*)title -{ - NSArray* urlList = [NSArray arrayWithObject:url]; - NSArray* titleList = nil; - if (title) - titleList = [NSArray arrayWithObject:title]; - - [self setURLs:urlList withTitles:titleList]; -} - -// -// Copy a set of URLs, each of which may have a title, to the pasteboard -// using all the available formats. -// The title array should be nil, or must have the same length as the URL array. -// -- (void)setURLs:(NSArray*)inUrls withTitles:(NSArray*)inTitles -{ - unsigned int urlCount = [inUrls count]; - - // Best format that we know about is Safari's URL + title arrays - build these up - if (!inTitles) { - NSMutableArray* tmpTitleArray = [NSMutableArray arrayWithCapacity:urlCount]; - for (unsigned int i = 0; i < urlCount; ++i) - [tmpTitleArray addObject:@""]; - inTitles = tmpTitleArray; - } - - NSMutableArray* filePaths = [NSMutableArray array]; - for (unsigned int i = 0; i < urlCount; ++i) { - NSURL* url = [NSURL URLWithString:[inUrls objectAtIndex:i]]; - if ([url isFileURL] && [[NSFileManager defaultManager] fileExistsAtPath:[url path]]) - [filePaths addObject:[url path]]; - } - if ([filePaths count] > 0) { - [self addTypes:[NSArray arrayWithObject:NSFilenamesPboardType] owner:nil]; - [self setPropertyList:filePaths forType:NSFilenamesPboardType]; - } - - NSMutableArray* clipboardData = [NSMutableArray array]; - [clipboardData addObject:[NSArray arrayWithArray:inUrls]]; - [clipboardData addObject:inTitles]; - - [self setPropertyList:clipboardData forType:kWebURLsWithTitlesPboardType]; - - if (urlCount == 1) { - NSString* title = @""; - if (inTitles) - title = [inTitles objectAtIndex:0]; - - NSString* url = [inUrls objectAtIndex:0]; - - [[NSURL URLWithString:url] writeToPasteboard:self]; - [self setString:url forType:NSStringPboardType]; - - const char* tempCString = [url UTF8String]; - [self setData:[NSData dataWithBytes:tempCString length:strlen(tempCString)] forType:kCorePasteboardFlavorType_url]; - - if (inTitles) - tempCString = [title UTF8String]; - [self setData:[NSData dataWithBytes:tempCString length:strlen(tempCString)] forType:kCorePasteboardFlavorType_urln]; - } - else if (urlCount > 1) - { - // With multiple URLs there aren't many other formats we can use - // Just write a string of each URL (ignoring titles) on a separate line - [self setString:[inUrls componentsJoinedByString:@"\n"] forType:NSStringPboardType]; - - // but we have to put something in the carbon style flavors, otherwise apps will think - // there is data there, but get nothing - - NSString* firstURL = [inUrls objectAtIndex:0]; - NSString* firstTitle = ([inTitles count] > 0) ? [inTitles objectAtIndex:0] : @""; - - const char* tempCString = [firstURL UTF8String]; - [self setData:[NSData dataWithBytes:tempCString length:strlen(tempCString)] forType:kCorePasteboardFlavorType_url]; - - tempCString = [firstTitle UTF8String]; // not i18n friendly - [self setData:[NSData dataWithBytes:tempCString length:strlen(tempCString)] forType:kCorePasteboardFlavorType_urln]; - } -} - -// -// Get the set of URLs and their corresponding titles from the clipboards -// If there are no URLs in a format we understand on the pasteboard empty -// arrays will be returned. The two arrays will always be the same size. -// The arrays returned are on the auto release pool. -// -- (void) getURLs:(NSArray**)outUrls andTitles:(NSArray**)outTitles -{ - NSArray* types = [self types]; - if ([types containsObject:kWebURLsWithTitlesPboardType]) { - NSArray* urlAndTitleContainer = [self propertyListForType:kWebURLsWithTitlesPboardType]; - *outUrls = [urlAndTitleContainer objectAtIndex:0]; - *outTitles = [urlAndTitleContainer objectAtIndex:1]; - } else if ([types containsObject:NSFilenamesPboardType]) { - NSArray *files = [self propertyListForType:NSFilenamesPboardType]; - *outUrls = [NSMutableArray arrayWithCapacity:[files count]]; - *outTitles = [NSMutableArray arrayWithCapacity:[files count]]; - for ( unsigned int i = 0; i < [files count]; ++i ) { - NSString *file = [files objectAtIndex:i]; - NSString *ext = [[file pathExtension] lowercaseString]; - NSString *urlString = nil; - NSString *title = @""; - OSType fileType = NSHFSTypeCodeFromFileType(NSHFSTypeOfFile(file)); - - // Check whether the file is a .webloc, a .ftploc, a .url, or some other kind of file. - if ([ext isEqualToString:@"webloc"] || [ext isEqualToString:@"ftploc"] || fileType == 'ilht' || fileType == 'ilft') { - NSURL* urlFromInetloc = [NSURL URLFromInetloc:file]; - if (urlFromInetloc) { - urlString = [urlFromInetloc absoluteString]; - title = [[file lastPathComponent] stringByDeletingPathExtension]; - } - } else if ([ext isEqualToString:@"url"] || fileType == 'LINK') { - NSURL* urlFromIEURLFile = [NSURL URLFromIEURLFile:file]; - if (urlFromIEURLFile) { - urlString = [urlFromIEURLFile absoluteString]; - title = [[file lastPathComponent] stringByDeletingPathExtension]; - } - } - - // Use the filename if not a .webloc or .url file, or if either of the - // functions returns nil. - if (!urlString) { - urlString = file; - title = [file lastPathComponent]; - } - - [(NSMutableArray*) *outUrls addObject:urlString]; - [(NSMutableArray*) *outTitles addObject:title]; - } - } else if ([types containsObject:NSURLPboardType]) { - *outUrls = [NSArray arrayWithObject:[[NSURL URLFromPasteboard:self] absoluteString]]; - NSString* title = nil; - if ([types containsObject:kCorePasteboardFlavorType_urld]) - title = [self stringForType:kCorePasteboardFlavorType_urld]; - if (!title && [types containsObject:kCorePasteboardFlavorType_urln]) - title = [self stringForType:kCorePasteboardFlavorType_urln]; - if (!title && [types containsObject:NSStringPboardType]) - title = [self stringForType:NSStringPboardType]; - *outTitles = [NSArray arrayWithObject:(title ? title : @"")]; - } else if ([types containsObject:NSStringPboardType]) { - NSString* potentialURLString = [self cleanedStringWithPasteboardString:[self stringForType:NSStringPboardType]]; - if ([potentialURLString isValidURI]) { - *outUrls = [NSArray arrayWithObject:potentialURLString]; - NSString* title = nil; - if ([types containsObject:kCorePasteboardFlavorType_urld]) - title = [self stringForType:kCorePasteboardFlavorType_urld]; - if (!title && [types containsObject:kCorePasteboardFlavorType_urln]) - title = [self stringForType:kCorePasteboardFlavorType_urln]; - *outTitles = [NSArray arrayWithObject:(title ? title : @"")]; - } else { - // The string doesn't look like a URL - return empty arrays - *outUrls = [NSArray array]; - *outTitles = [NSArray array]; - } - } else { - // We don't recognise any of these formats - return empty arrays - *outUrls = [NSArray array]; - *outTitles = [NSArray array]; - } -} - -// -// Indicates if this pasteboard contains URL data that we understand -// Deals with all our URL formats. Only strings that are valid URLs count. -// If this returns YES it is safe to use getURLs:andTitles: to retrieve the data. -// -// NB: Does not consider our internal bookmark list format, because callers -// usually need to deal with this separately because it can include folders etc. -// -- (BOOL) containsURLData -{ - NSArray* types = [self types]; - if ( [types containsObject:kWebURLsWithTitlesPboardType] - || [types containsObject:NSURLPboardType] - || [types containsObject:NSFilenamesPboardType] ) - return YES; - - if ([types containsObject:NSStringPboardType]) { - // Trim whitespace off the ends and newlines out of the middle so we don't reject otherwise-valid URLs; - // we'll do another cleaning when we set the URLs and titles later, so this is safe. - NSString* potentialURLString = [self cleanedStringWithPasteboardString:[self stringForType:NSStringPboardType]]; - return [potentialURLString isValidURI]; - } - - return NO; -} -@end diff --git a/third_party/mozilla/include/NSScreen+Utils.h b/third_party/mozilla/include/NSScreen+Utils.h deleted file mode 100644 index d8dc23c..0000000 --- a/third_party/mozilla/include/NSScreen+Utils.h +++ /dev/null @@ -1,45 +0,0 @@ -/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* ***** BEGIN LICENSE BLOCK ***** - * Version: MPL 1.1/GPL 2.0/LGPL 2.1 - * - * The contents of this file are subject to the Mozilla Public License Version - * 1.1 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License - * for the specific language governing rights and limitations under the - * License. - * - * The Original Code is mozilla.org code. - * - * The Initial Developer of the Original Code is - * Netscape Communications Corporation. - * Portions created by the Initial Developer are Copyright (C) 2002 - * the Initial Developer. All Rights Reserved. - * - * Contributor(s): - * - * Alternatively, the contents of this file may be used under the terms of - * either the GNU General Public License Version 2 or later (the "GPL"), or - * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), - * in which case the provisions of the GPL or the LGPL are applicable instead - * of those above. If you wish to allow use of your version of this file only - * under the terms of either the GPL or the LGPL, and not to allow others to - * use your version of this file under the terms of the MPL, indicate your - * decision by deleting the provisions above and replace them with the notice - * and other provisions required by the GPL or the LGPL. If you do not delete - * the provisions above, a recipient may use your version of this file under - * the terms of any one of the MPL, the GPL or the LGPL. - * - * ***** END LICENSE BLOCK ***** */ - -#import <Cocoa/Cocoa.h> - - -@interface NSScreen (CHScreenAdditions) - -+ (NSScreen*)screenForPoint:(NSPoint)point; - -@end diff --git a/third_party/mozilla/include/NSScreen+Utils.m b/third_party/mozilla/include/NSScreen+Utils.m deleted file mode 100644 index 8d3318d..0000000 --- a/third_party/mozilla/include/NSScreen+Utils.m +++ /dev/null @@ -1,59 +0,0 @@ -/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* ***** BEGIN LICENSE BLOCK ***** - * Version: MPL 1.1/GPL 2.0/LGPL 2.1 - * - * The contents of this file are subject to the Mozilla Public License Version - * 1.1 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License - * for the specific language governing rights and limitations under the - * License. - * - * The Original Code is mozilla.org code. - * - * The Initial Developer of the Original Code is - * Netscape Communications Corporation. - * Portions created by the Initial Developer are Copyright (C) 2002 - * the Initial Developer. All Rights Reserved. - * - * Contributor(s): - * - * Alternatively, the contents of this file may be used under the terms of - * either the GNU General Public License Version 2 or later (the "GPL"), or - * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), - * in which case the provisions of the GPL or the LGPL are applicable instead - * of those above. If you wish to allow use of your version of this file only - * under the terms of either the GPL or the LGPL, and not to allow others to - * use your version of this file under the terms of the MPL, indicate your - * decision by deleting the provisions above and replace them with the notice - * and other provisions required by the GPL or the LGPL. If you do not delete - * the provisions above, a recipient may use your version of this file under - * the terms of any one of the MPL, the GPL or the LGPL. - * - * ***** END LICENSE BLOCK ***** */ - - -#import "NSScreen+Utils.h" - - -@implementation NSScreen (CHScreenAdditions) - -+ (NSScreen*)screenForPoint:(NSPoint)point -{ - NSArray* screens = [NSScreen screens]; - NSEnumerator* screenEnum = [screens objectEnumerator]; - NSScreen* screen; - - while ( (screen = [screenEnum nextObject]) ) { - NSRect frame = [screen frame]; - if (NSPointInRect(point, frame)) - break; - } - - return screen; -} - -@end diff --git a/third_party/mozilla/include/NSString+Utils.h b/third_party/mozilla/include/NSString+Utils.h deleted file mode 100644 index f556cc6..0000000 --- a/third_party/mozilla/include/NSString+Utils.h +++ /dev/null @@ -1,101 +0,0 @@ -/* ***** BEGIN LICENSE BLOCK ***** - * Version: MPL 1.1/GPL 2.0/LGPL 2.1 - * - * The contents of this file are subject to the Mozilla Public License Version - * 1.1 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License - * for the specific language governing rights and limitations under the - * License. - * - * The Original Code is Chimera code. - * - * The Initial Developer of the Original Code is - * Netscape Communications Corporation. - * Portions created by the Initial Developer are Copyright (C) 2002 - * the Initial Developer. All Rights Reserved. - * - * Contributor(s): - * Simon Fraser <sfraser@netscape.com> - * - * Alternatively, the contents of this file may be used under the terms of - * either the GNU General Public License Version 2 or later (the "GPL"), or - * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), - * in which case the provisions of the GPL or the LGPL are applicable instead - * of those above. If you wish to allow use of your version of this file only - * under the terms of either the GPL or the LGPL, and not to allow others to - * use your version of this file under the terms of the MPL, indicate your - * decision by deleting the provisions above and replace them with the notice - * and other provisions required by the GPL or the LGPL. If you do not delete - * the provisions above, a recipient may use your version of this file under - * the terms of any one of the MPL, the GPL or the LGPL. - * - * ***** END LICENSE BLOCK ***** */ - -#import <Foundation/Foundation.h> - -typedef enum -{ - kTruncateAtStart, - kTruncateAtMiddle, - kTruncateAtEnd -} ETruncationType; - - -// a category to extend NSString -@interface NSString (ChimeraStringUtils) - -+ (id)ellipsisString; -+ (NSString*)stringWithUUID; - -- (BOOL)isEqualToStringIgnoringCase:(NSString*)inString; -- (BOOL)hasCaseInsensitivePrefix:(NSString*)inString; - -// Some URIs can contain spaces and still work, even though they aren't strictly valid -// per RFC2396. This method allows us to account for those URIs. -- (BOOL)isLooselyValidatedURI; - -// Utility method to identify URIs that can be run in the context of the current page. -// These URIs could be used as attack vectors via AppleScript, for example. -- (BOOL)isPotentiallyDangerousURI; - -// Utility method to ensure validity of URI strings. NSURL is used to validate -// most of them, but the NSURL test may fail for |javascript:| and |data:| URIs -// because they often contain invalid (per RFC2396) characters such as spaces. -- (BOOL)isValidURI; - -- (NSString *)stringByRemovingCharactersInSet:(NSCharacterSet*)characterSet; -- (NSString *)stringByReplacingCharactersInSet:(NSCharacterSet*)characterSet withString:(NSString*)string; -- (NSString *)stringByTruncatingTo:(unsigned int)maxCharacters at:(ETruncationType)truncationType; -- (NSString *)stringByTruncatingToWidth:(float)inWidth at:(ETruncationType)truncationType withAttributes:(NSDictionary *)attributes; -- (NSString *)stringByTrimmingWhitespace; -- (NSString *)stringByRemovingAmpEscapes; -- (NSString *)stringByAddingAmpEscapes; - -@end - -@interface NSMutableString (ChimeraMutableStringUtils) - -- (void)truncateTo:(unsigned)maxCharacters at:(ETruncationType)truncationType; -- (void)truncateToWidth:(float)maxWidth at:(ETruncationType)truncationType withAttributes:(NSDictionary *)attributes; - -@end - -@interface NSString (ChimeraFilePathStringUtils) - -- (NSString*)volumeNamePathComponent; -- (NSString*)displayNameOfLastPathComponent; - -@end - -@interface NSString (CaminoURLStringUtils) - -// Returns true if the string represents a "blank" URL ("" or "about:blank") -- (BOOL)isBlankURL; -// Returns a URI that looks good in a location field -- (NSString *)unescapedURI; - -@end diff --git a/third_party/mozilla/include/NSString+Utils.m b/third_party/mozilla/include/NSString+Utils.m deleted file mode 100644 index c145505..0000000 --- a/third_party/mozilla/include/NSString+Utils.m +++ /dev/null @@ -1,362 +0,0 @@ -/* ***** BEGIN LICENSE BLOCK ***** - * Version: MPL 1.1/GPL 2.0/LGPL 2.1 - * - * The contents of this file are subject to the Mozilla Public License Version - * 1.1 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License - * for the specific language governing rights and limitations under the - * License. - * - * The Original Code is Chimera code. - * - * The Initial Developer of the Original Code is - * Netscape Communications Corporation. - * Portions created by the Initial Developer are Copyright (C) 2002 - * the Initial Developer. All Rights Reserved. - * - * Contributor(s): - * Simon Fraser <sfraser@netscape.com> - * David Haas <haasd@cae.wisc.edu> - * - * Alternatively, the contents of this file may be used under the terms of - * either the GNU General Public License Version 2 or later (the "GPL"), or - * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), - * in which case the provisions of the GPL or the LGPL are applicable instead - * of those above. If you wish to allow use of your version of this file only - * under the terms of either the GPL or the LGPL, and not to allow others to - * use your version of this file under the terms of the MPL, indicate your - * decision by deleting the provisions above and replace them with the notice - * and other provisions required by the GPL or the LGPL. If you do not delete - * the provisions above, a recipient may use your version of this file under - * the terms of any one of the MPL, the GPL or the LGPL. - * - * ***** END LICENSE BLOCK ***** */ - -#import <AppKit/AppKit.h> // for NSStringDrawing.h - -#import "NSString+Utils.h" - - -@implementation NSString (ChimeraStringUtils) - -+ (id)ellipsisString -{ - static NSString* sEllipsisString = nil; - if (!sEllipsisString) { - unichar ellipsisChar = 0x2026; - sEllipsisString = [[NSString alloc] initWithCharacters:&ellipsisChar length:1]; - } - - return sEllipsisString; -} - -+ (NSString*)stringWithUUID -{ - NSString* uuidString = nil; - CFUUIDRef newUUID = CFUUIDCreate(kCFAllocatorDefault); - if (newUUID) { - uuidString = (NSString *)CFUUIDCreateString(kCFAllocatorDefault, newUUID); - CFRelease(newUUID); - } - return [uuidString autorelease]; -} - -- (BOOL)isEqualToStringIgnoringCase:(NSString*)inString -{ - return ([self compare:inString options:NSCaseInsensitiveSearch] == NSOrderedSame); -} - -- (BOOL)hasCaseInsensitivePrefix:(NSString*)inString -{ - if ([self length] < [inString length]) - return NO; - return ([self compare:inString options:NSCaseInsensitiveSearch range:NSMakeRange(0, [inString length])] == NSOrderedSame); -} - -- (BOOL)isLooselyValidatedURI -{ - return ([self hasCaseInsensitivePrefix:@"javascript:"] || [self hasCaseInsensitivePrefix:@"data:"]); -} - -- (BOOL)isPotentiallyDangerousURI -{ - return ([self hasCaseInsensitivePrefix:@"javascript:"] || [self hasCaseInsensitivePrefix:@"data:"]); -} - -- (BOOL)isValidURI -{ - // This will only return a non-nil object for valid, well-formed URI strings - NSURL* testURL = [NSURL URLWithString:self]; - - // |javascript:| and |data:| URIs might not have passed the test, - // but spaces will work OK, so evaluate them separately. - if ((testURL) || [self isLooselyValidatedURI]) { - return YES; - } - return NO; -} - -- (NSString *)stringByRemovingCharactersInSet:(NSCharacterSet*)characterSet -{ - NSScanner* cleanerScanner = [NSScanner scannerWithString:self]; - NSMutableString* cleanString = [NSMutableString stringWithCapacity:[self length]]; - // Make sure we don't skip whitespace, which NSScanner does by default - [cleanerScanner setCharactersToBeSkipped:[NSCharacterSet characterSetWithCharactersInString:@""]]; - - while (![cleanerScanner isAtEnd]) { - NSString* stringFragment; - if ([cleanerScanner scanUpToCharactersFromSet:characterSet intoString:&stringFragment]) - [cleanString appendString:stringFragment]; - - [cleanerScanner scanCharactersFromSet:characterSet intoString:nil]; - } - - return cleanString; -} - -- (NSString *)stringByReplacingCharactersInSet:(NSCharacterSet*)characterSet - withString:(NSString*)string -{ - NSScanner* cleanerScanner = [NSScanner scannerWithString:self]; - NSMutableString* cleanString = [NSMutableString stringWithCapacity:[self length]]; - // Make sure we don't skip whitespace, which NSScanner does by default - [cleanerScanner setCharactersToBeSkipped:[NSCharacterSet characterSetWithCharactersInString:@""]]; - - while (![cleanerScanner isAtEnd]) - { - NSString* stringFragment; - if ([cleanerScanner scanUpToCharactersFromSet:characterSet intoString:&stringFragment]) - [cleanString appendString:stringFragment]; - - if ([cleanerScanner scanCharactersFromSet:characterSet intoString:nil]) - [cleanString appendString:string]; - } - - return cleanString; -} - -- (NSString*)stringByTruncatingTo:(unsigned int)maxCharacters at:(ETruncationType)truncationType -{ - if ([self length] > maxCharacters) - { - NSMutableString *mutableCopy = [self mutableCopy]; - [mutableCopy truncateTo:maxCharacters at:truncationType]; - return [mutableCopy autorelease]; - } - - return self; -} - -- (NSString *)stringByTruncatingToWidth:(float)inWidth at:(ETruncationType)truncationType - withAttributes:(NSDictionary *)attributes -{ - if ([self sizeWithAttributes:attributes].width > inWidth) - { - NSMutableString *mutableCopy = [self mutableCopy]; - [mutableCopy truncateToWidth:inWidth at:truncationType withAttributes:attributes]; - return [mutableCopy autorelease]; - } - - return self; -} - -- (NSString *)stringByTrimmingWhitespace -{ - return [self stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceCharacterSet]]; -} - --(NSString *)stringByRemovingAmpEscapes -{ - NSMutableString* dirtyStringMutant = [NSMutableString stringWithString:self]; - [dirtyStringMutant replaceOccurrencesOfString:@"&" - withString:@"&" - options:NSLiteralSearch - range:NSMakeRange(0,[dirtyStringMutant length])]; - [dirtyStringMutant replaceOccurrencesOfString:@""" - withString:@"\"" - options:NSLiteralSearch - range:NSMakeRange(0,[dirtyStringMutant length])]; - [dirtyStringMutant replaceOccurrencesOfString:@"<" - withString:@"<" - options:NSLiteralSearch - range:NSMakeRange(0,[dirtyStringMutant length])]; - [dirtyStringMutant replaceOccurrencesOfString:@">" - withString:@">" - options:NSLiteralSearch - range:NSMakeRange(0,[dirtyStringMutant length])]; - [dirtyStringMutant replaceOccurrencesOfString:@"—" - withString:@"-" - options:NSLiteralSearch - range:NSMakeRange(0,[dirtyStringMutant length])]; - [dirtyStringMutant replaceOccurrencesOfString:@"'" - withString:@"'" - options:NSLiteralSearch - range:NSMakeRange(0,[dirtyStringMutant length])]; - // fix import from old Firefox versions, which exported ' instead of a plain apostrophe - [dirtyStringMutant replaceOccurrencesOfString:@"'" - withString:@"'" - options:NSLiteralSearch - range:NSMakeRange(0,[dirtyStringMutant length])]; - return [dirtyStringMutant stringByRemovingCharactersInSet:[NSCharacterSet controlCharacterSet]]; -} - --(NSString *)stringByAddingAmpEscapes -{ - NSMutableString* dirtyStringMutant = [NSMutableString stringWithString:self]; - [dirtyStringMutant replaceOccurrencesOfString:@"&" - withString:@"&" - options:NSLiteralSearch - range:NSMakeRange(0,[dirtyStringMutant length])]; - [dirtyStringMutant replaceOccurrencesOfString:@"\"" - withString:@""" - options:NSLiteralSearch - range:NSMakeRange(0,[dirtyStringMutant length])]; - [dirtyStringMutant replaceOccurrencesOfString:@"<" - withString:@"<" - options:NSLiteralSearch - range:NSMakeRange(0,[dirtyStringMutant length])]; - [dirtyStringMutant replaceOccurrencesOfString:@">" - withString:@">" - options:NSLiteralSearch - range:NSMakeRange(0,[dirtyStringMutant length])]; - return [NSString stringWithString:dirtyStringMutant]; -} - -@end - - -@implementation NSMutableString (ChimeraMutableStringUtils) - -- (void)truncateTo:(unsigned)maxCharacters at:(ETruncationType)truncationType -{ - if ([self length] <= maxCharacters) - return; - - NSRange replaceRange; - replaceRange.length = [self length] - maxCharacters; - - switch (truncationType) { - case kTruncateAtStart: - replaceRange.location = 0; - break; - - case kTruncateAtMiddle: - replaceRange.location = maxCharacters / 2; - break; - - case kTruncateAtEnd: - replaceRange.location = maxCharacters; - break; - - default: -#if DEBUG - NSLog(@"Unknown truncation type in stringByTruncatingTo::"); -#endif - replaceRange.location = maxCharacters; - break; - } - - [self replaceCharactersInRange:replaceRange withString:[NSString ellipsisString]]; -} - - -- (void)truncateToWidth:(float)maxWidth - at:(ETruncationType)truncationType - withAttributes:(NSDictionary *)attributes -{ - // First check if we have to truncate at all. - if ([self sizeWithAttributes:attributes].width <= maxWidth) - return; - - // Essentially, we perform a binary search on the string length - // which fits best into maxWidth. - - float width = maxWidth; - int lo = 0; - int hi = [self length]; - int mid; - - // Make a backup copy of the string so that we can restore it if we fail low. - NSMutableString *backup = [self mutableCopy]; - - while (hi >= lo) { - mid = (hi + lo) / 2; - - // Cut to mid chars and calculate the resulting width - [self truncateTo:mid at:truncationType]; - width = [self sizeWithAttributes:attributes].width; - - if (width > maxWidth) { - // Fail high - string is still to wide. For the next cut, we can simply - // work on the already cut string, so we don't restore using the backup. - hi = mid - 1; - } - else if (width == maxWidth) { - // Perfect match, abort the search. - break; - } - else { - // Fail low - we cut off too much. Restore the string before cutting again. - lo = mid + 1; - [self setString:backup]; - } - } - // Perform the final cut (unless this was already a perfect match). - if (width != maxWidth) - [self truncateTo:hi at:truncationType]; - [backup release]; -} - -@end - -@implementation NSString (ChimeraFilePathStringUtils) - -- (NSString*)volumeNamePathComponent -{ - // if the file doesn't exist, then componentsToDisplayForPath will return nil, - // so back up to the nearest existing dir - NSString* curPath = self; - while (![[NSFileManager defaultManager] fileExistsAtPath:curPath]) - { - NSString* parentDirPath = [curPath stringByDeletingLastPathComponent]; - if ([parentDirPath isEqualToString:curPath]) - break; // avoid endless loop - curPath = parentDirPath; - } - - NSArray* displayComponents = [[NSFileManager defaultManager] componentsToDisplayForPath:curPath]; - if ([displayComponents count] > 0) - return [displayComponents objectAtIndex:0]; - - return self; -} - -- (NSString*)displayNameOfLastPathComponent -{ - return [[NSFileManager defaultManager] displayNameAtPath:self]; -} - -@end - -@implementation NSString (CaminoURLStringUtils) - -- (BOOL)isBlankURL -{ - return ([self isEqualToString:@"about:blank"] || [self isEqualToString:@""]); -} - -// Excluded character list comes from RFC2396 and by examining Safari's behaviour -- (NSString*)unescapedURI -{ - NSString *unescapedURI = (NSString*)CFURLCreateStringByReplacingPercentEscapesUsingEncoding(kCFAllocatorDefault, - (CFStringRef)self, - CFSTR(" \"\';/?:@&=+$,#"), - kCFStringEncodingUTF8); - return unescapedURI ? [unescapedURI autorelease] : self; -} - -@end diff --git a/third_party/mozilla/include/NSURL+Utils.h b/third_party/mozilla/include/NSURL+Utils.h deleted file mode 100644 index dc7501e..0000000 --- a/third_party/mozilla/include/NSURL+Utils.h +++ /dev/null @@ -1,51 +0,0 @@ -/* ***** BEGIN LICENSE BLOCK ***** - * Version: MPL 1.1/GPL 2.0/LGPL 2.1 - * - * The contents of this file are subject to the Mozilla Public License Version - * 1.1 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License - * for the specific language governing rights and limitations under the - * License. - * - * The Original Code is Camino code. - * - * The Initial Developer of the Original Code is - * Netscape Communications Corporation. - * Portions created by the Initial Developer are Copyright (C) 2002 - * the Initial Developer. All Rights Reserved. - * - * Contributor(s): - * Nate Weaver (Wevah) - wevah@derailer.org - * - * Alternatively, the contents of this file may be used under the terms of - * either the GNU General Public License Version 2 or later (the "GPL"), or - * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), - * in which case the provisions of the GPL or the LGPL are applicable instead - * of those above. If you wish to allow use of your version of this file only - * under the terms of either the GPL or the LGPL, and not to allow others to - * use your version of this file under the terms of the MPL, indicate your - * decision by deleting the provisions above and replace them with the notice - * and other provisions required by the GPL or the LGPL. If you do not delete - * the provisions above, a recipient may use your version of this file under - * the terms of any one of the MPL, the GPL or the LGPL. - * - * ***** END LICENSE BLOCK ***** */ - -#import <Cocoa/Cocoa.h> - - -@interface NSURL (CaminoExtensions) - -// This takes an NSURL to a local file, and if that file is a file that -// represents a URL, returns the URL it contains. Otherwise, returns the -// passed URL. Supports .url, .webloc and .ftploc files. -+ (NSURL*)decodeLocalFileURL:(NSURL*)url; - -+(NSURL*)URLFromInetloc:(NSString*)inFile; -+(NSURL*)URLFromIEURLFile:(NSString*)inFile; - -@end diff --git a/third_party/mozilla/include/NSURL+Utils.m b/third_party/mozilla/include/NSURL+Utils.m deleted file mode 100644 index 300facd..0000000 --- a/third_party/mozilla/include/NSURL+Utils.m +++ /dev/null @@ -1,148 +0,0 @@ -/* ***** BEGIN LICENSE BLOCK ***** - * Version: MPL 1.1/GPL 2.0/LGPL 2.1 - * - * The contents of this file are subject to the Mozilla Public License Version - * 1.1 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License - * for the specific language governing rights and limitations under the - * License. - * - * The Original Code is Camino code. - * - * The Initial Developer of the Original Code is - * Netscape Communications Corporation. - * Portions created by the Initial Developer are Copyright (C) 2002 - * the Initial Developer. All Rights Reserved. - * - * Contributor(s): - * Nate Weaver (Wevah) - wevah@derailer.org - * - * Alternatively, the contents of this file may be used under the terms of - * either the GNU General Public License Version 2 or later (the "GPL"), or - * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), - * in which case the provisions of the GPL or the LGPL are applicable instead - * of those above. If you wish to allow use of your version of this file only - * under the terms of either the GPL or the LGPL, and not to allow others to - * use your version of this file under the terms of the MPL, indicate your - * decision by deleting the provisions above and replace them with the notice - * and other provisions required by the GPL or the LGPL. If you do not delete - * the provisions above, a recipient may use your version of this file under - * the terms of any one of the MPL, the GPL or the LGPL. - * - * ***** END LICENSE BLOCK ***** */ - -#import "NSURL+Utils.h" - - -@implementation NSURL (CaminoExtensions) - -+ (NSURL*)decodeLocalFileURL:(NSURL*)url -{ - NSString* urlPathString = [url path]; - NSString* ext = [[urlPathString pathExtension] lowercaseString]; - OSType fileType = NSHFSTypeCodeFromFileType(NSHFSTypeOfFile(urlPathString)); - - if ([ext isEqualToString:@"url"] || fileType == 'LINK') { - url = [NSURL URLFromIEURLFile:urlPathString]; - } - else if ([ext isEqualToString:@"webloc"] || [ext isEqualToString:@"ftploc"] || - fileType == 'ilht' || fileType == 'ilft') - { - url = [NSURL URLFromInetloc:urlPathString]; - } - - return url; -} - -// -// Reads the URL from a .webloc/.ftploc file. -// Returns the URL, or nil on failure. -// -+(NSURL*)URLFromInetloc:(NSString*)inFile -{ - FSRef ref; - NSURL *ret = nil; - - if (inFile && FSPathMakeRef((UInt8 *)[inFile fileSystemRepresentation], &ref, NULL) == noErr) { - short resRef; - - resRef = FSOpenResFile(&ref, fsRdPerm); - - if (resRef != -1) { // Has resouce fork. - Handle urlResHandle; - - if ((urlResHandle = Get1Resource('url ', 256))) { // Has 'url ' resource with ID 256. - long size; - - size = GetMaxResourceSize(urlResHandle); -// Begin Google Modified -// ret = [NSURL URLWithString:[NSString stringWithCString:(char *)*urlResHandle length:size]]; - NSString *urlString = [[[NSString alloc] initWithBytes:(void *)*urlResHandle - length:size - encoding:NSMacOSRomanStringEncoding] // best guess here - autorelease]; - ret = [NSURL URLWithString:urlString]; -// End Google Modified - } - - CloseResFile(resRef); - } - - if (!ret) { // Look for valid plist data. - NSDictionary *plist; - if ((plist = [[NSDictionary alloc] initWithContentsOfFile:inFile])) { - ret = [NSURL URLWithString:[plist objectForKey:@"URL"]]; - [plist release]; - } - } - } - - return ret; -} - -// -// Reads the URL from a .url file. -// Returns the URL or nil on failure. -// -+(NSURL*)URLFromIEURLFile:(NSString*)inFile -{ - NSURL *ret = nil; - - // Is this really an IE .url file? - if (inFile) { - NSCharacterSet *newlines = [NSCharacterSet characterSetWithCharactersInString:@"\r\n"]; - // Begin Google Modified -// NSScanner *scanner = [NSScanner scannerWithString:[NSString stringWithContentsOfFile:inFile]]; - NSString *fileString = [NSString stringWithContentsOfFile:inFile - encoding:NSWindowsCP1252StringEncoding // best guess here - error:nil]; - NSScanner *scanner = [NSScanner scannerWithString:fileString]; - // End Google Modified - [scanner scanUpToString:@"[InternetShortcut]" intoString:nil]; - - if ([scanner scanString:@"[InternetShortcut]" intoString:nil]) { - // Scan each non-empty line in this section. We don't need to explicitly scan the newlines or - // whitespace because NSScanner ignores these by default. - NSString *line; - - while ([scanner scanUpToCharactersFromSet:newlines intoString:&line]) { - if ([line hasPrefix:@"URL="]) { - ret = [NSURL URLWithString:[line substringFromIndex:4]]; - break; - } - else if ([line hasPrefix:@"["]) { - // This is the start of a new section, so if we haven't found an URL yet, we should bail. - break; - } - } - } - } - - return ret; -} - -@end diff --git a/third_party/mozilla/include/NSWorkspace+Utils.h b/third_party/mozilla/include/NSWorkspace+Utils.h deleted file mode 100644 index 2ef1d10..0000000 --- a/third_party/mozilla/include/NSWorkspace+Utils.h +++ /dev/null @@ -1,64 +0,0 @@ -/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* ***** BEGIN LICENSE BLOCK ***** - * Version: MPL 1.1/GPL 2.0/LGPL 2.1 - * - * The contents of this file are subject to the Mozilla Public License Version - * 1.1 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License - * for the specific language governing rights and limitations under the - * License. - * - * The Original Code is mozilla.org code. - * - * The Initial Developer of the Original Code is - * Netscape Communications Corporation. - * Portions created by the Initial Developer are Copyright (C) 2002 - * the Initial Developer. All Rights Reserved. - * - * Contributor(s): - * Simon Fraser <smfr@smfr.org> - * Josh Aas <josh@mozilla.com> - * - * Alternatively, the contents of this file may be used under the terms of - * either the GNU General Public License Version 2 or later (the "GPL"), or - * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), - * in which case the provisions of the GPL or the LGPL are applicable instead - * of those above. If you wish to allow use of your version of this file only - * under the terms of either the GPL or the LGPL, and not to allow others to - * use your version of this file under the terms of the MPL, indicate your - * decision by deleting the provisions above and replace them with the notice - * and other provisions required by the GPL or the LGPL. If you do not delete - * the provisions above, a recipient may use your version of this file under - * the terms of any one of the MPL, the GPL or the LGPL. - * - * ***** END LICENSE BLOCK ***** */ - -#import <AppKit/AppKit.h> - -@interface NSWorkspace(CaminoDefaultBrowserAdditions) - -- (NSArray*)installedBrowserIdentifiers; // sort order not specified -- (NSString*)defaultBrowserIdentifier; -- (NSURL*)defaultBrowserURL; - -- (NSArray*)installedFeedViewerIdentifiers; -- (NSString*)defaultFeedViewerIdentifier; -- (NSURL*)defaultFeedViewerURL; - -- (void)setDefaultBrowserWithIdentifier:(NSString*)bundleID; -- (void)setDefaultFeedViewerWithIdentifier:(NSString*)bundleID; - -- (NSURL*)urlOfApplicationWithIdentifier:(NSString*)bundleID; -- (NSString*)identifierForBundle:(NSURL*)inBundleURL; -- (NSString*)displayNameForFile:(NSURL*)inFileURL; - -// OS feature checks -+ (NSString*)osVersionString; -+ (BOOL)isLeopardOrHigher; - -@end - diff --git a/third_party/mozilla/include/NSWorkspace+Utils.m b/third_party/mozilla/include/NSWorkspace+Utils.m deleted file mode 100644 index e3d052c..0000000 --- a/third_party/mozilla/include/NSWorkspace+Utils.m +++ /dev/null @@ -1,187 +0,0 @@ -/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* ***** BEGIN LICENSE BLOCK ***** - * Version: MPL 1.1/GPL 2.0/LGPL 2.1 - * - * The contents of this file are subject to the Mozilla Public License Version - * 1.1 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License - * for the specific language governing rights and limitations under the - * License. - * - * The Original Code is mozilla.org code. - * - * The Initial Developer of the Original Code is - * Netscape Communications Corporation. - * Portions created by the Initial Developer are Copyright (C) 2002 - * the Initial Developer. All Rights Reserved. - * - * Contributor(s): - * Simon Fraser <smfr@smfr.org> - * Josh Aas <josh@mozilla.com> - * Nick Kreeger <nick.kreeger@park.edu> - * - * Alternatively, the contents of this file may be used under the terms of - * either the GNU General Public License Version 2 or later (the "GPL"), or - * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), - * in which case the provisions of the GPL or the LGPL are applicable instead - * of those above. If you wish to allow use of your version of this file only - * under the terms of either the GPL or the LGPL, and not to allow others to - * use your version of this file under the terms of the MPL, indicate your - * decision by deleting the provisions above and replace them with the notice - * and other provisions required by the GPL or the LGPL. If you do not delete - * the provisions above, a recipient may use your version of this file under - * the terms of any one of the MPL, the GPL or the LGPL. - * - * ***** END LICENSE BLOCK ***** */ - -#import "NSWorkspace+Utils.h" - -@implementation NSWorkspace(CaminoDefaultBrowserAdditions) - -- (NSArray*)installedBrowserIdentifiers -{ - NSArray* apps = [(NSArray*)LSCopyAllHandlersForURLScheme(CFSTR("https")) autorelease]; - - // add the default if it isn't there - NSString* defaultHandler = [self defaultBrowserIdentifier]; - if (defaultHandler && ([apps indexOfObject:defaultHandler] == NSNotFound)) - apps = [apps arrayByAddingObject:defaultHandler]; - - return apps; -} - -- (NSArray*)installedFeedViewerIdentifiers -{ - NSArray* apps = [(NSArray*)LSCopyAllHandlersForURLScheme(CFSTR("feed")) autorelease]; - - // add the default if it isn't there - NSString* defaultHandler = [self defaultFeedViewerIdentifier]; - if (defaultHandler && ([apps indexOfObject:defaultHandler] == NSNotFound)) - apps = [apps arrayByAddingObject:defaultHandler]; - - return apps; -} - -- (NSString*)defaultBrowserIdentifier -{ - NSString* defaultBundleId = [(NSString*)LSCopyDefaultHandlerForURLScheme(CFSTR("http")) autorelease]; - // Sometimes LaunchServices likes to pretend there's no default browser. - // If that happens, we'll assume it's probably Safari. - if (!defaultBundleId) - defaultBundleId = @"com.apple.safari"; - return defaultBundleId; -} - -- (NSString*)defaultFeedViewerIdentifier -{ - return [(NSString*)LSCopyDefaultHandlerForURLScheme(CFSTR("feed")) autorelease]; -} - -- (NSURL*)defaultBrowserURL -{ - NSString* defaultBundleId = [self defaultBrowserIdentifier]; - if (defaultBundleId) - return [self urlOfApplicationWithIdentifier:defaultBundleId]; - return nil; -} - -- (NSURL*)defaultFeedViewerURL -{ - NSString* defaultBundleId = [self defaultFeedViewerIdentifier]; - if (defaultBundleId) - return [self urlOfApplicationWithIdentifier:defaultBundleId]; - return nil; -} - -- (void)setDefaultBrowserWithIdentifier:(NSString*)bundleID -{ - LSSetDefaultHandlerForURLScheme(CFSTR("http"), (CFStringRef)bundleID); - LSSetDefaultHandlerForURLScheme(CFSTR("https"), (CFStringRef)bundleID); - LSSetDefaultRoleHandlerForContentType(kUTTypeHTML, kLSRolesViewer, (CFStringRef)bundleID); - LSSetDefaultRoleHandlerForContentType(kUTTypeURL, kLSRolesViewer, (CFStringRef)bundleID); -} - -- (void)setDefaultFeedViewerWithIdentifier:(NSString*)bundleID -{ - LSSetDefaultHandlerForURLScheme(CFSTR("feed"), (CFStringRef)bundleID); -} - -- (NSURL*)urlOfApplicationWithIdentifier:(NSString*)bundleID -{ - if (!bundleID) - return nil; - NSURL* appURL = nil; - if (LSFindApplicationForInfo(kLSUnknownCreator, (CFStringRef)bundleID, NULL, NULL, (CFURLRef*)&appURL) == noErr) - return [appURL autorelease]; - - return nil; -} - -- (NSString*)identifierForBundle:(NSURL*)inBundleURL -{ - if (!inBundleURL) return nil; - - NSBundle* tmpBundle = [NSBundle bundleWithPath:[[inBundleURL path] stringByStandardizingPath]]; - if (tmpBundle) - { - NSString* tmpBundleID = [tmpBundle bundleIdentifier]; - if (tmpBundleID && ([tmpBundleID length] > 0)) { - return tmpBundleID; - } - } - return nil; -} - -- (NSString*)displayNameForFile:(NSURL*)inFileURL -{ - NSString *name; - LSCopyDisplayNameForURL((CFURLRef)inFileURL, (CFStringRef *)&name); - return [name autorelease]; -} - -// -// +osVersionString -// -// Returns the system version string from -// /System/Library/CoreServices/SystemVersion.plist -// (as recommended by Apple). -// -+ (NSString*)osVersionString -{ - NSDictionary* versionInfo = [NSDictionary dictionaryWithContentsOfFile:@"/System/Library/CoreServices/SystemVersion.plist"]; - return [versionInfo objectForKey:@"ProductVersion"]; -} - -// -// +systemVersion -// -// Returns the host's OS version as returned by the 'sysv' gestalt selector, -// 10.x.y = 0x000010xy -// -+ (long)systemVersion -{ - static long sSystemVersion = 0; - if (!sSystemVersion) - Gestalt(gestaltSystemVersion, &sSystemVersion); - return sSystemVersion; -} - -// -// +isLeopardOrHigher -// -// returns YES if we're on 10.5 or better -// -+ (BOOL)isLeopardOrHigher -{ -#if MAC_OS_X_VERSION_MIN_REQUIRED > MAC_OS_X_VERSION_10_4 - return YES; -#else - return [self systemVersion] >= 0x1050; -#endif -} - -@end diff --git a/third_party/mozilla/include/README.chromium b/third_party/mozilla/include/README.chromium deleted file mode 100644 index 12c22a3..0000000 --- a/third_party/mozilla/include/README.chromium +++ /dev/null @@ -1,44 +0,0 @@ -This directory contains files needed for mozilla interfaces required -for the new Java Plugin APIs. - -Definitions of frozen interfaces are copied from Gecko SDK -http://releases.mozilla.org/pub/mozilla.org/xulrunner/releases/1.8.0.4/sdk/gecko-sdk-win32-msvc-1.8.0.4.zip - -nscore.h -nsError.h -nsID.h -nsISupports.h -nsISupportsBase.h -nsrootidl.h -prcpucfg.h -prlong.h -prtime.h -prtypes.h -xpcom-config.h - -The prtypes.h file was modified to include "base/basictypes.h" instead of -mozilla's protypes.h to avoid type clashes. - -nsISupports.h was modified to remove inclusion of nsISupportsUtils.h to avoid -pulling in unnecessary headers and definitions. - -Definitions of remaining interfaces are auto generated during compilation of -Mozilla source code. For convenience, these are copied from: -http://publicsvn.songbirdnest.com/browser/trunk/dependencies/win32/mozilla/debug/include/plugin?rev=1 - -nsICookieStorage.h -nsIPluginManager.h -nsIPluginManager2.h -nsplugindefs.h -nspluginroot.h - -The following files come from mozilla/camino and are not part of the Gecko SDK: - -NSPasteboard+Utils.h/m -NSScreen+Utils.h/m -NSString+Utils.h/m -NSURL+Utils.h/m -NSWorkspace+Utils.h/m - -NSURL+Utils.m was modified to use non-deprecated Cocoa APIs to allow compilation -on future versions of Mac OS X. |