Chromium Code Reviews| Index: chrome/browser/ui/cocoa/passwords/credential_item_button.mm |
| diff --git a/chrome/browser/ui/cocoa/passwords/credential_item_button.mm b/chrome/browser/ui/cocoa/passwords/credential_item_button.mm |
| index 7e8cfcb4dea5fbc42b8d8fa271b1421e803c647d..006411e8cfae044325841001fe40756850c18009 100644 |
| --- a/chrome/browser/ui/cocoa/passwords/credential_item_button.mm |
| +++ b/chrome/browser/ui/cocoa/passwords/credential_item_button.mm |
| @@ -7,13 +7,17 @@ |
| #include "base/i18n/rtl.h" |
| #import "base/mac/scoped_nsobject.h" |
| #include "base/strings/sys_string_conversions.h" |
| +#import "chrome/browser/ui/cocoa/autofill/autofill_tooltip_controller.h" |
| #include "chrome/browser/ui/cocoa/passwords/passwords_bubble_utils.h" |
| #include "chrome/browser/ui/passwords/manage_passwords_view_utils.h" |
| #include "chrome/grit/theme_resources.h" |
| #include "ui/base/resource/resource_bundle.h" |
| +#include "ui/gfx/color_palette.h" |
| #include "ui/gfx/image/image_skia.h" |
| #include "ui/gfx/image/image_skia_util_mac.h" |
| +#include "ui/gfx/paint_vector_icon.h" |
| #include "ui/gfx/scoped_ns_graphics_context_save_gstate_mac.h" |
| +#include "ui/gfx/vector_icons_public.h" |
| namespace { |
| constexpr CGFloat kFocusRingInset = 3; |
| @@ -93,6 +97,7 @@ constexpr CGFloat kHorizontalPaddingBetweenAvatarAndLabel = 10; |
| @interface CredentialItemButton () { |
| base::scoped_nsobject<NSColor> backgroundColor_; |
| base::scoped_nsobject<NSColor> hoverColor_; |
| + base::scoped_nsobject<AutofillTooltipController> iconController_; |
| } |
| @end |
| @@ -127,6 +132,17 @@ constexpr CGFloat kHorizontalPaddingBetweenAvatarAndLabel = 10; |
| return self; |
| } |
| +- (NSView*)enableIcon:(NSString*)tooltip { |
| + iconController_.reset([[AutofillTooltipController alloc] |
|
groby-ooo-7-16
2017/02/23 00:22:49
Is this supposed to be called multiple times? If n
nsphu.cnht
2017/02/24 15:09:15
On 2017/02/23 00:22:49, groby wrote:
> Is this sup
vasilii
2017/02/24 17:53:01
Done.
|
| + initWithArrowLocation:info_bubble::kTopRight]); |
| + NSImage* image = gfx::NSImageFromImageSkia(gfx::CreateVectorIcon( |
| + gfx::VectorIconId::INFO_OUTLINE, gfx::kChromeIconGrey)); |
| + [iconController_ setImage:image]; |
| + [iconController_ setMessage:tooltip]; |
| + [self addSubview:[iconController_ view]]; |
|
groby-ooo-7-16
2017/02/23 00:22:49
This means self already takes ownership - do you r
nsphu.cnht
2017/02/24 15:09:15
Done.
nsphu.cnht
2017/02/24 15:09:15
Acknowledged.
vasilii
2017/02/24 17:53:01
But I own the controller. If I understand correctl
|
| + return [iconController_ view]; |
| +} |
| + |
| + (NSImage*)defaultAvatar { |
| return gfx::NSImageFromImageSkia(ScaleImageForAccountAvatar( |
| *ResourceBundle::GetSharedInstance() |