OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef IOS_CHROME_BROWSER_PAYMENTS_PAYMENT_REQUEST_MANAGER_H_ |
| 6 #define IOS_CHROME_BROWSER_PAYMENTS_PAYMENT_REQUEST_MANAGER_H_ |
| 7 |
| 8 #import <UIKit/UIKit.h> |
| 9 |
| 10 namespace ios { |
| 11 class ChromeBrowserState; |
| 12 } |
| 13 |
| 14 namespace web { |
| 15 class WebState; |
| 16 } |
| 17 |
| 18 // Manager for handling invocations of the Payment Request API. |
| 19 // |
| 20 // Implements the app-side of the Payment Request JavaScript API. Injects and |
| 21 // listens to the injected JavaScript and invokes the creation of the user |
| 22 // interface. |
| 23 @interface PaymentRequestManager : NSObject |
| 24 |
| 25 // YES if Payment Request is enabled on the current web state. |
| 26 @property(readonly) BOOL enabled; |
| 27 |
| 28 // The current web state being observed for PaymentRequest invocations. |
| 29 @property(nonatomic, assign) web::WebState* webState; |
| 30 |
| 31 // Designated initializer. |
| 32 - (instancetype)initWithBaseViewController:(UIViewController*)viewController |
| 33 browserState: |
| 34 (ios::ChromeBrowserState*)browserState |
| 35 NS_DESIGNATED_INITIALIZER; |
| 36 |
| 37 - (instancetype)init NS_UNAVAILABLE; |
| 38 |
| 39 // Sets the WebState to be observed for invocations of the Payment Request API. |
| 40 // |webState|'s lifetime should be greater than the reciever's. |webState| can |
| 41 // be nil. |
| 42 - (void)setWebState:(web::WebState*)webState; |
| 43 |
| 44 // Enables or disables the Payment Request API for the current webState. If |
| 45 // |enabled| is YES, the API may still not be enabled if the flag is not set; |
| 46 // the -enabled property will indicate the current status. This method functions |
| 47 // asynchronously. |
| 48 - (void)enablePaymentRequest:(BOOL)enabled; |
| 49 |
| 50 // Cancels the pending request and dismiss the UI. |
| 51 - (void)cancelRequest; |
| 52 |
| 53 // Destroys the receiver. Any following call is not supported. |
| 54 - (void)close; |
| 55 |
| 56 @end |
| 57 |
| 58 #endif // IOS_CHROME_BROWSER_PAYMENTS_PAYMENT_REQUEST_MANAGER_H_ |
OLD | NEW |