| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_sync_promo_controller.h" | 5 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_sync_promo_controller.h" |
| 6 | 6 |
| 7 #include "base/strings/sys_string_conversions.h" | 7 #include "base/strings/sys_string_conversions.h" |
| 8 #include "chrome/browser/signin/signin_promo.h" | 8 #include "chrome/browser/signin/signin_promo.h" |
| 9 #include "chrome/browser/ui/chrome_pages.h" | 9 #include "chrome/browser/ui/chrome_pages.h" |
| 10 #include "chrome/browser/ui/chrome_style.h" | 10 #include "chrome/browser/ui/chrome_style.h" |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 NSString* nsLinkText = SysUTF16ToNSString(linkText); | 85 NSString* nsLinkText = SysUTF16ToNSString(linkText); |
| 86 NSFont* font = [NSFont labelFontOfSize:kFontSize]; | 86 NSFont* font = [NSFont labelFontOfSize:kFontSize]; |
| 87 NSColor* linkColor = gfx::SkColorToCalibratedNSColor( | 87 NSColor* linkColor = gfx::SkColorToCalibratedNSColor( |
| 88 chrome_style::GetLinkColor()); | 88 chrome_style::GetLinkColor()); |
| 89 | 89 |
| 90 textView_.reset([[HyperlinkTextView alloc] init]); | 90 textView_.reset([[HyperlinkTextView alloc] init]); |
| 91 [textView_ setMessage:nsPromoText | 91 [textView_ setMessage:nsPromoText |
| 92 withFont:font | 92 withFont:font |
| 93 messageColor:gfx::SkColorToDeviceNSColor(kTextColor)]; | 93 messageColor:gfx::SkColorToDeviceNSColor(kTextColor)]; |
| 94 [textView_ addLinkRange:NSMakeRange(offset, [nsLinkText length]) | 94 [textView_ addLinkRange:NSMakeRange(offset, [nsLinkText length]) |
| 95 withName:@"" | 95 withURL:@"about:blank" // using a link here is bad ui |
| 96 linkColor:linkColor]; | 96 linkColor:linkColor]; |
| 97 [textView_ setRefusesFirstResponder:YES]; | 97 [textView_ setRefusesFirstResponder:YES]; |
| 98 [[textView_ textContainer] setLineFragmentPadding:0.0]; | 98 [[textView_ textContainer] setLineFragmentPadding:0.0]; |
| 99 RemoveUnderlining(textView_, offset, linkText.size()); | 99 RemoveUnderlining(textView_, offset, linkText.size()); |
| 100 [textView_ setDelegate:self]; | 100 [textView_ setDelegate:self]; |
| 101 | 101 |
| 102 [promoView setContentView:textView_]; | 102 [promoView setContentView:textView_]; |
| 103 | 103 |
| 104 [self setView:promoView]; | 104 [self setView:promoView]; |
| 105 } | 105 } |
| 106 | 106 |
| 107 - (BOOL)textView:(NSTextView *)textView | 107 - (BOOL)textView:(NSTextView *)textView |
| 108 clickedOnLink:(id)link | 108 clickedOnLink:(id)link |
| 109 atIndex:(NSUInteger)charIndex { | 109 atIndex:(NSUInteger)charIndex { |
| 110 chrome::ShowBrowserSignin(browser_, signin_metrics::SOURCE_BOOKMARK_BUBBLE); | 110 chrome::ShowBrowserSignin(browser_, signin_metrics::SOURCE_BOOKMARK_BUBBLE); |
| 111 return YES; | 111 return YES; |
| 112 } | 112 } |
| 113 | 113 |
| 114 @end | 114 @end |
| OLD | NEW |