• Stephane Zermatten's avatar
    [Autofill Assistant] Tweak AutofillAction UI. · cea053c3
    Stephane Zermatten authored
    Before this patch, AutofillAction would behave as follows:
    
    - when there are no cards or profile registered for autofill, the action
    would hang forever, as AutofillAssistantUiDelegate.showProfiles and
    showCards would return immediately without reporting any results.
    
    - when a card or profile was selected, the button would remain, but
    clicking on it would crash the application (as it would call a C++
    callback that was already deleted).
    
    This patch attempts to guarantee that the callbacks that correspond to
    AutofillAssistantUiDelegate.Client::onAddressSelected and onCardSelected
    are called exactly once.
    
    With this patch:
    
    - when there are no cards, the callback is called with an empty guid
    which tells the action to fall back to manuall filling
    
    - buttons disappear once they're clicked. If that fails, the C++ layer
    ignores duplicate calls for the same callback, without crashing.
    
    Bug: 806868
    Change-Id: I15bb1b1e6ee528c18cbd76763827e69dfe3f1726
    Reviewed-on: https://chromium-review.googlesource.com/c/1264475Reviewed-by: default avatarRouslan Solomakhin <rouslan@chromium.org>
    Commit-Queue: Stephane Zermatten <szermatt@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#597105}
    cea053c3
autofill_action.cc 16.4 KB