| 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 #ifndef IOS_CHROME_BROWSER_PAYMENTS_JS_PAYMENT_REQUEST_MANAGER_H_ | 5 #ifndef IOS_CHROME_BROWSER_PAYMENTS_JS_PAYMENT_REQUEST_MANAGER_H_ |
| 6 #define IOS_CHROME_BROWSER_PAYMENTS_JS_PAYMENT_REQUEST_MANAGER_H_ | 6 #define IOS_CHROME_BROWSER_PAYMENTS_JS_PAYMENT_REQUEST_MANAGER_H_ |
| 7 | 7 |
| 8 #import "ios/web/public/web_state/js/crw_js_injection_manager.h" | 8 #import "ios/web/public/web_state/js/crw_js_injection_manager.h" |
| 9 | 9 |
| 10 namespace web { | 10 namespace web { |
| 11 class PaymentResponse; | 11 class PaymentResponse; |
| 12 } | 12 } |
| 13 | 13 |
| 14 // Injects the JavaScript that implements the Payment Request API and provides | 14 // Injects the JavaScript that implements the Payment Request API and provides |
| 15 // an app-side interface for interacting with it. | 15 // an app-side interface for interacting with it. |
| 16 @interface JSPaymentRequestManager : CRWJSInjectionManager | 16 @interface JSPaymentRequestManager : CRWJSInjectionManager |
| 17 | 17 |
| 18 // Executes a JS noop function. This is used to work around an issue where the |
| 19 // JS event queue is blocked while presenting the Payment Request UI. |
| 20 - (void)executeNoop; |
| 21 |
| 18 // Resolves the JavaScript promise associated with the current PaymentRequest | 22 // Resolves the JavaScript promise associated with the current PaymentRequest |
| 19 // with the a JSON serialization of |paymentResponse|. |completionHandler| will | 23 // with the a JSON serialization of |paymentResponse|. |completionHandler| will |
| 20 // be invoked after the operation has completed with YES if successful. | 24 // be invoked after the operation has completed with YES if successful. |
| 21 - (void)resolveRequestPromise:(const web::PaymentResponse&)paymentResponse | 25 - (void)resolveRequestPromise:(const web::PaymentResponse&)paymentResponse |
| 22 completionHandler:(void (^)(BOOL))completionHandler; | 26 completionHandler:(void (^)(BOOL))completionHandler; |
| 23 | 27 |
| 24 // Rejects the JavaScript promise associated with the current PaymentRequest | 28 // Rejects the JavaScript promise associated with the current PaymentRequest |
| 25 // with the supplied |errorMessage|. |completionHandler| will be invoked after | 29 // with the supplied |errorMessage|. |completionHandler| will be invoked after |
| 26 // the operation has completed with YES if successful. | 30 // the operation has completed with YES if successful. |
| 27 - (void)rejectRequestPromise:(NSString*)errorMessage | 31 - (void)rejectRequestPromise:(NSString*)errorMessage |
| 28 completionHandler:(void (^)(BOOL))completionHandler; | 32 completionHandler:(void (^)(BOOL))completionHandler; |
| 29 | 33 |
| 30 // Resolves the JavaScript promise associated with the current PaymentResponse. | 34 // Resolves the JavaScript promise associated with the current PaymentResponse. |
| 31 // |completionHandler| will be invoked after the operation has completed with | 35 // |completionHandler| will be invoked after the operation has completed with |
| 32 // YES if successful. | 36 // YES if successful. |
| 33 - (void)resolveResponsePromise:(void (^)(BOOL))completionHandler; | 37 - (void)resolveResponsePromise:(void (^)(BOOL))completionHandler; |
| 34 | 38 |
| 35 // Rejects the JavaScript promise associated with the current PaymentResponse | 39 // Note that there is no rejectResponsePromise method because the spec includes |
| 36 // with the supplied |errorMessage|. |completionHandler| will be invoked after | 40 // no provision for rejecting the response promise. User agents are directed to |
| 37 // the operation has completed with YES if successful. | 41 // always resolve the promise. |
| 38 - (void)rejectResponsePromise:(NSString*)errorMessage | |
| 39 completionHandler:(void (^)(BOOL))completionHandler; | |
| 40 | 42 |
| 41 @end | 43 @end |
| 42 | 44 |
| 43 #endif // IOS_CHROME_BROWSER_PAYMENTS_JS_PAYMENT_REQUEST_MANAGER_H_ | 45 #endif // IOS_CHROME_BROWSER_PAYMENTS_JS_PAYMENT_REQUEST_MANAGER_H_ |
| OLD | NEW |