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

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

Issue 1904553003: Java implementation of PaymentRequest mojo service (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Disable Pay button before user provided required information. Created 4 years, 8 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
new file mode 100644
index 0000000000000000000000000000000000000000..3da7c709759d11671497345baaf75a97865ea50c
--- /dev/null
+++ b/chrome/android/java/src/org/chromium/chrome/browser/payments/PaymentAppFactory.java
@@ -0,0 +1,54 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+package org.chromium.chrome.browser.payments;
+
+import org.chromium.content_public.browser.WebContents;
+
+import java.util.LinkedList;
+import java.util.List;
+
+/**
+ * Builds instances of payment apps.
+ */
+public class PaymentAppFactory {
+ /**
+ * Can be used to build additional types of payment apps without Chrome knowing about their
+ * types.
+ */
+ private static Addition sAdditionalFactory;
+
+ /**
+ * The interface for additional payment app factories.
+ */
+ public interface Addition {
Ted C 2016/04/22 03:59:37 In general, I like to keep interface names qualifi
please use gerrit instead 2016/04/25 19:22:30 Done.
+ /**
+ * Builds instances of payment apps.
+ */
+ List<PaymentApp> create(WebContents webContents);
+ }
+
+ /**
+ * Sets the additional factory that can build instances of payment apps.
+ *
+ * @param additionalFactory Can build instances of payment apps.
+ */
+ public static void setAdditionalFactory(Addition additionalFactory) {
+ sAdditionalFactory = additionalFactory;
+ }
+
+ /**
+ * Builds instances of payment apps.
+ *
+ * @param webContents The web contents where PaymentRequest was invoked.
+ */
+ public static List<PaymentApp> create(WebContents webContents) {
+ List<PaymentApp> result = new LinkedList<PaymentApp>();
+ result.add(new AutofillPaymentApp(webContents));
+ if (sAdditionalFactory != null) {
+ result.addAll(sAdditionalFactory.create(webContents));
+ }
+ return result;
+ }
+}

Powered by Google App Engine
This is Rietveld 408576698