OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/autofill/password_generation_popup_view_cocoa.h
" | 5 #import "chrome/browser/ui/cocoa/autofill/password_generation_popup_view_cocoa.h
" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/strings/sys_string_conversions.h" | 8 #include "base/strings/sys_string_conversions.h" |
9 #include "chrome/browser/ui/autofill/autofill_popup_controller.h" | 9 #include "chrome/browser/ui/autofill/autofill_popup_controller.h" |
10 #include "chrome/browser/ui/autofill/autofill_popup_view.h" | 10 #include "chrome/browser/ui/autofill/autofill_popup_view.h" |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
99 - (void)drawRect:(NSRect)dirtyRect { | 99 - (void)drawRect:(NSRect)dirtyRect { |
100 // If the view is in the process of being destroyed, don't bother drawing. | 100 // If the view is in the process of being destroyed, don't bother drawing. |
101 if (!controller_) | 101 if (!controller_) |
102 return; | 102 return; |
103 | 103 |
104 [self drawBackgroundAndBorder]; | 104 [self drawBackgroundAndBorder]; |
105 | 105 |
106 if (controller_->password_selected()) { | 106 if (controller_->password_selected()) { |
107 // Draw a highlight under the suggested password. | 107 // Draw a highlight under the suggested password. |
108 NSRect highlightBounds = [self passwordBounds]; | 108 NSRect highlightBounds = [self passwordBounds]; |
109 highlightBounds.origin.y += | |
110 PasswordGenerationPopupView::kPasswordVerticalInset; | |
111 highlightBounds.size.height -= | |
112 2 * PasswordGenerationPopupView::kPasswordVerticalInset; | |
113 [[self highlightColor] set]; | 109 [[self highlightColor] set]; |
114 [NSBezierPath fillRect:highlightBounds]; | 110 [NSBezierPath fillRect:highlightBounds]; |
115 } | 111 } |
116 | 112 |
117 // Render the background of the help text. | 113 // Render the background of the help text. |
118 [HelpTextBackgroundColor() set]; | 114 [HelpTextBackgroundColor() set]; |
119 [NSBezierPath fillRect:[self helpBounds]]; | 115 [NSBezierPath fillRect:[self helpBounds]]; |
120 | 116 |
121 // Render the divider. | 117 // Render the divider. |
122 [DividerColor() set]; | 118 [DividerColor() set]; |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
181 NSRect frame = NSInsetRect(bounds, controller_->kHorizontalPadding, 0); | 177 NSRect frame = NSInsetRect(bounds, controller_->kHorizontalPadding, 0); |
182 [view setFrame:frame]; | 178 [view setFrame:frame]; |
183 | 179 |
184 // Center the text vertically within the bounds. | 180 // Center the text vertically within the bounds. |
185 NSSize delta = cocoa_l10n_util::WrapOrSizeToFit(view); | 181 NSSize delta = cocoa_l10n_util::WrapOrSizeToFit(view); |
186 [view setFrameOrigin: | 182 [view setFrameOrigin: |
187 NSInsetRect(frame, 0, floor(-delta.height/2)).origin]; | 183 NSInsetRect(frame, 0, floor(-delta.height/2)).origin]; |
188 } | 184 } |
189 | 185 |
190 - (NSRect)passwordBounds { | 186 - (NSRect)passwordBounds { |
191 return NSRectFromCGRect(controller_->password_bounds().ToCGRect()); | 187 return NSZeroRect; |
192 } | 188 } |
193 | 189 |
194 - (NSRect)helpBounds { | 190 - (NSRect)helpBounds { |
195 return NSRectFromCGRect(controller_->help_bounds().ToCGRect()); | 191 return NSZeroRect; |
196 } | 192 } |
197 | 193 |
198 - (NSRect)dividerBounds { | 194 - (NSRect)dividerBounds { |
199 return NSRectFromCGRect(controller_->divider_bounds().ToCGRect()); | 195 return NSZeroRect; |
200 } | 196 } |
201 | 197 |
202 - (NSFont*)textFont { | 198 - (NSFont*)textFont { |
203 return controller_->font_list().GetPrimaryFont().GetNativeFont(); | 199 return ResourceBundle::GetSharedInstance().GetFontList( |
| 200 ResourceBundle::SmallFont).GetPrimaryFont().GetNativeFont(); |
204 } | 201 } |
205 | 202 |
206 @end | 203 @end |
OLD | NEW |