1 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef CHROME_BROWSER_UI_COCOA_AUTOFILL_AUTOFILL_TEXTFIELD_H_
6 #define CHROME_BROWSER_UI_COCOA_AUTOFILL_AUTOFILL_TEXTFIELD_H_
8 #import <Cocoa/Cocoa.h>
10 #include "base/mac/scoped_nsobject.h"
11 #include "chrome/browser/ui/cocoa/autofill/autofill_input_field.h"
13 // Text field used for text inputs inside Autofill.
14 // Provides a red outline when the contents are marked invalid.
15 @interface AutofillTextField
: NSTextField
<AutofillInputField
,
16 NSTextFieldDelegate
> {
18 id
<AutofillInputDelegate
> inputDelegate_
;
19 base::scoped_nsobject
<NSString
> validityMessage_
;
21 // |shouldFilterFirstClick_| ensures only the very first click after
22 // -becomeFirstResponder: is treated specially.
23 BOOL shouldFilterClick_
;
25 // YES if the field is currently handling a click that caused the field to
26 // become first responder.
27 BOOL handlingFirstClick_
;
30 // Can be invoked by field editor to forward mouseDown messages from the field
31 // editor to the AutofillTextField.
32 - (void)onEditorMouseDown
:(id
)sender
;
34 // Returns the frame reserved for the decoration set on the cell.
35 - (NSRect
)decorationFrame
;
39 @interface AutofillTextFieldCell
: NSTextFieldCell
<AutofillInputCell
> {
42 NSString
* defaultValue_
;
43 base::scoped_nsobject
<NSImage
> icon_
;
45 // The size of the decoration for the field. This is most commonly the
46 // |icon_|'s size, but can also be used to reserve space for a decoration that
47 // is not drawn by this cell.
48 NSSize decorationSize_
;
51 @
property(nonatomic
, retain
) NSImage
* icon
;
52 @
property(nonatomic
, assign
) NSSize decorationSize
;
54 // Returns the frame reserved for a decoration of size |decorationSize|.
55 - (NSRect
)decorationFrameForFrame
:(NSRect
)frame
;
59 #endif // CHROME_BROWSER_UI_COCOA_AUTOFILL_AUTOFILL_TEXTFIELD_H_