| 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 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 88 - (void)drawRect:(NSRect)dirtyRect { | 88 - (void)drawRect:(NSRect)dirtyRect { |
| 89 // If the view is in the process of being destroyed, don't bother drawing. | 89 // If the view is in the process of being destroyed, don't bother drawing. |
| 90 if (!controller_) | 90 if (!controller_) |
| 91 return; | 91 return; |
| 92 | 92 |
| 93 [self drawBackgroundAndBorder]; | 93 [self drawBackgroundAndBorder]; |
| 94 | 94 |
| 95 if (controller_->password_selected()) { | 95 if (controller_->password_selected()) { |
| 96 // Draw a highlight under the suggested password. | 96 // Draw a highlight under the suggested password. |
| 97 NSRect highlightBounds = [self passwordBounds]; | 97 NSRect highlightBounds = [self passwordBounds]; |
| 98 highlightBounds.origin.y += | |
| 99 PasswordGenerationPopupView::kPasswordVerticalInset; | |
| 100 highlightBounds.size.height -= | |
| 101 2 * PasswordGenerationPopupView::kPasswordVerticalInset; | |
| 102 [[self highlightColor] set]; | 98 [[self highlightColor] set]; |
| 103 [NSBezierPath fillRect:highlightBounds]; | 99 [NSBezierPath fillRect:highlightBounds]; |
| 104 } | 100 } |
| 105 | 101 |
| 106 // Render the background of the help text. | 102 // Render the background of the help text. |
| 107 [HelpTextBackgroundColor() set]; | 103 [HelpTextBackgroundColor() set]; |
| 108 [NSBezierPath fillRect:[self helpBounds]]; | 104 [NSBezierPath fillRect:[self helpBounds]]; |
| 109 | 105 |
| 110 // Render the divider. | 106 // Render the divider. |
| 111 [DividerColor() set]; | 107 [DividerColor() set]; |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 163 NSRect frame = NSInsetRect(bounds, controller_->kHorizontalPadding, 0); | 159 NSRect frame = NSInsetRect(bounds, controller_->kHorizontalPadding, 0); |
| 164 [textField setFrame:frame]; | 160 [textField setFrame:frame]; |
| 165 | 161 |
| 166 // Center the text vertically within the bounds. | 162 // Center the text vertically within the bounds. |
| 167 NSSize delta = cocoa_l10n_util::WrapOrSizeToFit(textField); | 163 NSSize delta = cocoa_l10n_util::WrapOrSizeToFit(textField); |
| 168 [textField setFrameOrigin: | 164 [textField setFrameOrigin: |
| 169 NSInsetRect(frame, 0, floor(-delta.height/2)).origin]; | 165 NSInsetRect(frame, 0, floor(-delta.height/2)).origin]; |
| 170 } | 166 } |
| 171 | 167 |
| 172 - (NSRect)passwordBounds { | 168 - (NSRect)passwordBounds { |
| 173 return NSRectFromCGRect(controller_->password_bounds().ToCGRect()); | 169 return NSZeroRect; |
| 174 } | 170 } |
| 175 | 171 |
| 176 - (NSRect)helpBounds { | 172 - (NSRect)helpBounds { |
| 177 return NSRectFromCGRect(controller_->help_bounds().ToCGRect()); | 173 return NSZeroRect; |
| 178 } | 174 } |
| 179 | 175 |
| 180 - (NSRect)dividerBounds { | 176 - (NSRect)dividerBounds { |
| 181 return NSRectFromCGRect(controller_->divider_bounds().ToCGRect()); | 177 return NSZeroRect; |
| 182 } | 178 } |
| 183 | 179 |
| 184 @end | 180 @end |
| OLD | NEW |