OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/autofill_overlay_controller.h" | 5 #import "chrome/browser/ui/cocoa/autofill/autofill_overlay_controller.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/mac/foundation_util.h" | 8 #include "base/mac/foundation_util.h" |
9 #include "base/strings/sys_string_conversions.h" | 9 #include "base/strings/sys_string_conversions.h" |
10 #include "chrome/browser/ui/autofill/autofill_dialog_types.h" | 10 #include "chrome/browser/ui/autofill/autofill_dialog_types.h" |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
88 | 88 |
89 - (CGFloat)heightForWidth:(CGFloat)width { | 89 - (CGFloat)heightForWidth:(CGFloat)width { |
90 return NSHeight([label_ frame]) + autofill::kArrowHeight + | 90 return NSHeight([label_ frame]) + autofill::kArrowHeight + |
91 2 * kOverlayLabelPadding; | 91 2 * kOverlayLabelPadding; |
92 } | 92 } |
93 | 93 |
94 - (void)setMessage:(const autofill::DialogOverlayString&)message { | 94 - (void)setMessage:(const autofill::DialogOverlayString&)message { |
95 // We probably want to look at other multi-line messages somewhere. | 95 // We probably want to look at other multi-line messages somewhere. |
96 [label_ setFont:message.font.GetNativeFont()]; | 96 [label_ setFont:message.font.GetNativeFont()]; |
97 [label_ setStringValue:base::SysUTF16ToNSString(message.text)]; | 97 [label_ setStringValue:base::SysUTF16ToNSString(message.text)]; |
98 [label_ setTextColor:gfx::SkColorToCalibratedNSColor(message.text_color)]; | 98 [label_ setTextColor:[NSColor darkGrayColor]]; |
99 | 99 |
100 // Resize only height, preserve width. This guarantees text stays centered in | 100 // Resize only height, preserve width. This guarantees text stays centered in |
101 // the dialog. | 101 // the dialog. |
102 NSSize labelSize = [label_ frame].size; | 102 NSSize labelSize = [label_ frame].size; |
103 labelSize.height = [[label_ cell] cellSize].height; | 103 labelSize.height = [[label_ cell] cellSize].height; |
104 [label_ setFrameSize:labelSize]; | 104 [label_ setFrameSize:labelSize]; |
105 | 105 |
106 [self setHidden:message.text.empty()]; | 106 [self setHidden:message.text.empty()]; |
107 } | 107 } |
108 | 108 |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
177 [messageView_ setFrame:NSMakeRect(0, 0, NSWidth(bounds), messageHeight)]; | 177 [messageView_ setFrame:NSMakeRect(0, 0, NSWidth(bounds), messageHeight)]; |
178 [messageView_ performLayout]; | 178 [messageView_ performLayout]; |
179 | 179 |
180 NSSize imageSize = [[imageView_ image] size]; | 180 NSSize imageSize = [[imageView_ image] size]; |
181 [imageView_ setFrame:NSMakeRect( | 181 [imageView_ setFrame:NSMakeRect( |
182 0, NSMaxY([messageView_ frame]) + kOverlayImageVerticalPadding, | 182 0, NSMaxY([messageView_ frame]) + kOverlayImageVerticalPadding, |
183 NSWidth(bounds), imageSize.height)]; | 183 NSWidth(bounds), imageSize.height)]; |
184 } | 184 } |
185 | 185 |
186 @end | 186 @end |
OLD | NEW |