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

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

Issue 1157733005: Make 'Google Smart Lock' a hyperlink in the password infobar on Mac. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 5 years, 6 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 78037d964bd3a7e72801d87a98912b96d22cd137..dec5c8e3aa0aa16486acb5adc4620a364c71a198 100644
--- a/chrome/browser/ui/cocoa/infobars/confirm_infobar_controller.mm
+++ b/chrome/browser/ui/cocoa/infobars/confirm_infobar_controller.mm
@@ -7,8 +7,10 @@
#include "base/logging.h"
#include "base/strings/sys_string_conversions.h"
#include "chrome/browser/infobars/infobar_service.h"
+#include "chrome/browser/ui/chrome_style.h"
#include "chrome/browser/ui/cocoa/infobars/infobar_cocoa.h"
#include "components/infobars/core/confirm_infobar_delegate.h"
+#include "skia/ext/skia_utils_mac.h"
#include "third_party/google_toolbox_for_mac/src/AppKit/GTMUILocalizerAndLayoutTweaker.h"
#import "ui/base/cocoa/cocoa_base_utils.h"
#import "ui/base/cocoa/controls/hyperlink_text_view.h"
@@ -106,8 +108,9 @@
frame.size.width = rightEdge - NSMinX(frame);
[label_.get() setFrame:frame];
- // Set the text and link.
+ // Set the text and links.
NSString* message = base::SysUTF16ToNSString(delegate->GetMessageText());
+ // Set the trailing link.
NSString* link = base::SysUTF16ToNSString(delegate->GetLinkText());
NSUInteger linkOffset = [message length];
NSUInteger linkLength = [link length];
@@ -121,9 +124,20 @@
HyperlinkTextView* view = (HyperlinkTextView*)label_.get();
[view setMessage:message withFont:font messageColor:[NSColor blackColor]];
if (linkLength != 0) {
+ NSColor* linkColor =
+ gfx::SkColorToCalibratedNSColor(chrome_style::GetLinkColor());
[view addLinkRange:NSMakeRange(linkOffset, linkLength)
withName:@""
- linkColor:[NSColor blueColor]];
+ linkColor:linkColor];
+ }
+ // Set the link inside the message.
+ gfx::Range linkRange = delegate->GetMessageLinkRange();
+ if (!linkRange.is_empty()) {
+ NSColor* linkColor =
+ gfx::SkColorToCalibratedNSColor(chrome_style::GetLinkColor());
+ [view addLinkRange:linkRange.ToNSRange()
+ withName:@""
+ linkColor:linkColor];
}
}

Powered by Google App Engine
This is Rietveld 408576698