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

Unified Diff: chrome/browser/ui/cocoa/infobars/confirm_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/confirm_infobar_controller.mm
diff --git a/chrome/browser/ui/cocoa/infobars/confirm_infobar_controller.mm b/chrome/browser/ui/cocoa/infobars/confirm_infobar_controller.mm
index 6affa4e9005b429fdb7e18a58ad91c48951f8cfc..605b4058537743800b42de4579d019d88e6cb2f3 100644
--- a/chrome/browser/ui/cocoa/infobars/confirm_infobar_controller.mm
+++ b/chrome/browser/ui/cocoa/infobars/confirm_infobar_controller.mm
@@ -108,20 +108,22 @@
// Set the text and link.
NSString* message = base::SysUTF16ToNSString(delegate->GetMessageText());
- base::string16 link = delegate->GetLinkText();
- if (!link.empty()) {
+ NSString* link = base::SysUTF16ToNSString(delegate->GetLinkText());
+ NSUInteger linkOffset = [message length];
+ NSUInteger linkLength = [link length];
+ if (linkLength != 0) {
// Add spacing between the label and the link.
- message = [message stringByAppendingString:@" "];
+ message = [message stringByAppendingFormat:@" %@", link];
}
NSFont* font = [NSFont labelFontOfSize:
- [NSFont systemFontSizeForControlSize:NSRegularControlSize]];
+ [NSFont systemFontSizeForControlSize:NSRegularControlSize]];
groby-ooo-7-16 2015/01/30 23:08:39 I suppose this is "git cl format"'s doing?
shrike 2015/02/02 17:39:13 No - me learning the style guide. Done.
HyperlinkTextView* view = (HyperlinkTextView*)label_.get();
- [view setMessageAndLink:message
- withLink:base::SysUTF16ToNSString(link)
- atOffset:[message length]
- font:font
- messageColor:[NSColor blackColor]
- linkColor:[NSColor blueColor]];
+ [view setMessage:message withFont:font messageColor:[NSColor blackColor]];
+ if (linkLength != 0) {
+ [view addLinkRange:NSMakeRange(linkOffset, linkLength)
+ 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