Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(54)

Unified Diff: chrome/browser/ui/cocoa/passwords/credential_item_button.mm

Issue 2703253007: Use (i) icon and the same tooltip for the credit cards dialog and account chooser on Mac. (Closed)
Patch Set: rebase Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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..e1bbaf8bc52637b7db6a7da21f72985c5b02805c 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,18 @@ constexpr CGFloat kHorizontalPaddingBetweenAvatarAndLabel = 10;
return self;
}
+- (NSView*)addInfoIcon:(NSString*)tooltip {
+ DCHECK(!iconController_);
+ iconController_.reset([[AutofillTooltipController alloc]
+ initWithArrowLocation:info_bubble::kTopTrailing]);
+ NSImage* image = gfx::NSImageFromImageSkia(gfx::CreateVectorIcon(
+ gfx::VectorIconId::INFO_OUTLINE, gfx::kChromeIconGrey));
+ [iconController_ setImage:image];
+ [iconController_ setMessage:tooltip];
+ [self addSubview:[iconController_ view]];
+ return [iconController_ view];
+}
+
+ (NSImage*)defaultAvatar {
return gfx::NSImageFromImageSkia(ScaleImageForAccountAvatar(
*ResourceBundle::GetSharedInstance()
« no previous file with comments | « chrome/browser/ui/cocoa/passwords/credential_item_button.h ('k') | components/resources/autofill_scaled_resources.grdp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698