blob: df91a470b72f65a33d7df84f1bb54937fec77771 [file] [log] [blame]
// Copyright 2017 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 IOS_WEB_VIEW_PUBLIC_CWV_AUTOFILL_SUGGESTION_H_
#define IOS_WEB_VIEW_PUBLIC_CWV_AUTOFILL_SUGGESTION_H_
#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
#import "cwv_export.h"
NS_ASSUME_NONNULL_BEGIN
CWV_EXPORT
// Represents a suggestion for an address, creditcard, or password form based
// off of a single field. Filling using a suggestion may fill more than one
// field at once.
// Example:
// If an address profile is:
// John Doe
// 1600 Amiphtheatre Pkwy
// Mountain View, CA 94403
// Then if
// <form name="shipping_info">
// <input type='text' name="first_name"> <-- focused on this
// <input type='text' name="last_name">
// <input type='text' name="address_1">
// <input type='text' name="address_2">
// <input type='text' name="state">
// <input type='text' name="country">
// <input type='text' name="zip_code">
// </form>
// The suggestion may look like:
// |formName| "shipping_info"
// |value| "John"
// |displayDescription| "1600 Amphitheatre Pkwy ..."
// Using this suggestion would replace all fields with the appropriate value.
@interface CWVAutofillSuggestion : NSObject
// The 'name' attribute of the html form element.
@property(nonatomic, copy, readonly) NSString* formName;
// A generated identifier for the html field element. Generated by
// __gCrWeb.form.getFieldIdentifier in form.js.
@property(nonatomic, copy, readonly) NSString* fieldIdentifier;
// The identifier of the WebFrame containing the field.
@property(nonatomic, copy, readonly) NSString* frameID;
// The string that will replace the field's value attribute.
@property(nonatomic, copy, readonly) NSString* value;
// Non-nil if this suggestion is created from a credit card or address profile.
// Contain extra information from that profile to help differentiate from other
// suggestions.
@property(nonatomic, copy, readonly, nullable) NSString* displayDescription;
// The icon image of the suggestion, currently this is only used for displaying
// credit card network icon.
@property(nonatomic, readonly, nullable) UIImage* icon;
// The unique identifier associated with the suggestion.
@property(nonatomic, readonly) NSInteger uniqueIdentifier;
- (instancetype)init NS_UNAVAILABLE;
// YES if this is a password autofill suggestion.
- (BOOL)isPasswordSuggestion;
@end
NS_ASSUME_NONNULL_END
#endif // IOS_WEB_VIEW_PUBLIC_CWV_AUTOFILL_SUGGESTION_H_