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

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

Issue 1902913002: Provide web contents to Chrome's mojo services (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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
OLDNEW
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.content.Context; 7 import org.chromium.content_public.browser.WebContents;
8
9 import org.chromium.mojo.system.MojoException; 8 import org.chromium.mojo.system.MojoException;
10 import org.chromium.mojom.payments.PaymentDetails; 9 import org.chromium.mojom.payments.PaymentDetails;
11 import org.chromium.mojom.payments.PaymentOptions; 10 import org.chromium.mojom.payments.PaymentOptions;
12 import org.chromium.mojom.payments.PaymentRequest; 11 import org.chromium.mojom.payments.PaymentRequest;
13 import org.chromium.mojom.payments.PaymentRequestClient; 12 import org.chromium.mojom.payments.PaymentRequestClient;
14 13
15 /** 14 /**
16 * Android implementation of the PaymentRequest service defined in 15 * Android implementation of the PaymentRequest service defined in
17 * third_party/WebKit/public/platform/modules/payments/payment_request.mojom. 16 * third_party/WebKit/public/platform/modules/payments/payment_request.mojom.
18 */ 17 */
19 public class PaymentRequestDialog implements PaymentRequest { 18 public class PaymentRequestImpl implements PaymentRequest {
20 private final Context mApplicationContext;
21 private PaymentRequestClient mClient;
22
23 /** 19 /**
24 * Builds the dialog. 20 * Builds the dialog.
25 * 21 *
26 * @param applicationContext The application context. 22 * @param webContents The web contents that have invoked the PaymentRequest API.
27 */ 23 */
28 public PaymentRequestDialog(Context applicationContext) { 24 public PaymentRequestImpl(WebContents webContents) {}
29 mApplicationContext = applicationContext; 25
26 /**
27 * Called by the renderer to provide an endpoint for callbacks.
28 */
29 @Override
30 public void setClient(PaymentRequestClient client) {
31 assert client != null;
32 client.onError();
30 } 33 }
31 34
32 @Override 35 /**
33 public void setClient(PaymentRequestClient client) { 36 * Called by the merchant website to show the payment request to the user.
34 mClient = client; 37 */
35 }
36
37 @Override 38 @Override
38 public void show(String[] supportedMethods, PaymentDetails details, PaymentO ptions options, 39 public void show(String[] supportedMethods, PaymentDetails details, PaymentO ptions options,
39 String stringifiedData) { 40 String stringifiedData) {}
40 assert mClient != null;
41 mClient.onError();
42 }
43 41
42 /**
43 * Called by the merchant website to abort the payment.
44 */
44 @Override 45 @Override
45 public void abort() {} 46 public void abort() {}
46 47
48 /**
49 * Called when the merchant website has processed the payment.
50 */
47 @Override 51 @Override
48 public void complete(boolean success) { 52 public void complete(boolean success) {}
49 assert mClient != null;
50 mClient.onComplete();
51 }
52 53
54 /**
55 * Called when the renderer closes the Mojo connection.
56 */
53 @Override 57 @Override
54 public void close() {} 58 public void close() {}
55 59
60 /**
61 * Called when the Mojo connection encounters an error.
62 */
56 @Override 63 @Override
57 public void onConnectionError(MojoException e) {} 64 public void onConnectionError(MojoException e) {}
58 } 65 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698