Home | History | Annotate | Download | only in autofill
      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 
     30 // Can be invoked by field editor to forward mouseDown messages from the field
     31 // editor to the AutofillTextField.
     32 - (void)onEditorMouseDown:(id)sender;
     33 
     34 // Returns the frame reserved for the decoration set on the cell.
     35 - (NSRect)decorationFrame;
     36 
     37 @end
     38 
     39 @interface AutofillTextFieldCell : NSTextFieldCell<AutofillInputCell> {
     40  @private
     41   BOOL invalid_;
     42   NSString* defaultValue_;
     43   base::scoped_nsobject<NSImage> icon_;
     44 
     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_;
     49 }
     50 
     51 @property(nonatomic, retain) NSImage* icon;
     52 @property(nonatomic, assign) NSSize decorationSize;
     53 
     54 // Returns the frame reserved for a decoration of size |decorationSize|.
     55 - (NSRect)decorationFrameForFrame:(NSRect)frame;
     56 
     57 @end
     58 
     59 #endif  // CHROME_BROWSER_UI_COCOA_AUTOFILL_AUTOFILL_TEXTFIELD_H_
     60