Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(248)

Unified Diff: chrome/browser/ui/cocoa/location_bar/autocomplete_text_field_cell.mm

Issue 2389343002: [Mac] Updating AutocompleteTextFieldCell to 10.8 (Closed)
Patch Set: Remove the write Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/cocoa/location_bar/autocomplete_text_field_cell.mm
diff --git a/chrome/browser/ui/cocoa/location_bar/autocomplete_text_field_cell.mm b/chrome/browser/ui/cocoa/location_bar/autocomplete_text_field_cell.mm
index 9a1a707f7f441960db2cd60c22b960a5f633683e..212d84c6d36fa560dbc26a7fef96adab39c10179 100644
--- a/chrome/browser/ui/cocoa/location_bar/autocomplete_text_field_cell.mm
+++ b/chrome/browser/ui/cocoa/location_bar/autocomplete_text_field_cell.mm
@@ -518,74 +518,6 @@ size_t CalculatePositionsInFrame(
point.y - decorationRect.origin.y));
}
-// Given a newly created .webloc plist url file, also give it a resource
-// fork and insert 'TEXT and 'url ' resources holding further copies of the
-// url data. This is required for apps such as Terminal and Safari to accept it
-// as a real webloc file when dragged in.
-// It's expected that the resource fork requirement will go away at some
-// point and this code can then be deleted.
-OSErr WriteURLToNewWebLocFileResourceFork(NSURL* file, NSString* urlStr) {
- ResFileRefNum refNum = kResFileNotOpened;
- ResFileRefNum prevResRef = CurResFile();
- FSRef fsRef;
- OSErr err = noErr;
- HFSUniStr255 resourceForkName;
- FSGetResourceForkName(&resourceForkName);
-
- if (![[NSFileManager defaultManager] fileExistsAtPath:[file path]])
- return fnfErr;
-
- if (!CFURLGetFSRef((CFURLRef)file, &fsRef))
- return fnfErr;
-
- err = FSCreateResourceFork(&fsRef,
- resourceForkName.length,
- resourceForkName.unicode,
- 0);
- if (err)
- return err;
- err = FSOpenResourceFile(&fsRef,
- resourceForkName.length,
- resourceForkName.unicode,
- fsRdWrPerm, &refNum);
- if (err)
- return err;
-
- const char* utf8URL = [urlStr UTF8String];
- int urlChars = strlen(utf8URL);
-
- Handle urlHandle = NewHandle(urlChars);
- memcpy(*urlHandle, utf8URL, urlChars);
-
- Handle textHandle = NewHandle(urlChars);
- memcpy(*textHandle, utf8URL, urlChars);
-
- // Data for the 'drag' resource.
- // This comes from derezzing webloc files made by the Finder.
- // It's bigendian data, so it's represented here as chars to preserve
- // byte order.
- char dragData[] = {
- 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, // Header.
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02,
- 0x54, 0x45, 0x58, 0x54, 0x00, 0x00, 0x01, 0x00, // 'TEXT', 0, 256
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x75, 0x72, 0x6C, 0x20, 0x00, 0x00, 0x01, 0x00, // 'url ', 0, 256
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
- };
- Handle dragHandle = NewHandleClear(sizeof(dragData));
- memcpy(*dragHandle, &dragData[0], sizeof(dragData));
-
- // Save the resources to the file.
- ConstStr255Param noName = {0};
- AddResource(dragHandle, 'drag', 128, noName);
- AddResource(textHandle, 'TEXT', 256, noName);
- AddResource(urlHandle, 'url ', 256, noName);
-
- CloseResFile(refNum);
- UseResFile(prevResRef);
- return noErr;
-}
-
// Returns the file path for file |name| if saved at NSURL |base|.
static NSString* PathWithBaseURLAndName(NSURL* base, NSString* name) {
NSString* filteredName =
@@ -684,9 +616,6 @@ static NSString* UnusedLegalNameForNewDropFile(NSURL* saveLocation,
[fileManager setAttributes:attr
ofItemAtPath:[outputURL path]
error:nil];
- // Add resource data.
- OSErr resStatus = WriteURLToNewWebLocFileResourceFork(outputURL, urlStr);
- OSSTATUS_DCHECK(resStatus == noErr, resStatus);
return [NSArray arrayWithObject:nameWithExtensionStr];
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698