OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/one_click_signin_view_controller.h" | 5 #import "chrome/browser/ui/cocoa/one_click_signin_view_controller.h" |
6 | 6 |
7 #include "base/callback_helpers.h" | 7 #include "base/callback_helpers.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/mac/bundle_locations.h" | 9 #include "base/mac/bundle_locations.h" |
10 #import "chrome/browser/ui/chrome_style.h" | 10 #import "chrome/browser/ui/chrome_style.h" |
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
225 // programmatically. | 225 // programmatically. |
226 informativeTextView_.reset( | 226 informativeTextView_.reset( |
227 [[HyperlinkTextView alloc] initWithFrame:oldFrame]); | 227 [[HyperlinkTextView alloc] initWithFrame:oldFrame]); |
228 [informativeTextView_.get() setAutoresizingMask: | 228 [informativeTextView_.get() setAutoresizingMask: |
229 [informativePlaceholderTextField_ autoresizingMask]]; | 229 [informativePlaceholderTextField_ autoresizingMask]]; |
230 [informativeTextView_.get() setDelegate:self]; | 230 [informativeTextView_.get() setDelegate:self]; |
231 | 231 |
232 // Set the text. | 232 // Set the text. |
233 NSString* learnMoreText = l10n_util::GetNSStringWithFixup(IDS_LEARN_MORE); | 233 NSString* learnMoreText = l10n_util::GetNSStringWithFixup(IDS_LEARN_MORE); |
234 NSString* messageText; | 234 NSString* messageText; |
235 NSUInteger learnMoreOffset = 0; | |
235 | 236 |
236 ui::ResourceBundle::FontStyle fontStyle = isSyncDialog_ ? | 237 ui::ResourceBundle::FontStyle fontStyle = isSyncDialog_ ? |
237 chrome_style::kTextFontStyle : ui::ResourceBundle::SmallFont; | 238 chrome_style::kTextFontStyle : ui::ResourceBundle::SmallFont; |
238 NSFont* font = ui::ResourceBundle::GetSharedInstance().GetFont( | 239 NSFont* font = ui::ResourceBundle::GetSharedInstance().GetFont( |
239 fontStyle).GetNativeFont(); | 240 fontStyle).GetNativeFont(); |
240 | 241 |
241 // The non-modal bubble already has a text content and only needs the | 242 // The non-modal bubble already has a text content and only needs the |
242 // Learn More link (in a smaller font). | 243 // Learn More link (in a smaller font). |
243 if (isSyncDialog_) { | 244 if (isSyncDialog_) { |
244 messageText = l10n_util::GetNSStringFWithFixup( | 245 messageText = l10n_util::GetNSStringFWithFixup( |
245 IDS_ONE_CLICK_SIGNIN_DIALOG_MESSAGE_NEW, email_); | 246 IDS_ONE_CLICK_SIGNIN_DIALOG_MESSAGE_NEW, email_); |
246 messageText = [messageText stringByAppendingString:@" "]; | 247 learnMoreOffset = [messageText length]; |
248 messageText = [messageText stringByAppendingFormat:@" %@", learnMoreText]; | |
247 } else { | 249 } else { |
248 messageText = @""; | 250 messageText = learnMoreText; |
249 } | 251 } |
250 | 252 |
251 NSColor* linkColor = | 253 NSColor* linkColor = |
252 gfx::SkColorToCalibratedNSColor(chrome_style::GetLinkColor()); | 254 gfx::SkColorToCalibratedNSColor(chrome_style::GetLinkColor()); |
253 [informativeTextView_ setMessageAndLink:messageText | 255 [informativeTextView_ setMessage:messageText |
254 withLink:learnMoreText | 256 withFont:font |
255 atOffset:[messageText length] | 257 messageColor:[NSColor blackColor]]; |
256 font:font | 258 [informativeTextView_ addLinkRange:NSMakeRange(learnMoreOffset, |
257 messageColor:[NSColor blackColor] | 259 [learnMoreText length]) |
groby-ooo-7-16
2015/01/30 23:08:39
nit: parameters should be aligned
shrike
2015/02/02 17:39:13
The style guide had me confused on continuation li
| |
258 linkColor:linkColor]; | 260 withName:@"" |
259 | 261 linkColor:linkColor]; |
260 | 262 |
261 // Make the "Advanced" link font as large as the "Learn More" link. | 263 // Make the "Advanced" link font as large as the "Learn More" link. |
262 [[advancedLink_ cell] setFont:font]; | 264 [[advancedLink_ cell] setFont:font]; |
263 [advancedLink_ sizeToFit]; | 265 [advancedLink_ sizeToFit]; |
264 | 266 |
265 // Size to fit. | 267 // Size to fit. |
266 [[informativePlaceholderTextField_ cell] setAttributedStringValue: | 268 [[informativePlaceholderTextField_ cell] setAttributedStringValue: |
267 [informativeTextView_ attributedString]]; | 269 [informativeTextView_ attributedString]]; |
268 [GTMUILocalizerAndLayoutTweaker | 270 [GTMUILocalizerAndLayoutTweaker |
269 sizeToFitFixedWidthTextField:informativePlaceholderTextField_]; | 271 sizeToFitFixedWidthTextField:informativePlaceholderTextField_]; |
(...skipping 25 matching lines...) Expand all Loading... | |
295 ui::PAGE_TRANSITION_LINK, false); | 297 ui::PAGE_TRANSITION_LINK, false); |
296 webContents_->OpenURL(params); | 298 webContents_->OpenURL(params); |
297 return YES; | 299 return YES; |
298 } | 300 } |
299 | 301 |
300 - (void)close { | 302 - (void)close { |
301 base::ResetAndReturn(&closeCallback_).Run(); | 303 base::ResetAndReturn(&closeCallback_).Run(); |
302 } | 304 } |
303 | 305 |
304 @end | 306 @end |
OLD | NEW |