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 <Cocoa/Cocoa.h> | 5 #import <Cocoa/Cocoa.h> |
6 | 6 |
7 #import "chrome/browser/ui/cocoa/profiles/profile_chooser_controller.h" | 7 #import "chrome/browser/ui/cocoa/profiles/profile_chooser_controller.h" |
8 | 8 |
9 #include "base/mac/bundle_locations.h" | 9 #include "base/mac/bundle_locations.h" |
10 #include "base/prefs/pref_service.h" | 10 #include "base/prefs/pref_service.h" |
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
159 id<NSTextViewDelegate> delegate, | 159 id<NSTextViewDelegate> delegate, |
160 NSString* message, | 160 NSString* message, |
161 NSString* link, | 161 NSString* link, |
162 int link_offset, | 162 int link_offset, |
163 NSPoint frame_origin, | 163 NSPoint frame_origin, |
164 CGFloat frame_width) { | 164 CGFloat frame_width) { |
165 base::scoped_nsobject<HyperlinkTextView> text_view( | 165 base::scoped_nsobject<HyperlinkTextView> text_view( |
166 [[HyperlinkTextView alloc] initWithFrame:NSZeroRect]); | 166 [[HyperlinkTextView alloc] initWithFrame:NSZeroRect]); |
167 NSColor* link_color = gfx::SkColorToCalibratedNSColor( | 167 NSColor* link_color = gfx::SkColorToCalibratedNSColor( |
168 chrome_style::GetLinkColor()); | 168 chrome_style::GetLinkColor()); |
| 169 NSMutableString* finalMessage = |
| 170 [NSMutableString stringWithFormat:@"%@\n", message]; |
| 171 [finalMessage insertString:link atIndex:link_offset]; |
169 // Adds a padding row at the bottom, because |boundingRectWithSize| below cuts | 172 // Adds a padding row at the bottom, because |boundingRectWithSize| below cuts |
170 // off the last row sometimes. | 173 // off the last row sometimes. |
171 [text_view setMessageAndLink:[NSString stringWithFormat:@"%@\n", message] | 174 [text_view setMessage:finalMessage |
172 withLink:link | 175 withFont:[NSFont labelFontOfSize:kTextFontSize] |
173 atOffset:link_offset | 176 messageColor:[NSColor blackColor]]; |
174 font:[NSFont labelFontOfSize:kTextFontSize] | 177 [text_view addLinkRange:NSMakeRange(link_offset, [link length]) |
175 messageColor:[NSColor blackColor] | 178 withName:@"" |
176 linkColor:link_color]; | 179 linkColor:link_color]; |
177 | 180 |
178 // Removes the underlining from the link. | 181 // Removes the underlining from the link. |
179 [text_view setLinkTextAttributes:nil]; | 182 [text_view setLinkTextAttributes:nil]; |
180 NSTextStorage* text_storage = [text_view textStorage]; | 183 NSTextStorage* text_storage = [text_view textStorage]; |
181 NSRange link_range = NSMakeRange(link_offset, [link length]); | 184 NSRange link_range = NSMakeRange(link_offset, [link length]); |
182 [text_storage addAttribute:NSUnderlineStyleAttributeName | 185 [text_storage addAttribute:NSUnderlineStyleAttributeName |
183 value:[NSNumber numberWithInt:NSUnderlineStyleNone] | 186 value:[NSNumber numberWithInt:NSUnderlineStyleNone] |
184 range:link_range]; | 187 range:link_range]; |
185 | 188 |
186 NSRect frame = [[text_view attributedString] | 189 NSRect frame = [[text_view attributedString] |
(...skipping 2072 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2259 } | 2262 } |
2260 | 2263 |
2261 - (bool)shouldShowGoIncognito { | 2264 - (bool)shouldShowGoIncognito { |
2262 bool incognitoAvailable = | 2265 bool incognitoAvailable = |
2263 IncognitoModePrefs::GetAvailability(browser_->profile()->GetPrefs()) != | 2266 IncognitoModePrefs::GetAvailability(browser_->profile()->GetPrefs()) != |
2264 IncognitoModePrefs::DISABLED; | 2267 IncognitoModePrefs::DISABLED; |
2265 return incognitoAvailable && !browser_->profile()->IsGuestSession(); | 2268 return incognitoAvailable && !browser_->profile()->IsGuestSession(); |
2266 } | 2269 } |
2267 | 2270 |
2268 @end | 2271 @end |
OLD | NEW |