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

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

Issue 2054823002: PaymentRequest: complete() method should take PaymentComplete enum value. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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/PaymentRequestImpl.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/payments/PaymentRequestImpl.java b/chrome/android/java/src/org/chromium/chrome/browser/payments/PaymentRequestImpl.java
index 03844ff40be627b934d2e1e87e3385971a484abd..063b5c87ae559d6518455fbbf66b3f3f7b18ebc7 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/payments/PaymentRequestImpl.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/payments/PaymentRequestImpl.java
@@ -29,6 +29,7 @@ import org.chromium.components.safejson.JsonSanitizer;
import org.chromium.content.browser.ContentViewCore;
import org.chromium.content_public.browser.WebContents;
import org.chromium.mojo.system.MojoException;
+import org.chromium.mojom.payments.PaymentComplete;
import org.chromium.mojom.payments.PaymentDetails;
import org.chromium.mojom.payments.PaymentItem;
import org.chromium.mojom.payments.PaymentMethodData;
@@ -553,7 +554,7 @@ public class PaymentRequestImpl implements PaymentRequest, PaymentRequestUI.Clie
@Override
public void onDismiss() {
disconnectFromClientWithDebugMessage("Dialog dismissed");
- closeUI(false);
+ closeUI(PaymentComplete.FAIL);
}
@Override
@@ -567,15 +568,15 @@ public class PaymentRequestImpl implements PaymentRequest, PaymentRequestUI.Clie
@Override
public void abort() {
closeClient();
- closeUI(false);
+ closeUI(PaymentComplete.FAIL);
}
/**
* Called when the merchant website has processed the payment.
*/
@Override
- public void complete(boolean success) {
- closeUI(success);
+ public void complete(int result) {
+ closeUI(result);
}
/**
@@ -584,7 +585,7 @@ public class PaymentRequestImpl implements PaymentRequest, PaymentRequestUI.Clie
@Override
public void close() {
closeClient();
- closeUI(false);
+ closeUI(PaymentComplete.FAIL);
}
/**
@@ -593,7 +594,7 @@ public class PaymentRequestImpl implements PaymentRequest, PaymentRequestUI.Clie
@Override
public void onConnectionError(MojoException e) {
closeClient();
- closeUI(false);
+ closeUI(PaymentComplete.FAIL);
}
/**
@@ -655,7 +656,7 @@ public class PaymentRequestImpl implements PaymentRequest, PaymentRequestUI.Clie
@Override
public void onInstrumentDetailsError() {
disconnectFromClientWithDebugMessage("Failed to retrieve payment instrument details");
- closeUI(false);
+ closeUI(PaymentComplete.FAIL);
}
private void disconnectFromClientWithDebugMessage(String debugMessage) {
@@ -667,9 +668,10 @@ public class PaymentRequestImpl implements PaymentRequest, PaymentRequestUI.Clie
/**
* Closes the UI. If the client is still connected, then it's notified of UI hiding.
*/
- private void closeUI(boolean paymentSuccess) {
+ private void closeUI(int result) {
+ PaymentComplete.validate(result);
please use gerrit instead 2016/06/10 19:15:35 What does this method do? May want to add a commen
if (mUI != null) {
- mUI.close(paymentSuccess, new Runnable() {
+ mUI.close(result, new Runnable() {
please use gerrit instead 2016/06/10 19:15:35 Replace "result" with "result == PaymentComplete.S
@Override
public void run() {
if (mClient != null) mClient.onComplete();

Powered by Google App Engine
This is Rietveld 408576698