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 3// found in the LICENSE file. 4 5#ifndef CHROME_BROWSER_UI_COCOA_AUTOFILL_AUTOFILL_INPUT_FIELD_H_ 6#define CHROME_BROWSER_UI_COCOA_AUTOFILL_AUTOFILL_INPUT_FIELD_H_ 7 8#import <Cocoa/Cocoa.h> 9 10@protocol AutofillInputField; 11 12// Access to cell state for autofill input controls. 13@protocol AutofillInputCell<NSObject> 14 15@property(nonatomic, assign) BOOL invalid; 16@property(nonatomic, copy) NSString* fieldValue; 17 18@end 19 20// Delegate to handle editing events on the AutofillInputFields. 21@protocol AutofillInputDelegate<NSObject> 22 23// An input field just became first responder. 24- (void)fieldBecameFirstResponder:(NSControl<AutofillInputField>*)field; 25 26// The user made changes to the value in the field. This is only invoked by 27// AutofillTextFields. 28- (void)didChange:(id)sender; 29 30// The user is done with this field. This indicates a loss of firstResponder 31// status. 32- (void)didEndEditing:(id)sender; 33 34@end 35 36// Protocol to allow access to any given input field in an Autofill dialog, no 37// matter what the underlying control is. All controls act as proxies for their 38// cells, so inherits from AutofillInputCell. 39@protocol AutofillInputField 40 41@property(nonatomic, assign) id<AutofillInputDelegate> delegate; 42 43@property(nonatomic, copy) NSString* fieldValue; 44 45// Indicates if the field is valid. Empty string or nil indicates a valid 46// field, everything else is a message to be displayed to the user when the 47// field has firstResponder status. 48@property(nonatomic, copy) NSString* validityMessage; 49 50// A reflection of the state of the validityMessage described above. 51@property(nonatomic, readonly) BOOL invalid; 52 53@end 54 55#endif // CHROME_BROWSER_UI_COCOA_AUTOFILL_AUTOFILL_INPUT_FIELD_H_ 56