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

Side by Side Diff: chrome/browser/ui/cocoa/passwords/account_chooser_view_controller.mm

Issue 2687533006: Make the information icon in the account chooser consume the mouse click. (Closed)
Patch Set: Mac 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 unified diff | 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 »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/account_chooser_view_controller.h" 5 #import "chrome/browser/ui/cocoa/passwords/account_chooser_view_controller.h"
6 6
7 #include "base/mac/foundation_util.h" 7 #include "base/mac/foundation_util.h"
8 #include "base/mac/scoped_nsobject.h" 8 #include "base/mac/scoped_nsobject.h"
9 #include "base/strings/sys_string_conversions.h" 9 #include "base/strings/sys_string_conversions.h"
10 #include "base/strings/utf_string_conversions.h" 10 #include "base/strings/utf_string_conversions.h"
(...skipping 21 matching lines...) Expand all
32 namespace { 32 namespace {
33 33
34 // Standard height of one credential item. It can be bigger though in case the 34 // Standard height of one credential item. It can be bigger though in case the
35 // text needs more vertical space than the avatar. 35 // text needs more vertical space than the avatar.
36 constexpr CGFloat kCredentialHeight = 36 constexpr CGFloat kCredentialHeight =
37 kAvatarImageSize + 2 * kVerticalAvatarMargin; 37 kAvatarImageSize + 2 * kVerticalAvatarMargin;
38 38
39 // Maximum height of the credential list. The unit is one row height. 39 // Maximum height of the credential list. The unit is one row height.
40 constexpr CGFloat kMaxHeightAccounts = 3.5; 40 constexpr CGFloat kMaxHeightAccounts = 3.5;
41 41
42 } // namespace
43
44 // An image view that consumes the mouse click.
45 @interface InfoImageView : NSImageView
46 @end
47
48 @implementation InfoImageView
49 - (void)mouseDown:(NSEvent*)theEvent {
50 if (theEvent.type != NSLeftMouseDown) {
51 [super mouseDown:theEvent];
52 }
53 }
54 @end
55
56 namespace {
57
42 NSImageView* IconForPSL(const NSRect& parentRect, const std::string& tooltip) { 58 NSImageView* IconForPSL(const NSRect& parentRect, const std::string& tooltip) {
43 NSImage* image = gfx::NSImageFromImageSkia(gfx::CreateVectorIcon( 59 NSImage* image = gfx::NSImageFromImageSkia(gfx::CreateVectorIcon(
44 gfx::VectorIconId::INFO_OUTLINE, gfx::kChromeIconGrey)); 60 gfx::VectorIconId::INFO_OUTLINE, gfx::kChromeIconGrey));
45 NSRect rect = NSMakeRect( 61 NSRect rect = NSMakeRect(
46 base::i18n::IsRTL() ? kFramePadding 62 base::i18n::IsRTL() ? kFramePadding
47 : NSMaxX(parentRect) - kInfoIconSize - kFramePadding, 63 : NSMaxX(parentRect) - kInfoIconSize - kFramePadding,
48 NSMinY(parentRect) + (NSHeight(parentRect) - kInfoIconSize) / 2, 64 NSMinY(parentRect) + (NSHeight(parentRect) - kInfoIconSize) / 2,
49 kInfoIconSize, kInfoIconSize); 65 kInfoIconSize, kInfoIconSize);
50 base::scoped_nsobject<NSImageView> icon( 66 base::scoped_nsobject<NSImageView> icon(
51 [[NSImageView alloc] initWithFrame:rect]); 67 [[InfoImageView alloc] initWithFrame:rect]);
52 [icon setImage:image]; 68 [icon setImage:image];
53 [icon setToolTip:base::SysUTF8ToNSString(tooltip)]; 69 [icon setToolTip:base::SysUTF8ToNSString(tooltip)];
54 return icon.autorelease(); 70 return icon.autorelease();
55 } 71 }
56 72
57 } // namespace 73 } // namespace
58 74
59 @interface AccountChooserViewController () { 75 @interface AccountChooserViewController () {
60 NSButton* cancelButton_; // Weak. 76 NSButton* cancelButton_; // Weak.
61 NSButton* signInButton_; // Weak. 77 NSButton* signInButton_; // Weak.
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after
284 300
285 - (NSArray*)credentialButtons { 301 - (NSArray*)credentialButtons {
286 return credentialButtons_; 302 return credentialButtons_;
287 } 303 }
288 304
289 - (NSTextView*)titleView { 305 - (NSTextView*)titleView {
290 return titleView_; 306 return titleView_;
291 } 307 }
292 308
293 @end 309 @end
OLDNEW
« 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