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

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: Fixed formatting issues, changed code to perform string operations in C++ rather than ObjC 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..4e8c1fe69c7d6975645645c107982e55c6a5a9ac 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]];
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