| 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 #include <algorithm> | 5 #include <algorithm> |
| 6 | 6 |
| 7 #import "chrome/browser/ui/cocoa/passwords/pending_password_view_controller.h" | 7 #import "chrome/browser/ui/cocoa/passwords/pending_password_view_controller.h" |
| 8 | 8 |
| 9 #include "base/mac/foundation_util.h" | 9 #include "base/mac/foundation_util.h" |
| 10 #include "base/strings/sys_string_conversions.h" | 10 #include "base/strings/sys_string_conversions.h" |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 96 NSFont* font = ResourceBundle::GetSharedInstance() | 96 NSFont* font = ResourceBundle::GetSharedInstance() |
| 97 .GetFontList(ResourceBundle::SmallFont) | 97 .GetFontList(ResourceBundle::SmallFont) |
| 98 .GetPrimaryFont() | 98 .GetPrimaryFont() |
| 99 .GetNativeFont(); | 99 .GetNativeFont(); |
| 100 [titleView setMessage:base::SysUTF16ToNSString(model_->title()) | 100 [titleView setMessage:base::SysUTF16ToNSString(model_->title()) |
| 101 withFont:font | 101 withFont:font |
| 102 messageColor:textColor]; | 102 messageColor:textColor]; |
| 103 NSRange titleBrandLinkRange = model_->title_brand_link_range().ToNSRange(); | 103 NSRange titleBrandLinkRange = model_->title_brand_link_range().ToNSRange(); |
| 104 if (titleBrandLinkRange.length) { | 104 if (titleBrandLinkRange.length) { |
| 105 NSColor* linkColor = | 105 NSColor* linkColor = |
| 106 gfx::SkColorToCalibratedNSColor(chrome_style::GetLinkColor()); | 106 skia::SkColorToCalibratedNSColor(chrome_style::GetLinkColor()); |
| 107 [titleView addLinkRange:titleBrandLinkRange | 107 [titleView addLinkRange:titleBrandLinkRange |
| 108 withURL:@"about:blank" // using a link here is bad ui | 108 withURL:@"about:blank" // using a link here is bad ui |
| 109 linkColor:linkColor]; | 109 linkColor:linkColor]; |
| 110 [titleView.get() setDelegate:self]; | 110 [titleView.get() setDelegate:self]; |
| 111 | 111 |
| 112 // Create the link with no underlining. | 112 // Create the link with no underlining. |
| 113 [titleView setLinkTextAttributes:nil]; | 113 [titleView setLinkTextAttributes:nil]; |
| 114 NSTextStorage* text = [titleView textStorage]; | 114 NSTextStorage* text = [titleView textStorage]; |
| 115 [text addAttribute:NSUnderlineStyleAttributeName | 115 [text addAttribute:NSUnderlineStyleAttributeName |
| 116 value:@(NSUnderlineStyleNone) | 116 value:@(NSUnderlineStyleNone) |
| (...skipping 21 matching lines...) Expand all Loading... |
| 138 | 138 |
| 139 base::scoped_nsobject<NSTextField> warm_welcome; | 139 base::scoped_nsobject<NSTextField> warm_welcome; |
| 140 if ([self shouldShowGoogleSmartLockWelcome]) { | 140 if ([self shouldShowGoogleSmartLockWelcome]) { |
| 141 NSString* label_text = | 141 NSString* label_text = |
| 142 l10n_util::GetNSString(IDS_PASSWORD_MANAGER_SMART_LOCK_WELCOME); | 142 l10n_util::GetNSString(IDS_PASSWORD_MANAGER_SMART_LOCK_WELCOME); |
| 143 warm_welcome.reset([[self addLabel:label_text | 143 warm_welcome.reset([[self addLabel:label_text |
| 144 toView:view] retain]); | 144 toView:view] retain]); |
| 145 [warm_welcome setFrameSize:NSMakeSize(kDesiredBubbleWidth - 2*kFramePadding, | 145 [warm_welcome setFrameSize:NSMakeSize(kDesiredBubbleWidth - 2*kFramePadding, |
| 146 MAXFLOAT)]; | 146 MAXFLOAT)]; |
| 147 [GTMUILocalizerAndLayoutTweaker sizeToFitFixedWidthTextField:warm_welcome]; | 147 [GTMUILocalizerAndLayoutTweaker sizeToFitFixedWidthTextField:warm_welcome]; |
| 148 NSColor* color = gfx::SkColorToCalibratedNSColor(kWarmWelcomeColor); | 148 NSColor* color = skia::SkColorToCalibratedNSColor(kWarmWelcomeColor); |
| 149 [warm_welcome setTextColor:color]; | 149 [warm_welcome setTextColor:color]; |
| 150 } | 150 } |
| 151 | 151 |
| 152 NSArray* buttons = [self createButtonsAndAddThemToView:view]; | 152 NSArray* buttons = [self createButtonsAndAddThemToView:view]; |
| 153 | 153 |
| 154 // Compute the bubble width using the password item. | 154 // Compute the bubble width using the password item. |
| 155 const CGFloat contentWidth = | 155 const CGFloat contentWidth = |
| 156 kFramePadding + NSWidth([titleView frame]) + titleRightPadding; | 156 kFramePadding + NSWidth([titleView frame]) + titleRightPadding; |
| 157 const CGFloat width = std::max(kDesiredBubbleWidth, contentWidth); | 157 const CGFloat width = std::max(kDesiredBubbleWidth, contentWidth); |
| 158 | 158 |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 204 | 204 |
| 205 @end | 205 @end |
| 206 | 206 |
| 207 @implementation PendingPasswordViewController (Testing) | 207 @implementation PendingPasswordViewController (Testing) |
| 208 | 208 |
| 209 - (NSButton*)closeButton { | 209 - (NSButton*)closeButton { |
| 210 return closeButton_.get(); | 210 return closeButton_.get(); |
| 211 } | 211 } |
| 212 | 212 |
| 213 @end | 213 @end |
| OLD | NEW |