• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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.
4 
5 #ifndef CHROME_BROWSER_UI_COCOA_AUTOFILL_AUTOFILL_TEXTFIELD_H_
6 #define CHROME_BROWSER_UI_COCOA_AUTOFILL_AUTOFILL_TEXTFIELD_H_
7 
8 #import <Cocoa/Cocoa.h>
9 
10 #include "base/mac/scoped_nsobject.h"
11 #include "chrome/browser/ui/cocoa/autofill/autofill_input_field.h"
12 
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> {
17  @private
18   id<AutofillInputDelegate> inputDelegate_;
19   base::scoped_nsobject<NSString> validityMessage_;
20 
21   // |shouldFilterFirstClick_| ensures only the very first click after
22   // -becomeFirstResponder: is treated specially.
23   BOOL shouldFilterClick_;
24 
25   // YES if the field is currently handling a click that caused the field to
26   // become first responder.
27   BOOL handlingFirstClick_;
28 
29   // YES if the field allows input of multiple lines of text.
30   BOOL isMultiline_;
31 }
32 
33 @property(nonatomic, assign) BOOL isMultiline;
34 
35 // Can be invoked by field editor to forward mouseDown messages from the field
36 // editor to the AutofillTextField.
37 - (void)onEditorMouseDown:(id)sender;
38 
39 // Returns the frame reserved for the decoration set on the cell.
40 - (NSRect)decorationFrame;
41 
42 @end
43 
44 @interface AutofillTextFieldCell : NSTextFieldCell<AutofillInputCell> {
45  @private
46   BOOL invalid_;
47   NSString* defaultValue_;
48   base::scoped_nsobject<NSImage> icon_;
49 
50   // The size of the decoration for the field. This is most commonly the
51   // |icon_|'s size, but can also be used to reserve space for a decoration that
52   // is not drawn by this cell.
53   NSSize decorationSize_;
54 }
55 
56 @property(nonatomic, retain) NSImage* icon;
57 @property(nonatomic, assign) NSSize decorationSize;
58 
59 // Returns the frame reserved for a decoration of size |decorationSize|.
60 - (NSRect)decorationFrameForFrame:(NSRect)frame;
61 
62 @end
63 
64 #endif  // CHROME_BROWSER_UI_COCOA_AUTOFILL_AUTOFILL_TEXTFIELD_H_
65