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

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

Issue 2526293003: PaymentApp: Add classes for supporting Web Based Payment Apps (Closed)
Patch Set: Remove now unnecessary dependency to payment_app.mojom Created 4 years, 1 month 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 06bf964172c65de8d180ec1d4b8670dbb0d33201..a232f1733eac95d211499af7d7884837bd0e995f 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
@@ -22,6 +22,9 @@ public class PaymentAppFactory {
*/
private static PaymentAppFactoryAddition sAdditionalFactory;
+ private static WebBasedPaymentAppBridge sWebBasedPaymentAppBridge =
+ new WebBasedPaymentAppBridge();
+
/**
* The interface for additional payment app factories.
*/
@@ -54,10 +57,28 @@ public class PaymentAppFactory {
public static List<PaymentApp> create(Context context, WebContents webContents) {
List<PaymentApp> result = new ArrayList<>(2);
result.add(new AutofillPaymentApp(context, webContents));
+ result.addAll(createWebBasedPaymentApps(context, webContents));
please use gerrit instead 2016/11/29 14:28:44 Put this behind a command-line flag before it's 10
tommyt 2016/11/30 13:44:38 Done.
if (sAdditionalFactory != null) {
result.addAll(
sAdditionalFactory.create(context, webContents));
}
return result;
}
+
+ /**
+ * Build a WebBasedPaymentApp instance for each installed web based
+ * payment app.
+ *
+ * @param context The context.
+ * @param webContents The web contents where PaymentRequest was invoked.
+ */
+ private static List<WebBasedPaymentApp> createWebBasedPaymentApps(
+ Context context, WebContents webContents) {
agrieve 2016/11/28 17:59:53 Here and in other places, you should try and say w
tommyt 2016/11/30 13:44:38 Yeah, this did actually turn out a bit cargo-cult-
+ List<WebBasedPaymentApp> result = new ArrayList<>();
+ for (WebBasedPaymentAppBridge.Manifest manifest :
+ sWebBasedPaymentAppBridge.getAllAppManifests()) {
+ result.add(new WebBasedPaymentApp(context, webContents, manifest));
+ }
+ return result;
+ }
}

Powered by Google App Engine
This is Rietveld 408576698