1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74
|
// Copyright 2013 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CHROME_BROWSER_UI_COCOA_AUTOFILL_AUTOFILL_INPUT_FIELD_H_
#define CHROME_BROWSER_UI_COCOA_AUTOFILL_AUTOFILL_INPUT_FIELD_H_
#import <Cocoa/Cocoa.h>
@protocol AutofillInputField;
// Access to cell state for autofill input controls.
@protocol AutofillInputCell<NSObject>
@property(nonatomic, assign) BOOL invalid;
@property(nonatomic, copy) NSString* fieldValue;
@property(nonatomic, copy) NSString* defaultValue;
@end
// Delegate to handle editing events on the AutofillInputFields.
@protocol AutofillInputDelegate<NSObject>
// Indicates if an event should be forwarded on.
enum KeyEventHandled {
kKeyEventNotHandled,
kKeyEventHandled
};
// The input field received a key event. This should return kKeyEventHandled if
// it handled the event, or kEventNotHandled if it should be forwarded to the
// input's super class.
- (KeyEventHandled)keyEvent:(NSEvent*)event forInput:(id)sender;
// Input field or its editor received a mouseDown: message.
- (void)onMouseDown:(NSControl<AutofillInputField>*)sender;
// An input field just became first responder.
- (void)fieldBecameFirstResponder:(NSControl<AutofillInputField>*)field;
// The user made changes to the value in the field. This is only invoked by
// AutofillTextFields.
- (void)didChange:(id)sender;
// The user is done with this field. This indicates a loss of firstResponder
// status.
- (void)didEndEditing:(id)sender;
@end
// Protocol to allow access to any given input field in an Autofill dialog, no
// matter what the underlying control is. All controls act as proxies for their
// cells, so inherits from AutofillInputCell.
@protocol AutofillInputField
@property(nonatomic, assign) id<AutofillInputDelegate> inputDelegate;
@property(nonatomic, copy) NSString* fieldValue;
@property(nonatomic, copy) NSString* defaultValue;
// Indicates if the field is at its default setting.
@property(nonatomic, readonly) BOOL isDefault;
// Indicates if the field is valid. Empty string or nil indicates a valid
// field, everything else is a message to be displayed to the user when the
// field has firstResponder status.
@property(nonatomic, copy) NSString* validityMessage;
// A reflection of the state of the validityMessage described above.
@property(nonatomic, readonly) BOOL invalid;
@end
#endif // CHROME_BROWSER_UI_COCOA_AUTOFILL_AUTOFILL_INPUT_FIELD_H_
|