Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2540)

Unified Diff: chrome/android/java/src/org/chromium/chrome/browser/payments/PaymentAppFactory.java

Issue 2604193002: Detect locally installed native Android payment apps. (Closed)
Patch Set: Fix typo Created 3 years, 12 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/android/java/src/org/chromium/chrome/browser/payments/PaymentAppFactory.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/payments/PaymentAppFactory.java b/chrome/android/java/src/org/chromium/chrome/browser/payments/PaymentAppFactory.java
index a93ef0d8eecb20841ef3ea9f30f4792eb967baf3..688d3cb499703453bddbcffadd606d68f850a9c5 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/payments/PaymentAppFactory.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/payments/PaymentAppFactory.java
@@ -52,14 +52,20 @@ public class PaymentAppFactory {
*
* @param context The application context.
* @param webContents The web contents that invoked PaymentRequest.
+ * @param methods The methods that the merchant supports.
* @param callback The callback to invoke when apps are created.
*/
- void create(Context context, WebContents webContents, PaymentAppCreatedCallback callback);
+ void create(Context context, WebContents webContents, Set<String> methods,
+ PaymentAppCreatedCallback callback);
}
private PaymentAppFactory() {
mAdditionalFactories = new ArrayList<>();
+ if (ChromeFeatureList.isEnabled(ChromeFeatureList.ANDROID_PAYMENT_APPS)) {
+ mAdditionalFactories.add(new AndroidPaymentAppFactory());
+ }
+
if (ChromeFeatureList.isEnabled(ChromeFeatureList.SERVICE_WORKER_PAYMENT_APPS)) {
mAdditionalFactories.add(new ServiceWorkerPaymentAppBridge());
}
@@ -88,10 +94,11 @@ public class PaymentAppFactory {
*
* @param context The context.
* @param webContents The web contents where PaymentRequest was invoked.
+ * @param methods The methods that the merchant supports.
* @param callback The callback to invoke when apps are created.
*/
- public void create(
- Context context, WebContents webContents, final PaymentAppCreatedCallback callback) {
+ public void create(Context context, WebContents webContents, Set<String> methods,
+ final PaymentAppCreatedCallback callback) {
callback.onPaymentAppCreated(new AutofillPaymentApp(context, webContents));
if (mAdditionalFactories.isEmpty()) {
@@ -104,18 +111,19 @@ public class PaymentAppFactory {
for (int i = 0; i < mAdditionalFactories.size(); i++) {
final PaymentAppFactoryAddition additionalFactory = mAdditionalFactories.get(i);
- additionalFactory.create(context, webContents, new PaymentAppCreatedCallback() {
- @Override
- public void onPaymentAppCreated(PaymentApp paymentApp) {
- callback.onPaymentAppCreated(paymentApp);
- }
-
- @Override
- public void onAllPaymentAppsCreated() {
- mPendingTasks.remove(additionalFactory);
- if (mPendingTasks.isEmpty()) callback.onAllPaymentAppsCreated();
- }
- });
+ additionalFactory.create(
+ context, webContents, methods, new PaymentAppCreatedCallback() {
gone 2017/01/03 19:20:03 Indentation would be less wonky if you created the
please use gerrit instead 2017/01/04 17:27:53 Done. Not super happy about having more than one
+ @Override
+ public void onPaymentAppCreated(PaymentApp paymentApp) {
+ callback.onPaymentAppCreated(paymentApp);
+ }
+
+ @Override
+ public void onAllPaymentAppsCreated() {
+ mPendingTasks.remove(additionalFactory);
+ if (mPendingTasks.isEmpty()) callback.onAllPaymentAppsCreated();
+ }
+ });
}
}
}

Powered by Google App Engine
This is Rietveld 408576698