PaymentApp: Make the PaymentAppFactory asynchronous
The code for fetching and filtering payment instruments in
PaymentRequestImpl is asynchronous anyway, so this change is not too
intrusive. The main thing is to insert an extra asynchronous step to
populate the mApps list before payment instrument filtering starts.
If we want to take this further, a good next step would be to start
showing apps as they are discovered, instead of waiting until we have
received all the payment apps. It would also be a good thing to
refactor some of this functionality out of the PaymentRequestImpl, as
it is growing quite complex.
Other changes that went into this commit:
* Change the PaymentAppFactory into a singleton, rather than being a
holder class for static functions.
* Extend the AdditionalPaymentFactory functionality, so that the
PaymentAppFactory can have many additional factories. This lets us
make the ServiceWorkerPaymentAppBridge an additional factory, and
normalize the relationship between the two classes.
* Add two unit tests for testing delayed payment app creation.
BUG=661608
Review-Url: https://codereview.chromium.org/2559153002
Cr-Commit-Position: refs/heads/master@{#437843}
6 files changed