OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/profiles/profile_signin_confirmation_view_contr
oller.h" | 5 #import "chrome/browser/ui/cocoa/profiles/profile_signin_confirmation_view_contr
oller.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <cmath> | 8 #include <cmath> |
9 | 9 |
10 #include "base/callback_helpers.h" | 10 #include "base/callback_helpers.h" |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 const base::string16& message, | 85 const base::string16& message, |
86 const base::string16& link, | 86 const base::string16& link, |
87 int offset, | 87 int offset, |
88 const ui::ResourceBundle::FontStyle& font_style) { | 88 const ui::ResourceBundle::FontStyle& font_style) { |
89 base::scoped_nsobject<HyperlinkTextView> textView( | 89 base::scoped_nsobject<HyperlinkTextView> textView( |
90 [[HyperlinkTextView alloc] initWithFrame:NSZeroRect]); | 90 [[HyperlinkTextView alloc] initWithFrame:NSZeroRect]); |
91 NSFont* font = ui::ResourceBundle::GetSharedInstance().GetFont( | 91 NSFont* font = ui::ResourceBundle::GetSharedInstance().GetFont( |
92 font_style).GetNativeFont(); | 92 font_style).GetNativeFont(); |
93 NSColor* linkColor = gfx::SkColorToCalibratedNSColor( | 93 NSColor* linkColor = gfx::SkColorToCalibratedNSColor( |
94 chrome_style::GetLinkColor()); | 94 chrome_style::GetLinkColor()); |
95 [textView setMessageAndLink:base::SysUTF16ToNSString(message) | 95 NSMutableString* finalMessage = [NSMutableString stringWithString: |
96 withLink:base::SysUTF16ToNSString(link) | 96 base::SysUTF16ToNSString(message)]; |
97 atOffset:offset | 97 NSString* linkString = base::SysUTF16ToNSString(link); |
98 font:font | 98 |
99 messageColor:[NSColor blackColor] | 99 [finalMessage insertString:linkString atIndex:offset]; |
100 linkColor:linkColor]; | 100 [textView setMessage:finalMessage |
| 101 withFont:font |
| 102 messageColor:[NSColor blackColor]]; |
| 103 [textView addLinkRange:NSMakeRange(offset, [linkString length]) |
| 104 withName:@"" |
| 105 linkColor:linkColor]; |
101 RemoveUnderlining(textView, offset, link.size()); | 106 RemoveUnderlining(textView, offset, link.size()); |
102 [textView setDelegate:delegate]; | 107 [textView setDelegate:delegate]; |
103 [parent addSubview:textView]; | 108 [parent addSubview:textView]; |
104 return textView.autorelease(); | 109 return textView.autorelease(); |
105 } | 110 } |
106 | 111 |
107 // Create a new NSTextField and add it to the specified parent. | 112 // Create a new NSTextField and add it to the specified parent. |
108 NSTextField* AddTextField( | 113 NSTextField* AddTextField( |
109 NSView* parent, | 114 NSView* parent, |
110 const base::string16& message, | 115 const base::string16& message, |
(...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
437 | 442 |
438 - (NSButton*)createProfileButton { | 443 - (NSButton*)createProfileButton { |
439 return createProfileButton_.get(); | 444 return createProfileButton_.get(); |
440 } | 445 } |
441 | 446 |
442 - (NSTextView*)explanationField { | 447 - (NSTextView*)explanationField { |
443 return explanationField_.get(); | 448 return explanationField_.get(); |
444 } | 449 } |
445 | 450 |
446 @end | 451 @end |
OLD | NEW |