Commit 1ddbf1d9 authored by John Z Wu's avatar John Z Wu Committed by Commit Bot

Add method to remove suggestions.

Removing suggestions will remove the underlying autofill data from which
it originated. It is possible to remove both autocomplete suggestions
as well as profile data for addresses and credit cards.

This method will be covered with integration tests in follow up CLs.

Bug: 
Cq-Include-Trybots: master.tryserver.chromium.mac:ios-simulator-cronet;master.tryserver.chromium.mac:ios-simulator-full-configs
Change-Id: I53a273eed33024e42c89b85cd10dd718cea00884
Reviewed-on: https://chromium-review.googlesource.com/792256Reviewed-by: default avatarEugene But <eugenebut@chromium.org>
Commit-Queue: John Wu <jzw@chromium.org>
Cr-Commit-Position: refs/heads/master@{#520168}
parent 06cce902
......@@ -169,6 +169,18 @@
}];
}
- (void)removeSuggestion:(CWVAutofillSuggestion*)suggestion {
// Identifier is greater than 0 when it is an autofill profile.
if (suggestion.formSuggestion.identifier > 0) {
_autofillManager->RemoveAutofillProfileOrCreditCard(
suggestion.formSuggestion.identifier);
} else {
_autofillManager->RemoveAutocompleteEntry(
base::SysNSStringToUTF16(suggestion.fieldName),
base::SysNSStringToUTF16(suggestion.value));
}
}
#pragma mark - AutofillClientIOSBridge | AutofillDriverIOSBridge
- (void)showAutofillPopup:(const std::vector<autofill::Suggestion>&)suggestions
......
......@@ -15,8 +15,8 @@ NS_ASSUME_NONNULL_BEGIN
@protocol CWVAutofillControllerDelegate;
CWV_EXPORT
// Exposes features that allow autofilling html forms. Forms maybe include
// single fields, address forms, or credit card forms.
// Exposes features that allow autofilling html forms. May include autofilling
// of single fields, address forms, or credit card forms.
@interface CWVAutofillController : NSObject
// Delegate to receive autofill callbacks.
......@@ -47,6 +47,10 @@ CWV_EXPORT
- (void)fillSuggestion:(CWVAutofillSuggestion*)suggestion
completionHandler:(nullable void (^)(void))completionHandler;
// Deletes a suggestion from the data store. This suggestion will not be fetched
// again.
- (void)removeSuggestion:(CWVAutofillSuggestion*)suggestion;
@end
NS_ASSUME_NONNULL_END
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment