| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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_button.h" | 5 #import "chrome/browser/ui/cocoa/passwords/credential_item_button.h" |
| 6 | 6 |
| 7 #include "base/i18n/rtl.h" | 7 #include "base/i18n/rtl.h" |
| 8 #import "base/mac/scoped_nsobject.h" | 8 #import "base/mac/scoped_nsobject.h" |
| 9 #include "base/strings/sys_string_conversions.h" | 9 #include "base/strings/sys_string_conversions.h" |
| 10 #include "chrome/browser/ui/cocoa/passwords/passwords_bubble_utils.h" | 10 #include "chrome/browser/ui/cocoa/passwords/passwords_bubble_utils.h" |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 115 [cell setHighlightsBy:NSChangeGrayCellMask]; | 115 [cell setHighlightsBy:NSChangeGrayCellMask]; |
| 116 [self setCell:cell.get()]; | 116 [self setCell:cell.get()]; |
| 117 | 117 |
| 118 [self setBordered:NO]; | 118 [self setBordered:NO]; |
| 119 [self setFont:ResourceBundle::GetSharedInstance() | 119 [self setFont:ResourceBundle::GetSharedInstance() |
| 120 .GetFontList(ResourceBundle::SmallFont) | 120 .GetFontList(ResourceBundle::SmallFont) |
| 121 .GetPrimaryFont() | 121 .GetPrimaryFont() |
| 122 .GetNativeFont()]; | 122 .GetNativeFont()]; |
| 123 [self setButtonType:NSMomentaryLightButton]; | 123 [self setButtonType:NSMomentaryLightButton]; |
| 124 [self setImagePosition:base::i18n::IsRTL() ? NSImageRight : NSImageLeft]; | 124 [self setImagePosition:base::i18n::IsRTL() ? NSImageRight : NSImageLeft]; |
| 125 [self setAlignment:NSNaturalTextAlignment]; |
| 125 } | 126 } |
| 126 return self; | 127 return self; |
| 127 } | 128 } |
| 128 | 129 |
| 129 + (NSImage*)defaultAvatar { | 130 + (NSImage*)defaultAvatar { |
| 130 return gfx::NSImageFromImageSkia(ScaleImageForAccountAvatar( | 131 return gfx::NSImageFromImageSkia(ScaleImageForAccountAvatar( |
| 131 *ResourceBundle::GetSharedInstance() | 132 *ResourceBundle::GetSharedInstance() |
| 132 .GetImageNamed(IDR_PROFILE_AVATAR_PLACEHOLDER_LARGE) | 133 .GetImageNamed(IDR_PROFILE_AVATAR_PLACEHOLDER_LARGE) |
| 133 .ToImageSkia())); | 134 .ToImageSkia())); |
| 134 } | 135 } |
| 135 | 136 |
| 136 - (void)setHoverState:(HoverState)state { | 137 - (void)setHoverState:(HoverState)state { |
| 137 [super setHoverState:state]; | 138 [super setHoverState:state]; |
| 138 bool isHighlighted = ([self hoverState] != kHoverStateNone); | 139 bool isHighlighted = ([self hoverState] != kHoverStateNone); |
| 139 | 140 |
| 140 NSColor* backgroundColor = isHighlighted ? hoverColor_ : backgroundColor_; | 141 NSColor* backgroundColor = isHighlighted ? hoverColor_ : backgroundColor_; |
| 141 [[self cell] setBackgroundColor:backgroundColor]; | 142 [[self cell] setBackgroundColor:backgroundColor]; |
| 142 } | 143 } |
| 143 | 144 |
| 144 - (BOOL)canBecomeKeyView { | 145 - (BOOL)canBecomeKeyView { |
| 145 return YES; | 146 return YES; |
| 146 } | 147 } |
| 147 | 148 |
| 148 @end | 149 @end |
| OLD | NEW |