| 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 NSView* parent, | 85 NSView* parent, |
| 86 id<NSTextViewDelegate> delegate, | 86 id<NSTextViewDelegate> delegate, |
| 87 const base::string16& message, | 87 const base::string16& message, |
| 88 const base::string16& link, | 88 const base::string16& link, |
| 89 int offset, | 89 int offset, |
| 90 const ui::ResourceBundle::FontStyle& font_style) { | 90 const ui::ResourceBundle::FontStyle& font_style) { |
| 91 base::scoped_nsobject<HyperlinkTextView> textView( | 91 base::scoped_nsobject<HyperlinkTextView> textView( |
| 92 [[HyperlinkTextView alloc] initWithFrame:NSZeroRect]); | 92 [[HyperlinkTextView alloc] initWithFrame:NSZeroRect]); |
| 93 NSFont* font = ui::ResourceBundle::GetSharedInstance().GetFont( | 93 NSFont* font = ui::ResourceBundle::GetSharedInstance().GetFont( |
| 94 font_style).GetNativeFont(); | 94 font_style).GetNativeFont(); |
| 95 NSColor* linkColor = gfx::SkColorToCalibratedNSColor( | 95 NSColor* linkColor = skia::SkColorToCalibratedNSColor( |
| 96 chrome_style::GetLinkColor()); | 96 chrome_style::GetLinkColor()); |
| 97 NSMutableString* finalMessage = [NSMutableString stringWithString: | 97 NSMutableString* finalMessage = [NSMutableString stringWithString: |
| 98 base::SysUTF16ToNSString(message)]; | 98 base::SysUTF16ToNSString(message)]; |
| 99 NSString* linkString = base::SysUTF16ToNSString(link); | 99 NSString* linkString = base::SysUTF16ToNSString(link); |
| 100 | 100 |
| 101 [finalMessage insertString:linkString atIndex:offset]; | 101 [finalMessage insertString:linkString atIndex:offset]; |
| 102 [textView setMessage:finalMessage | 102 [textView setMessage:finalMessage |
| 103 withFont:font | 103 withFont:font |
| 104 messageColor:[NSColor blackColor]]; | 104 messageColor:[NSColor blackColor]]; |
| 105 [textView addLinkRange:NSMakeRange(offset, [linkString length]) | 105 [textView addLinkRange:NSMakeRange(offset, [linkString length]) |
| (...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 239 const CGFloat minWidth = | 239 const CGFloat minWidth = |
| 240 kWindowMinWidth - 2 * chrome_style::kHorizontalPadding; | 240 kWindowMinWidth - 2 * chrome_style::kHorizontalPadding; |
| 241 const CGFloat width = std::max(minWidth, | 241 const CGFloat width = std::max(minWidth, |
| 242 std::max(buttonsWidth, titleWidth)); | 242 std::max(buttonsWidth, titleWidth)); |
| 243 const CGFloat dialogWidth = width + 2 * chrome_style::kHorizontalPadding; | 243 const CGFloat dialogWidth = width + 2 * chrome_style::kHorizontalPadding; |
| 244 | 244 |
| 245 // Now setup the prompt and explanation text using the computed width. | 245 // Now setup the prompt and explanation text using the computed width. |
| 246 | 246 |
| 247 // Prompt box. | 247 // Prompt box. |
| 248 [promptBox_ | 248 [promptBox_ |
| 249 setBorderColor:gfx::SkColorToCalibratedNSColor( | 249 setBorderColor:skia::SkColorToCalibratedNSColor( |
| 250 ui::GetSigninConfirmationPromptBarColor( | 250 ui::GetSigninConfirmationPromptBarColor( |
| 251 ui::NativeThemeMac::instance(), | 251 ui::NativeThemeMac::instance(), |
| 252 ui::kSigninConfirmationPromptBarBorderAlpha))]; | 252 ui::kSigninConfirmationPromptBarBorderAlpha))]; |
| 253 [promptBox_ setBorderWidth:kDialogAlertBarBorderWidth]; | 253 [promptBox_ setBorderWidth:kDialogAlertBarBorderWidth]; |
| 254 [promptBox_ | 254 [promptBox_ |
| 255 setFillColor:gfx::SkColorToCalibratedNSColor( | 255 setFillColor:skia::SkColorToCalibratedNSColor( |
| 256 ui::GetSigninConfirmationPromptBarColor( | 256 ui::GetSigninConfirmationPromptBarColor( |
| 257 ui::NativeThemeMac::instance(), | 257 ui::NativeThemeMac::instance(), |
| 258 ui::kSigninConfirmationPromptBarBackgroundAlpha))]; | 258 ui::kSigninConfirmationPromptBarBackgroundAlpha))]; |
| 259 [promptBox_ setBoxType:NSBoxCustom]; | 259 [promptBox_ setBoxType:NSBoxCustom]; |
| 260 [promptBox_ setTitlePosition:NSNoTitle]; | 260 [promptBox_ setTitlePosition:NSNoTitle]; |
| 261 [[self view] addSubview:promptBox_]; | 261 [[self view] addSubview:promptBox_]; |
| 262 | 262 |
| 263 // Prompt text. | 263 // Prompt text. |
| 264 size_t offset; | 264 size_t offset; |
| 265 const base::string16 domain = | 265 const base::string16 domain = |
| (...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 448 | 448 |
| 449 - (NSButton*)createProfileButton { | 449 - (NSButton*)createProfileButton { |
| 450 return createProfileButton_.get(); | 450 return createProfileButton_.get(); |
| 451 } | 451 } |
| 452 | 452 |
| 453 - (NSTextView*)explanationField { | 453 - (NSTextView*)explanationField { |
| 454 return explanationField_.get(); | 454 return explanationField_.get(); |
| 455 } | 455 } |
| 456 | 456 |
| 457 @end | 457 @end |
| OLD | NEW |