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 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
133 } | 133 } |
134 | 134 |
135 - (void)awakeFromNib { | 135 - (void)awakeFromNib { |
136 // Lay out the text controls from the bottom up. | 136 // Lay out the text controls from the bottom up. |
137 CGFloat totalYOffset = 0.0; | 137 CGFloat totalYOffset = 0.0; |
138 | 138 |
139 if ([errorMessage_ length] == 0) { | 139 if ([errorMessage_ length] == 0) { |
140 totalYOffset += | 140 totalYOffset += |
141 [GTMUILocalizerAndLayoutTweaker sizeToFitView:advancedLink_].height; | 141 [GTMUILocalizerAndLayoutTweaker sizeToFitView:advancedLink_].height; |
142 [[advancedLink_ cell] setTextColor: | 142 [[advancedLink_ cell] setTextColor: |
143 gfx::SkColorToCalibratedNSColor(chrome_style::GetLinkColor())]; | 143 skia::SkColorToCalibratedNSColor(chrome_style::GetLinkColor())]; |
144 } else { | 144 } else { |
145 // Don't display the advanced link for the error bubble. | 145 // Don't display the advanced link for the error bubble. |
146 // To align the Learn More link with the OK button, we need to offset by | 146 // To align the Learn More link with the OK button, we need to offset by |
147 // the height of the Advanced link, plus the padding between it and the | 147 // the height of the Advanced link, plus the padding between it and the |
148 // Learn More link above. | 148 // Learn More link above. |
149 float advancedLinkHeightPlusPadding = | 149 float advancedLinkHeightPlusPadding = |
150 [informativePlaceholderTextField_ frame].origin.y - | 150 [informativePlaceholderTextField_ frame].origin.y - |
151 [advancedLink_ frame].origin.y; | 151 [advancedLink_ frame].origin.y; |
152 | 152 |
153 totalYOffset -= advancedLinkHeightPlusPadding; | 153 totalYOffset -= advancedLinkHeightPlusPadding; |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
242 if (isSyncDialog_) { | 242 if (isSyncDialog_) { |
243 messageText = l10n_util::GetNSStringFWithFixup( | 243 messageText = l10n_util::GetNSStringFWithFixup( |
244 IDS_ONE_CLICK_SIGNIN_DIALOG_MESSAGE_NEW, email_); | 244 IDS_ONE_CLICK_SIGNIN_DIALOG_MESSAGE_NEW, email_); |
245 learnMoreOffset = [messageText length]; | 245 learnMoreOffset = [messageText length]; |
246 messageText = [messageText stringByAppendingFormat:@" %@", learnMoreText]; | 246 messageText = [messageText stringByAppendingFormat:@" %@", learnMoreText]; |
247 } else { | 247 } else { |
248 messageText = learnMoreText; | 248 messageText = learnMoreText; |
249 } | 249 } |
250 | 250 |
251 NSColor* linkColor = | 251 NSColor* linkColor = |
252 gfx::SkColorToCalibratedNSColor(chrome_style::GetLinkColor()); | 252 skia::SkColorToCalibratedNSColor(chrome_style::GetLinkColor()); |
253 [informativeTextView_ setMessage:messageText | 253 [informativeTextView_ setMessage:messageText |
254 withFont:font | 254 withFont:font |
255 messageColor:[NSColor blackColor]]; | 255 messageColor:[NSColor blackColor]]; |
256 [informativeTextView_ addLinkRange:NSMakeRange(learnMoreOffset, | 256 [informativeTextView_ addLinkRange:NSMakeRange(learnMoreOffset, |
257 [learnMoreText length]) | 257 [learnMoreText length]) |
258 withURL:@(chrome::kChromeSyncLearnMoreURL) | 258 withURL:@(chrome::kChromeSyncLearnMoreURL) |
259 linkColor:linkColor]; | 259 linkColor:linkColor]; |
260 | 260 |
261 // Make the "Advanced" link font as large as the "Learn More" link. | 261 // Make the "Advanced" link font as large as the "Learn More" link. |
262 [[advancedLink_ cell] setFont:font]; | 262 [[advancedLink_ cell] setFont:font]; |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
303 | 303 |
304 @end | 304 @end |
305 | 305 |
306 @implementation OneClickSigninViewController (TestingAPI) | 306 @implementation OneClickSigninViewController (TestingAPI) |
307 | 307 |
308 - (NSTextView*)linkViewForTesting { | 308 - (NSTextView*)linkViewForTesting { |
309 return informativeTextView_.get(); | 309 return informativeTextView_.get(); |
310 } | 310 } |
311 | 311 |
312 @end | 312 @end |
OLD | NEW |