OLD | NEW |
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 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
121 [signInButton_ setFrameOrigin:NSMakePoint(curX, kFramePadding)]; | 121 [signInButton_ setFrameOrigin:NSMakePoint(curX, kFramePadding)]; |
122 } | 122 } |
123 [cancelButton_ setFrameOrigin:NSMakePoint( | 123 [cancelButton_ setFrameOrigin:NSMakePoint( |
124 curX - NSWidth([cancelButton_ frame]), | 124 curX - NSWidth([cancelButton_ frame]), |
125 kFramePadding)]; | 125 kFramePadding)]; |
126 | 126 |
127 NSSize buttonsSize = NSMakeSize( | 127 NSSize buttonsSize = NSMakeSize( |
128 kDesiredBubbleWidth, | 128 kDesiredBubbleWidth, |
129 std::min<CGFloat>([credentialButtons_ count], kMaxHeightAccounts) * | 129 std::min<CGFloat>([credentialButtons_ count], kMaxHeightAccounts) * |
130 kCredentialHeight); | 130 kCredentialHeight); |
131 base::scoped_nsobject<NSScrollView> scrollView = [[NSScrollView alloc] | 131 base::scoped_nsobject<NSScrollView> scrollView([[NSScrollView alloc] |
132 initWithFrame:NSMakeRect(0, 0, buttonsSize.width, buttonsSize.height)]; | 132 initWithFrame:NSMakeRect(0, 0, buttonsSize.width, buttonsSize.height)]); |
133 [scrollView | 133 [scrollView |
134 setHasVerticalScroller:[credentialButtons_ count] > kMaxHeightAccounts | 134 setHasVerticalScroller:[credentialButtons_ count] > kMaxHeightAccounts |
135 ? YES | 135 ? YES |
136 : NO]; | 136 : NO]; |
137 [scrollView setBorderType:NSNoBorder]; | 137 [scrollView setBorderType:NSNoBorder]; |
138 CGFloat buttonWidth = [scrollView contentSize].width; | 138 CGFloat buttonWidth = [scrollView contentSize].width; |
139 CGFloat curY = 0; | 139 CGFloat curY = 0; |
140 base::scoped_nsobject<NSView> documentView([[NSView alloc] | 140 base::scoped_nsobject<NSView> documentView([[NSView alloc] |
141 initWithFrame:NSMakeRect(0, 0, buttonWidth, [credentialButtons_ count] * | 141 initWithFrame:NSMakeRect(0, 0, buttonWidth, [credentialButtons_ count] * |
142 kCredentialHeight)]); | 142 kCredentialHeight)]); |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
258 | 258 |
259 - (NSArray*)credentialButtons { | 259 - (NSArray*)credentialButtons { |
260 return credentialButtons_; | 260 return credentialButtons_; |
261 } | 261 } |
262 | 262 |
263 - (NSTextView*)titleView { | 263 - (NSTextView*)titleView { |
264 return titleView_; | 264 return titleView_; |
265 } | 265 } |
266 | 266 |
267 @end | 267 @end |
OLD | NEW |