From 8aa0f562f0e4a7519bd0f71e078a75f81c15d056 Mon Sep 17 00:00:00 2001 From: "viettrungluu@chromium.org" Date: Thu, 15 Apr 2010 18:15:55 +0000 Subject: Mac: sync with upstream (Camino) NSPasteboard+Utils.mm The upstream commit message is: Fix bug 448058 - 'Bookmark bar -> Copy Information to Clipboard -> Mail fails' and bug 491448 - 'Copy Link/Image Location does not paste into Pages or RTF Mail message' by setting a non-empty title string in WebURLsWithTitlesPboardType. Patch by Christopher Henderson , r=cl, r=me, sr=smorgan BUG=none (probably *something*, but what?) TEST=trybots, unit tests, everything still works Review URL: http://codereview.chromium.org/1545040 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@44669 0039d316-1c4b-4281-b951-d872f2087c98 --- third_party/mozilla/NSPasteboard+Utils.mm | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'third_party') diff --git a/third_party/mozilla/NSPasteboard+Utils.mm b/third_party/mozilla/NSPasteboard+Utils.mm index 2a7ee5e..255566e0 100644 --- a/third_party/mozilla/NSPasteboard+Utils.mm +++ b/third_party/mozilla/NSPasteboard+Utils.mm @@ -111,7 +111,7 @@ NSString* const kWebURLsWithTitlesPboardType = @"WebURLsWithTitlesPboardType"; if (!inTitles) { NSMutableArray* tmpTitleArray = [NSMutableArray arrayWithCapacity:urlCount]; for (unsigned int i = 0; i < urlCount; ++i) - [tmpTitleArray addObject:@""]; + [tmpTitleArray addObject:[inUrls objectAtIndex:i]]; inTitles = tmpTitleArray; } @@ -133,11 +133,8 @@ NSString* const kWebURLsWithTitlesPboardType = @"WebURLsWithTitlesPboardType"; [self setPropertyList:clipboardData forType:kWebURLsWithTitlesPboardType]; if (urlCount == 1) { - NSString* title = @""; - if (inTitles) - title = [inTitles objectAtIndex:0]; - NSString* url = [inUrls objectAtIndex:0]; + NSString* title = [inTitles objectAtIndex:0]; [[NSURL URLWithString:url] writeToPasteboard:self]; [self setString:url forType:NSStringPboardType]; @@ -159,7 +156,7 @@ NSString* const kWebURLsWithTitlesPboardType = @"WebURLsWithTitlesPboardType"; // there is data there, but get nothing NSString* firstURL = [inUrls objectAtIndex:0]; - NSString* firstTitle = ([inTitles count] > 0) ? [inTitles objectAtIndex:0] : @""; + NSString* firstTitle = [inTitles objectAtIndex:0]; const char* tempCString = [firstURL UTF8String]; [self setData:[NSData dataWithBytes:tempCString length:strlen(tempCString)] forType:kCorePasteboardFlavorType_url]; -- cgit v1.1