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

Side by Side Diff: chrome/android/java/src/org/chromium/chrome/browser/payments/AndroidPaymentApp.java

Issue 2623553002: Set proper action name on Pay Intent (Closed)
Patch Set: Created 3 years, 11 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 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.content.Intent; 8 import android.content.Intent;
9 import android.graphics.drawable.Drawable; 9 import android.graphics.drawable.Drawable;
10 import android.os.Bundle; 10 import android.os.Bundle;
(...skipping 18 matching lines...) Expand all
29 29
30 /** The point of interaction with a locally installed 3rd party native Android p ayment app. */ 30 /** The point of interaction with a locally installed 3rd party native Android p ayment app. */
31 public class AndroidPaymentApp extends PaymentInstrument implements PaymentApp, 31 public class AndroidPaymentApp extends PaymentInstrument implements PaymentApp,
32 WindowAndroid.IntentCallback { 32 WindowAndroid.IntentCallback {
33 private static final String EXTRA_METHOD_NAME = "methodName"; 33 private static final String EXTRA_METHOD_NAME = "methodName";
34 private static final String EXTRA_DATA = "data"; 34 private static final String EXTRA_DATA = "data";
35 private static final String EXTRA_ORIGIN = "origin"; 35 private static final String EXTRA_ORIGIN = "origin";
36 private static final String EXTRA_DETAILS = "details"; 36 private static final String EXTRA_DETAILS = "details";
37 private static final String EXTRA_INSTRUMENT_DETAILS = "instrumentDetails"; 37 private static final String EXTRA_INSTRUMENT_DETAILS = "instrumentDetails";
38 private static final String EMPTY_JSON_DATA = "{}"; 38 private static final String EMPTY_JSON_DATA = "{}";
39 private static final String PAY_INTENT_ACTION = "org.chromium.intent.action. PAY";
please use gerrit instead 2017/01/09 18:14:03 Please make this strict public and use it in Andro
rwlbuis 2017/01/09 18:32:54 Done.
39 40
40 private final Handler mHandler; 41 private final Handler mHandler;
41 private final WebContents mWebContents; 42 private final WebContents mWebContents;
42 private final Intent mPayIntent; 43 private final Intent mPayIntent;
43 private final Set<String> mMethodNames; 44 private final Set<String> mMethodNames;
44 private String mIsReadyToPayService; 45 private String mIsReadyToPayService;
45 private InstrumentDetailsCallback mInstrumentDetailsCallback; 46 private InstrumentDetailsCallback mInstrumentDetailsCallback;
46 47
47 /** 48 /**
48 * Builds the point of interaction with a locally installed 3rd party native Android payment 49 * Builds the point of interaction with a locally installed 3rd party native Android payment
49 * app. 50 * app.
50 * 51 *
51 * @param webContents The web contents. 52 * @param webContents The web contents.
52 * @param packageName The name of the package of the payment app. 53 * @param packageName The name of the package of the payment app.
53 * @param activity The name of the payment activity in the payment app. 54 * @param activity The name of the payment activity in the payment app.
54 * @param label The UI label to use for the payment app. 55 * @param label The UI label to use for the payment app.
55 * @param icon The icon to use in UI for the payment app. 56 * @param icon The icon to use in UI for the payment app.
56 */ 57 */
57 public AndroidPaymentApp(WebContents webContents, String packageName, String activity, 58 public AndroidPaymentApp(WebContents webContents, String packageName, String activity,
58 String label, Drawable icon) { 59 String label, Drawable icon) {
59 super(packageName, label, null, icon); 60 super(packageName, label, null, icon);
60 mHandler = new Handler(); 61 mHandler = new Handler();
61 mWebContents = webContents; 62 mWebContents = webContents;
62 mPayIntent = new Intent(); 63 mPayIntent = new Intent();
63 mPayIntent.setClassName(packageName, activity); 64 mPayIntent.setClassName(packageName, activity);
65 mPayIntent.setAction(PAY_INTENT_ACTION);
64 mMethodNames = new HashSet<>(); 66 mMethodNames = new HashSet<>();
65 } 67 }
66 68
67 /** @param methodName A payment method that this app supports, e.g., "https: //bobpay.com". */ 69 /** @param methodName A payment method that this app supports, e.g., "https: //bobpay.com". */
68 public void addMethodName(String methodName) { 70 public void addMethodName(String methodName) {
69 mMethodNames.add(methodName); 71 mMethodNames.add(methodName);
70 } 72 }
71 73
72 /** @param service The name of the "is ready to pay" service in the payment app. */ 74 /** @param service The name of the "is ready to pay" service in the payment app. */
73 public void setIsReadyToPayService(String service) { 75 public void setIsReadyToPayService(String service) {
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
213 mInstrumentDetailsCallback.onInstrumentDetailsReady( 215 mInstrumentDetailsCallback.onInstrumentDetailsReady(
214 data.getExtras().getString(EXTRA_METHOD_NAME), 216 data.getExtras().getString(EXTRA_METHOD_NAME),
215 data.getExtras().getString(EXTRA_INSTRUMENT_DETAILS)); 217 data.getExtras().getString(EXTRA_INSTRUMENT_DETAILS));
216 } 218 }
217 mInstrumentDetailsCallback = null; 219 mInstrumentDetailsCallback = null;
218 } 220 }
219 221
220 @Override 222 @Override
221 public void dismissInstrument() {} 223 public void dismissInstrument() {}
222 } 224 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698