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

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

Issue 1922133002: Change 'const' -> 'constexpr' in cocoa/passwords. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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/cocoa/passwords/account_chooser_view_controller_unittest.mm » ('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 d9c49ffbc2eb855fb8f7e9565a00eac9ba73db82..ed99a684542ae9f51daa50acab5d3631fe4053aa 100644
--- a/chrome/browser/ui/cocoa/passwords/account_chooser_view_controller.mm
+++ b/chrome/browser/ui/cocoa/passwords/account_chooser_view_controller.mm
@@ -26,13 +26,12 @@
namespace {
-// Maximum number of accounts displayed before vertical scrolling appears.
-const size_t kMaxAccounts = 3;
-
// Returns height of one credential item.
-CGFloat CredentialHeight() {
- return kAvatarImageSize + 2 * kVerticalAvatarMargin;
-}
+constexpr CGFloat kCredentialHeight =
+ kAvatarImageSize + 2 * kVerticalAvatarMargin;
+
+// Maximum number of accounts displayed before vertical scrolling appears.
+constexpr size_t kMaxAccounts = 3;
} // namespace
@@ -103,7 +102,7 @@ CGFloat CredentialHeight() {
NSSize buttonsSize = NSMakeSize(
kDesiredBubbleWidth,
- std::min([credentialButtons_ count], kMaxAccounts) * CredentialHeight());
+ std::min([credentialButtons_ count], kMaxAccounts) * kCredentialHeight);
base::scoped_nsobject<NSScrollView> scrollView = [[NSScrollView alloc]
initWithFrame:NSMakeRect(0, 0, buttonsSize.width, buttonsSize.height)];
[scrollView setHasVerticalScroller:[credentialButtons_ count] > kMaxAccounts
@@ -114,10 +113,10 @@ CGFloat CredentialHeight() {
CGFloat curY = 0;
base::scoped_nsobject<NSView> documentView([[NSView alloc]
initWithFrame:NSMakeRect(0, 0, buttonWidth, [credentialButtons_ count] *
- CredentialHeight())]);
+ kCredentialHeight)]);
for (CredentialItemButton* button in credentialButtons_.get()) {
[documentView addSubview:button];
- [button setFrame:NSMakeRect(0, curY, buttonWidth, CredentialHeight())];
+ [button setFrame:NSMakeRect(0, curY, buttonWidth, kCredentialHeight)];
curY = NSMaxY([button frame]);
}
[scrollView setDocumentView:documentView];
@@ -159,7 +158,7 @@ CGFloat CredentialHeight() {
- (void)loadCredentialItems {
base::scoped_nsobject<NSMutableArray> items([[NSMutableArray alloc] init]);
PasswordDialogController* controller = self.bridge->GetDialogController();
- NSRect rect = NSMakeRect(0, 0, kDesiredBubbleWidth, CredentialHeight());
+ NSRect rect = NSMakeRect(0, 0, kDesiredBubbleWidth, kCredentialHeight);
for (const auto& form : controller->GetLocalForms()) {
base::scoped_nsobject<CredentialItemButton> item(
[[CredentialItemButton alloc]
« no previous file with comments | « no previous file | chrome/browser/ui/cocoa/passwords/account_chooser_view_controller_unittest.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698