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

Unified Diff: chrome/browser/ui/cocoa/infobars/alternate_nav_infobar_controller.mm

Issue 887823002: Finished swap out of old API (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove unit test for [HyperlinkTextView setMessageAndLink:withLink:atOffset:font:messageColor:linkC… Created 5 years, 11 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
Index: chrome/browser/ui/cocoa/infobars/alternate_nav_infobar_controller.mm
diff --git a/chrome/browser/ui/cocoa/infobars/alternate_nav_infobar_controller.mm b/chrome/browser/ui/cocoa/infobars/alternate_nav_infobar_controller.mm
index 30d1e79d32b685c2be0f8ca8062811547afec0a6..e524007b776a0b7ab578b4409a31b88dae931711 100644
--- a/chrome/browser/ui/cocoa/infobars/alternate_nav_infobar_controller.mm
+++ b/chrome/browser/ui/cocoa/infobars/alternate_nav_infobar_controller.mm
@@ -29,16 +29,17 @@
DCHECK(delegate);
size_t offset = base::string16::npos;
base::string16 message = delegate->GetMessageTextWithOffset(&offset);
- base::string16 link = delegate->GetLinkText();
+ NSMutableString* finalMessage =
groby-ooo-7-16 2015/01/30 23:08:39 I'd suggest doing the string composition in C++ in
shrike 2015/02/02 17:39:13 I agree. Done.
+ [NSMutableString stringWithString:base::SysUTF16ToNSString(message)];
+ NSString* link = base::SysUTF16ToNSString(delegate->GetLinkText());
+ [finalMessage insertString:link atIndex:offset];
NSFont* font = [NSFont labelFontOfSize:
- [NSFont systemFontSizeForControlSize:NSRegularControlSize]];
+ [NSFont systemFontSizeForControlSize:NSRegularControlSize]];
HyperlinkTextView* view = (HyperlinkTextView*)label_.get();
- [view setMessageAndLink:base::SysUTF16ToNSString(message)
- withLink:base::SysUTF16ToNSString(link)
- atOffset:offset
- font:font
- messageColor:[NSColor blackColor]
- linkColor:[NSColor blueColor]];
+ [view setMessage:finalMessage withFont:font messageColor:[NSColor blackColor]];
+ [view addLinkRange:NSMakeRange(offset, [link length])
+ withName:@""
+ linkColor:[NSColor blueColor]];
}
// Called when someone clicks on the link in the infobar. This method

Powered by Google App Engine
This is Rietveld 408576698