OLD | NEW |
---|---|
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 package org.chromium.chrome.browser.payments; | 5 package org.chromium.chrome.browser.payments; |
6 | 6 |
7 import android.app.Activity; | 7 import android.app.Activity; |
8 import android.graphics.Bitmap; | 8 import android.graphics.Bitmap; |
9 import android.os.Handler; | 9 import android.os.Handler; |
10 import android.text.TextUtils; | 10 import android.text.TextUtils; |
(...skipping 13 matching lines...) Expand all Loading... | |
24 import org.chromium.chrome.browser.preferences.PreferencesLauncher; | 24 import org.chromium.chrome.browser.preferences.PreferencesLauncher; |
25 import org.chromium.chrome.browser.preferences.autofill.AutofillLocalCardEditor; | 25 import org.chromium.chrome.browser.preferences.autofill.AutofillLocalCardEditor; |
26 import org.chromium.chrome.browser.profiles.Profile; | 26 import org.chromium.chrome.browser.profiles.Profile; |
27 import org.chromium.chrome.browser.util.UrlUtilities; | 27 import org.chromium.chrome.browser.util.UrlUtilities; |
28 import org.chromium.components.safejson.JsonSanitizer; | 28 import org.chromium.components.safejson.JsonSanitizer; |
29 import org.chromium.content.browser.ContentViewCore; | 29 import org.chromium.content.browser.ContentViewCore; |
30 import org.chromium.content_public.browser.WebContents; | 30 import org.chromium.content_public.browser.WebContents; |
31 import org.chromium.mojo.system.MojoException; | 31 import org.chromium.mojo.system.MojoException; |
32 import org.chromium.mojom.payments.PaymentComplete; | 32 import org.chromium.mojom.payments.PaymentComplete; |
33 import org.chromium.mojom.payments.PaymentDetails; | 33 import org.chromium.mojom.payments.PaymentDetails; |
34 import org.chromium.mojom.payments.PaymentErrorReason; | |
34 import org.chromium.mojom.payments.PaymentItem; | 35 import org.chromium.mojom.payments.PaymentItem; |
35 import org.chromium.mojom.payments.PaymentMethodData; | 36 import org.chromium.mojom.payments.PaymentMethodData; |
36 import org.chromium.mojom.payments.PaymentOptions; | 37 import org.chromium.mojom.payments.PaymentOptions; |
37 import org.chromium.mojom.payments.PaymentRequest; | 38 import org.chromium.mojom.payments.PaymentRequest; |
38 import org.chromium.mojom.payments.PaymentRequestClient; | 39 import org.chromium.mojom.payments.PaymentRequestClient; |
39 import org.chromium.mojom.payments.PaymentResponse; | 40 import org.chromium.mojom.payments.PaymentResponse; |
40 import org.chromium.mojom.payments.PaymentShippingOption; | 41 import org.chromium.mojom.payments.PaymentShippingOption; |
41 import org.chromium.ui.base.WindowAndroid; | 42 import org.chromium.ui.base.WindowAndroid; |
42 import org.json.JSONException; | 43 import org.json.JSONException; |
43 import org.json.JSONObject; | 44 import org.json.JSONObject; |
(...skipping 779 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
823 * Called if unable to retrieve instrument details. | 824 * Called if unable to retrieve instrument details. |
824 */ | 825 */ |
825 @Override | 826 @Override |
826 public void onInstrumentDetailsError() { | 827 public void onInstrumentDetailsError() { |
827 disconnectFromClientWithDebugMessage("Failed to retrieve payment instrum ent details"); | 828 disconnectFromClientWithDebugMessage("Failed to retrieve payment instrum ent details"); |
828 closeUI(false); | 829 closeUI(false); |
829 } | 830 } |
830 | 831 |
831 private void disconnectFromClientWithDebugMessage(String debugMessage) { | 832 private void disconnectFromClientWithDebugMessage(String debugMessage) { |
832 Log.d(TAG, debugMessage); | 833 Log.d(TAG, debugMessage); |
833 mClient.onError(); | 834 mClient.onError(PaymentErrorReason.UNKNOWN); |
please use gerrit instead
2016/07/13 15:55:25
Let's use PaymentErrorReason.CANCEL for now. I wil
pals
2016/07/14 08:37:38
Ok. I was going through this file, looks like pars
| |
834 closeClient(); | 835 closeClient(); |
835 } | 836 } |
836 | 837 |
837 /** | 838 /** |
838 * Closes the UI. If the client is still connected, then it's notified of UI hiding. | 839 * Closes the UI. If the client is still connected, then it's notified of UI hiding. |
839 */ | 840 */ |
840 private void closeUI(boolean immediateClose) { | 841 private void closeUI(boolean immediateClose) { |
841 if (mUI != null) { | 842 if (mUI != null) { |
842 mUI.close(immediateClose, new Runnable() { | 843 mUI.close(immediateClose, new Runnable() { |
843 @Override | 844 @Override |
(...skipping 18 matching lines...) Expand all Loading... | |
862 private void closeClient() { | 863 private void closeClient() { |
863 if (mClient != null) mClient.close(); | 864 if (mClient != null) mClient.close(); |
864 mClient = null; | 865 mClient = null; |
865 } | 866 } |
866 | 867 |
867 @VisibleForTesting | 868 @VisibleForTesting |
868 public static void setObserverForTest(PaymentRequestServiceObserverForTest o bserverForTest) { | 869 public static void setObserverForTest(PaymentRequestServiceObserverForTest o bserverForTest) { |
869 sObserverForTest = observerForTest; | 870 sObserverForTest = observerForTest; |
870 } | 871 } |
871 } | 872 } |
OLD | NEW |