| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/profile_signin_confirmation_view_controller.h" | 5 #import "chrome/browser/ui/cocoa/profile_signin_confirmation_view_controller.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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 52 [text boundingRectWithSize:NSMakeSize(width, height) | 52 [text boundingRectWithSize:NSMakeSize(width, height) |
| 53 options:NSStringDrawingUsesLineFragmentOrigin]; | 53 options:NSStringDrawingUsesLineFragmentOrigin]; |
| 54 // boundingRectWithSize is known to underestimate the width. | 54 // boundingRectWithSize is known to underestimate the width. |
| 55 static const CGFloat kTextViewPadding = 10; | 55 static const CGFloat kTextViewPadding = 10; |
| 56 frame.size.width += kTextViewPadding; | 56 frame.size.width += kTextViewPadding; |
| 57 return frame; | 57 return frame; |
| 58 } | 58 } |
| 59 | 59 |
| 60 // Make the indicated range of characters in a text view bold. | 60 // Make the indicated range of characters in a text view bold. |
| 61 void MakeTextBold(NSTextField* textField, int offset, int length) { | 61 void MakeTextBold(NSTextField* textField, int offset, int length) { |
| 62 scoped_nsobject<NSMutableAttributedString> text( | 62 base::scoped_nsobject<NSMutableAttributedString> text( |
| 63 [[textField attributedStringValue] mutableCopy]); | 63 [[textField attributedStringValue] mutableCopy]); |
| 64 NSFont* currentFont = | 64 NSFont* currentFont = |
| 65 [text attribute:NSFontAttributeName | 65 [text attribute:NSFontAttributeName |
| 66 atIndex:offset | 66 atIndex:offset |
| 67 effectiveRange:NULL]; | 67 effectiveRange:NULL]; |
| 68 NSFontManager* fontManager = [NSFontManager sharedFontManager]; | 68 NSFontManager* fontManager = [NSFontManager sharedFontManager]; |
| 69 NSFont* boldFont = [fontManager convertFont:currentFont | 69 NSFont* boldFont = [fontManager convertFont:currentFont |
| 70 toHaveTrait:NSBoldFontMask]; | 70 toHaveTrait:NSBoldFontMask]; |
| 71 [text beginEditing]; | 71 [text beginEditing]; |
| 72 [text addAttribute:NSFontAttributeName | 72 [text addAttribute:NSFontAttributeName |
| (...skipping 16 matching lines...) Expand all Loading... |
| 89 } | 89 } |
| 90 | 90 |
| 91 // Create a new NSTextView and add it to the specified parent. | 91 // Create a new NSTextView and add it to the specified parent. |
| 92 NSTextView* AddTextView( | 92 NSTextView* AddTextView( |
| 93 NSView* parent, | 93 NSView* parent, |
| 94 id<NSTextViewDelegate> delegate, | 94 id<NSTextViewDelegate> delegate, |
| 95 const string16& message, | 95 const string16& message, |
| 96 const string16& link, | 96 const string16& link, |
| 97 int offset, | 97 int offset, |
| 98 const ui::ResourceBundle::FontStyle& font_style) { | 98 const ui::ResourceBundle::FontStyle& font_style) { |
| 99 scoped_nsobject<HyperlinkTextView> textView( | 99 base::scoped_nsobject<HyperlinkTextView> textView( |
| 100 [[HyperlinkTextView alloc] initWithFrame:NSZeroRect]); | 100 [[HyperlinkTextView alloc] initWithFrame:NSZeroRect]); |
| 101 NSFont* font = ui::ResourceBundle::GetSharedInstance().GetFont( | 101 NSFont* font = ui::ResourceBundle::GetSharedInstance().GetFont( |
| 102 font_style).GetNativeFont(); | 102 font_style).GetNativeFont(); |
| 103 NSColor* linkColor = gfx::SkColorToCalibratedNSColor( | 103 NSColor* linkColor = gfx::SkColorToCalibratedNSColor( |
| 104 chrome_style::GetLinkColor()); | 104 chrome_style::GetLinkColor()); |
| 105 [textView setMessageAndLink:base::SysUTF16ToNSString(message) | 105 [textView setMessageAndLink:base::SysUTF16ToNSString(message) |
| 106 withLink:base::SysUTF16ToNSString(link) | 106 withLink:base::SysUTF16ToNSString(link) |
| 107 atOffset:offset | 107 atOffset:offset |
| 108 font:font | 108 font:font |
| 109 messageColor:[NSColor blackColor] | 109 messageColor:[NSColor blackColor] |
| (...skipping 354 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 464 | 464 |
| 465 - (NSButton*)createProfileButton { | 465 - (NSButton*)createProfileButton { |
| 466 return createProfileButton_.get(); | 466 return createProfileButton_.get(); |
| 467 } | 467 } |
| 468 | 468 |
| 469 - (NSTextView*)explanationField { | 469 - (NSTextView*)explanationField { |
| 470 return explanationField_.get(); | 470 return explanationField_.get(); |
| 471 } | 471 } |
| 472 | 472 |
| 473 @end | 473 @end |
| OLD | NEW |