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

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

Issue 2680163007: Make the information icon in the account chooser consume the mouse click. (Closed)
Patch Set: 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
« no previous file with comments | « no previous file | chrome/browser/ui/views/passwords/credentials_item_view.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/cocoa/passwords/account_chooser_view_controller.mm
diff --git a/chrome/browser/ui/cocoa/passwords/account_chooser_view_controller.mm b/chrome/browser/ui/cocoa/passwords/account_chooser_view_controller.mm
index 3cca551b0761c458cd1bae706a156a4e3e33129e..91487c188d032968d3ceda8def5778840bd6bc22 100644
--- a/chrome/browser/ui/cocoa/passwords/account_chooser_view_controller.mm
+++ b/chrome/browser/ui/cocoa/passwords/account_chooser_view_controller.mm
@@ -39,6 +39,22 @@ constexpr CGFloat kCredentialHeight =
// Maximum height of the credential list. The unit is one row height.
constexpr CGFloat kMaxHeightAccounts = 3.5;
+} // namespace
+
+// An image view that consumes the mouse click.
+@interface InfoImageView : NSImageView
+@end
+
+@implementation InfoImageView
+- (void)mouseDown:(NSEvent*)theEvent {
+ if (theEvent.type != NSLeftMouseDown) {
+ [super mouseDown:theEvent];
+ }
+}
+@end
+
+namespace {
+
NSImageView* IconForPSL(const NSRect& parentRect, const std::string& tooltip) {
NSImage* image = gfx::NSImageFromImageSkia(gfx::CreateVectorIcon(
gfx::VectorIconId::INFO_OUTLINE, gfx::kChromeIconGrey));
@@ -48,7 +64,7 @@ NSImageView* IconForPSL(const NSRect& parentRect, const std::string& tooltip) {
NSMinY(parentRect) + (NSHeight(parentRect) - kInfoIconSize) / 2,
kInfoIconSize, kInfoIconSize);
base::scoped_nsobject<NSImageView> icon(
- [[NSImageView alloc] initWithFrame:rect]);
+ [[InfoImageView alloc] initWithFrame:rect]);
[icon setImage:image];
[icon setToolTip:base::SysUTF8ToNSString(tooltip)];
return icon.autorelease();
« no previous file with comments | « no previous file | chrome/browser/ui/views/passwords/credentials_item_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698