| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/passwords/credential_item_view.h" | 5 #import "chrome/browser/ui/cocoa/passwords/credential_item_view.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/i18n/rtl.h" | 9 #include "base/i18n/rtl.h" |
| 10 #include "base/mac/foundation_util.h" | 10 #include "base/mac/foundation_util.h" |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 116 : NSMaxX([avatarView_ frame]) + | 116 : NSMaxX([avatarView_ frame]) + |
| 117 kHorizontalPaddingBetweenAvatarAndLabels; | 117 kHorizontalPaddingBetweenAvatarAndLabels; |
| 118 const CGFloat upperLabelY = | 118 const CGFloat upperLabelY = |
| 119 NSMaxY(lowerFrame) + kVerticalPaddingBetweenLabels; | 119 NSMaxY(lowerFrame) + kVerticalPaddingBetweenLabels; |
| 120 NSRect upperFrame = [upperLabel_ frame]; | 120 NSRect upperFrame = [upperLabel_ frame]; |
| 121 upperFrame.origin = NSMakePoint(upperX, upperLabelY); | 121 upperFrame.origin = NSMakePoint(upperX, upperLabelY); |
| 122 [upperLabel_ setFrame:upperFrame]; | 122 [upperLabel_ setFrame:upperFrame]; |
| 123 | 123 |
| 124 // Use a default avatar and fetch the custom one, if it exists. | 124 // Use a default avatar and fetch the custom one, if it exists. |
| 125 [self updateAvatar:[[self class] defaultAvatar]]; | 125 [self updateAvatar:[[self class] defaultAvatar]]; |
| 126 if (passwordForm_.avatar_url.is_valid()) | 126 if (passwordForm_.icon_url.is_valid()) |
| 127 [delegate_ fetchAvatar:passwordForm_.avatar_url forView:self]; | 127 [delegate_ fetchAvatar:passwordForm_.icon_url forView:self]; |
| 128 | 128 |
| 129 // When resizing, stick to the left (resp. right for RTL) edge. | 129 // When resizing, stick to the left (resp. right for RTL) edge. |
| 130 const NSUInteger autoresizingMask = | 130 const NSUInteger autoresizingMask = |
| 131 (base::i18n::IsRTL() ? NSViewMinXMargin : NSViewMaxXMargin); | 131 (base::i18n::IsRTL() ? NSViewMinXMargin : NSViewMaxXMargin); |
| 132 [avatarView_ setAutoresizingMask:autoresizingMask]; | 132 [avatarView_ setAutoresizingMask:autoresizingMask]; |
| 133 [lowerLabel_ setAutoresizingMask:autoresizingMask]; | 133 [lowerLabel_ setAutoresizingMask:autoresizingMask]; |
| 134 [upperLabel_ setAutoresizingMask:autoresizingMask]; | 134 [upperLabel_ setAutoresizingMask:autoresizingMask]; |
| 135 [self setAutoresizingMask:NSViewWidthSizable]; | 135 [self setAutoresizingMask:NSViewWidthSizable]; |
| 136 } | 136 } |
| 137 | 137 |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 181 [label setEditable:NO]; | 181 [label setEditable:NO]; |
| 182 [label setSelectable:NO]; | 182 [label setSelectable:NO]; |
| 183 [label setStringValue:title]; | 183 [label setStringValue:title]; |
| 184 [label setAlignment:base::i18n::IsRTL() ? NSRightTextAlignment | 184 [label setAlignment:base::i18n::IsRTL() ? NSRightTextAlignment |
| 185 : NSLeftTextAlignment]; | 185 : NSLeftTextAlignment]; |
| 186 [label sizeToFit]; | 186 [label sizeToFit]; |
| 187 return label; | 187 return label; |
| 188 } | 188 } |
| 189 | 189 |
| 190 @end | 190 @end |
| OLD | NEW |