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

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: Address review comments 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 | chrome/android/java/src/org/chromium/chrome/browser/payments/AndroidPaymentAppFactory.java » ('j') | 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 12 matching lines...) Expand all
23 import java.util.ArrayList; 23 import java.util.ArrayList;
24 import java.util.Collections; 24 import java.util.Collections;
25 import java.util.HashSet; 25 import java.util.HashSet;
26 import java.util.List; 26 import java.util.List;
27 import java.util.Map; 27 import java.util.Map;
28 import java.util.Set; 28 import java.util.Set;
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 /** The action name for the Pay Intent. */
34 public static final String ACTION_PAY = "org.chromium.intent.action.PAY";
35
33 private static final String EXTRA_METHOD_NAME = "methodName"; 36 private static final String EXTRA_METHOD_NAME = "methodName";
34 private static final String EXTRA_DATA = "data"; 37 private static final String EXTRA_DATA = "data";
35 private static final String EXTRA_ORIGIN = "origin"; 38 private static final String EXTRA_ORIGIN = "origin";
36 private static final String EXTRA_DETAILS = "details"; 39 private static final String EXTRA_DETAILS = "details";
37 private static final String EXTRA_INSTRUMENT_DETAILS = "instrumentDetails"; 40 private static final String EXTRA_INSTRUMENT_DETAILS = "instrumentDetails";
38 private static final String EMPTY_JSON_DATA = "{}"; 41 private static final String EMPTY_JSON_DATA = "{}";
39 42
40 private final Handler mHandler; 43 private final Handler mHandler;
41 private final WebContents mWebContents; 44 private final WebContents mWebContents;
42 private final Intent mPayIntent; 45 private final Intent mPayIntent;
(...skipping 11 matching lines...) Expand all
54 * @param label The UI label to use for the payment app. 57 * @param label The UI label to use for the payment app.
55 * @param icon The icon to use in UI for the payment app. 58 * @param icon The icon to use in UI for the payment app.
56 */ 59 */
57 public AndroidPaymentApp(WebContents webContents, String packageName, String activity, 60 public AndroidPaymentApp(WebContents webContents, String packageName, String activity,
58 String label, Drawable icon) { 61 String label, Drawable icon) {
59 super(packageName, label, null, icon); 62 super(packageName, label, null, icon);
60 mHandler = new Handler(); 63 mHandler = new Handler();
61 mWebContents = webContents; 64 mWebContents = webContents;
62 mPayIntent = new Intent(); 65 mPayIntent = new Intent();
63 mPayIntent.setClassName(packageName, activity); 66 mPayIntent.setClassName(packageName, activity);
67 mPayIntent.setAction(ACTION_PAY);
64 mMethodNames = new HashSet<>(); 68 mMethodNames = new HashSet<>();
65 } 69 }
66 70
67 /** @param methodName A payment method that this app supports, e.g., "https: //bobpay.com". */ 71 /** @param methodName A payment method that this app supports, e.g., "https: //bobpay.com". */
68 public void addMethodName(String methodName) { 72 public void addMethodName(String methodName) {
69 mMethodNames.add(methodName); 73 mMethodNames.add(methodName);
70 } 74 }
71 75
72 /** @param service The name of the "is ready to pay" service in the payment app. */ 76 /** @param service The name of the "is ready to pay" service in the payment app. */
73 public void setIsReadyToPayService(String service) { 77 public void setIsReadyToPayService(String service) {
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
213 mInstrumentDetailsCallback.onInstrumentDetailsReady( 217 mInstrumentDetailsCallback.onInstrumentDetailsReady(
214 data.getExtras().getString(EXTRA_METHOD_NAME), 218 data.getExtras().getString(EXTRA_METHOD_NAME),
215 data.getExtras().getString(EXTRA_INSTRUMENT_DETAILS)); 219 data.getExtras().getString(EXTRA_INSTRUMENT_DETAILS));
216 } 220 }
217 mInstrumentDetailsCallback = null; 221 mInstrumentDetailsCallback = null;
218 } 222 }
219 223
220 @Override 224 @Override
221 public void dismissInstrument() {} 225 public void dismissInstrument() {}
222 } 226 }
OLDNEW
« no previous file with comments | « no previous file | chrome/android/java/src/org/chromium/chrome/browser/payments/AndroidPaymentAppFactory.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698