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 #import "base/mac/scoped_nsobject.h" | 7 #import "base/mac/scoped_nsobject.h" |
8 #include "base/strings/sys_string_conversions.h" | 8 #include "base/strings/sys_string_conversions.h" |
9 #include "chrome/browser/ui/cocoa/passwords/passwords_bubble_utils.h" | 9 #include "chrome/browser/ui/cocoa/passwords/passwords_bubble_utils.h" |
10 #include "chrome/browser/ui/passwords/manage_passwords_view_utils.h" | 10 #include "chrome/browser/ui/passwords/manage_passwords_view_utils.h" |
11 #include "grit/theme_resources.h" | 11 #include "grit/theme_resources.h" |
12 #include "ui/base/l10n/l10n_util.h" | 12 #include "ui/base/l10n/l10n_util.h" |
13 #include "ui/base/resource/resource_bundle.h" | 13 #include "ui/base/resource/resource_bundle.h" |
14 #include "ui/gfx/image/image_skia.h" | 14 #include "ui/gfx/image/image_skia.h" |
15 #include "ui/gfx/image/image_skia_util_mac.h" | 15 #include "ui/gfx/image/image_skia_util_mac.h" |
16 #include "ui/gfx/scoped_ns_graphics_context_save_gstate_mac.h" | 16 #include "ui/gfx/scoped_ns_graphics_context_save_gstate_mac.h" |
17 | 17 |
18 namespace { | 18 namespace { |
19 const CGFloat kFocusRingLineWidth = 2; | 19 constexpr CGFloat kFocusRingLineWidth = 2; |
20 const CGFloat kHorizontalPaddingBetweenAvatarAndLabel = 10; | 20 constexpr CGFloat kHorizontalPaddingBetweenAvatarAndLabel = 10; |
21 } // namespace | 21 } // namespace |
22 | 22 |
23 // Custom button cell that adds a left padding before the avatar, and a custom | 23 // Custom button cell that adds a left padding before the avatar, and a custom |
24 // spacing between the avatar and label. | 24 // spacing between the avatar and label. |
25 @interface CredentialItemButtonCell : NSButtonCell { | 25 @interface CredentialItemButtonCell : NSButtonCell { |
26 @private | 26 @private |
27 // Padding added to the left margin of the button. | 27 // Padding added to the left margin of the button. |
28 int marginSpacing_; | 28 int marginSpacing_; |
29 // Spacing between the cell image and title. | 29 // Spacing between the cell image and title. |
30 int imageTitleSpacing_; | 30 int imageTitleSpacing_; |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
147 | 147 |
148 NSColor* backgroundColor = isHighlighted ? hoverColor_ : backgroundColor_; | 148 NSColor* backgroundColor = isHighlighted ? hoverColor_ : backgroundColor_; |
149 [[self cell] setBackgroundColor:backgroundColor]; | 149 [[self cell] setBackgroundColor:backgroundColor]; |
150 } | 150 } |
151 | 151 |
152 - (BOOL)canBecomeKeyView { | 152 - (BOOL)canBecomeKeyView { |
153 return YES; | 153 return YES; |
154 } | 154 } |
155 | 155 |
156 @end | 156 @end |
OLD | NEW |