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

Unified Diff: chrome/browser/android/payments/service_worker_payment_app_bridge.cc

Issue 2775933002: PaymentApp: Receive payment app responses in Android (Closed)
Patch Set: Add a comment based on Rouslan's feedback Created 3 years, 9 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
« no previous file with comments | « chrome/android/java/src/org/chromium/chrome/browser/payments/ServiceWorkerPaymentInstrument.java ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/android/payments/service_worker_payment_app_bridge.cc
diff --git a/chrome/browser/android/payments/service_worker_payment_app_bridge.cc b/chrome/browser/android/payments/service_worker_payment_app_bridge.cc
index cf64e3b6fa35256d00c87a54670d3ee77489bca1..260f37c7cfe4cc544380420e2d185f26dd318750 100644
--- a/chrome/browser/android/payments/service_worker_payment_app_bridge.cc
+++ b/chrome/browser/android/payments/service_worker_payment_app_bridge.cc
@@ -66,6 +66,16 @@ void OnGotAllManifests(const JavaRef<jobject>& jweb_contents,
Java_ServiceWorkerPaymentAppBridge_onGotAllManifests(env, jcallback);
}
+void OnPaymentAppInvoked(const JavaRef<jobject>& jweb_contents,
+ const JavaRef<jobject>& jcallback,
+ payments::mojom::PaymentAppResponsePtr app_response) {
+ JNIEnv* env = AttachCurrentThread();
+
+ Java_ServiceWorkerPaymentAppBridge_onPaymentAppInvoked(
+ env, jcallback, ConvertUTF8ToJavaString(env, app_response->method_name),
+ ConvertUTF8ToJavaString(env, app_response->stringified_details));
+}
+
} // namespace
static void GetAllAppManifests(JNIEnv* env,
@@ -92,7 +102,8 @@ static void InvokePaymentApp(JNIEnv* env,
const JavaParamRef<jstring>& jorigin,
const JavaParamRef<jobjectArray>& jmethod_data,
const JavaParamRef<jobject>& jtotal,
- const JavaParamRef<jobjectArray>& jmodifiers) {
+ const JavaParamRef<jobjectArray>& jmodifiers,
+ const JavaParamRef<jobject>& jcallback) {
content::WebContents* web_contents =
content::WebContents::FromJavaWebContents(jweb_contents);
@@ -170,7 +181,9 @@ static void InvokePaymentApp(JNIEnv* env,
content::PaymentAppProvider::GetInstance()->InvokePaymentApp(
web_contents->GetBrowserContext(), registration_id,
std::move(app_request),
- content::PaymentAppProvider::InvokePaymentAppCallback());
+ base::Bind(&OnPaymentAppInvoked,
+ ScopedJavaGlobalRef<jobject>(env, jweb_contents),
+ ScopedJavaGlobalRef<jobject>(env, jcallback)));
}
bool RegisterServiceWorkerPaymentAppBridge(JNIEnv* env) {
« no previous file with comments | « chrome/android/java/src/org/chromium/chrome/browser/payments/ServiceWorkerPaymentInstrument.java ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698