| 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 #import "ios/chrome/browser/ui/payments/payment_request_manager.h" | 5 #import "ios/chrome/browser/ui/payments/payment_request_manager.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/ios/block_types.h" | 9 #include "base/ios/block_types.h" |
| 10 #include "base/ios/ios_util.h" | 10 #include "base/ios/ios_util.h" |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 92 // View controller used to present the PaymentRequest view controller. | 92 // View controller used to present the PaymentRequest view controller. |
| 93 __weak UIViewController* _baseViewController; | 93 __weak UIViewController* _baseViewController; |
| 94 | 94 |
| 95 // PersonalDataManager used to manage user credit cards and addresses. | 95 // PersonalDataManager used to manage user credit cards and addresses. |
| 96 autofill::PersonalDataManager* _personalDataManager; | 96 autofill::PersonalDataManager* _personalDataManager; |
| 97 | 97 |
| 98 // Object that has a copy of web::PaymentRequest as provided by the page | 98 // Object that has a copy of web::PaymentRequest as provided by the page |
| 99 // invoking the PaymentRequest API. Also caches credit cards and addresses | 99 // invoking the PaymentRequest API. Also caches credit cards and addresses |
| 100 // provided by the _personalDataManager and manages selected ones for the | 100 // provided by the _personalDataManager and manages selected ones for the |
| 101 // current PaymentRequest flow. | 101 // current PaymentRequest flow. |
| 102 std::unique_ptr<PaymentRequest> _paymentRequest; | 102 std::unique_ptr<payments::PaymentRequest> _paymentRequest; |
| 103 | 103 |
| 104 // WebState for the tab this object is attached to. | 104 // WebState for the tab this object is attached to. |
| 105 web::WebState* _webState; | 105 web::WebState* _webState; |
| 106 | 106 |
| 107 // Observer for |_webState|. | 107 // Observer for |_webState|. |
| 108 std::unique_ptr<web::WebStateObserverBridge> _webStateObserver; | 108 std::unique_ptr<web::WebStateObserverBridge> _webStateObserver; |
| 109 | 109 |
| 110 // Boolean to track if the current WebState is enabled (JS callback is set | 110 // Boolean to track if the current WebState is enabled (JS callback is set |
| 111 // up). | 111 // up). |
| 112 BOOL _webStateEnabled; | 112 BOOL _webStateEnabled; |
| (...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 402 return NO; | 402 return NO; |
| 403 } | 403 } |
| 404 | 404 |
| 405 // TODO(crbug.com/711419): make sure multiple PaymentRequests can be active | 405 // TODO(crbug.com/711419): make sure multiple PaymentRequests can be active |
| 406 // simultaneously. | 406 // simultaneously. |
| 407 if (_paymentRequest && | 407 if (_paymentRequest && |
| 408 (_paymentRequest->web_payment_request() == webPaymentRequest)) { | 408 (_paymentRequest->web_payment_request() == webPaymentRequest)) { |
| 409 return YES; | 409 return YES; |
| 410 } | 410 } |
| 411 | 411 |
| 412 _paymentRequest = base::MakeUnique<PaymentRequest>( | 412 _paymentRequest = base::MakeUnique<payments::PaymentRequest>( |
| 413 webPaymentRequest, _browserState, _personalDataManager, self); | 413 webPaymentRequest, _browserState, _personalDataManager, self); |
| 414 | 414 |
| 415 return YES; | 415 return YES; |
| 416 } | 416 } |
| 417 | 417 |
| 418 - (BOOL)handleRequestShow:(const base::DictionaryValue&)message { | 418 - (BOOL)handleRequestShow:(const base::DictionaryValue&)message { |
| 419 // TODO(crbug.com/602666): check that there's not already a pending request. | 419 // TODO(crbug.com/602666): check that there's not already a pending request. |
| 420 // TODO(crbug.com/602666): compare our supported payment types (i.e. autofill | 420 // TODO(crbug.com/602666): compare our supported payment types (i.e. autofill |
| 421 // credit card types) against the merchant supported types and return NO | 421 // credit card types) against the merchant supported types and return NO |
| 422 // if the intersection is empty. | 422 // if the intersection is empty. |
| (...skipping 373 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 796 #pragma mark - CRWWebStateObserver methods | 796 #pragma mark - CRWWebStateObserver methods |
| 797 | 797 |
| 798 - (void)webState:(web::WebState*)webState | 798 - (void)webState:(web::WebState*)webState |
| 799 didCommitNavigationWithDetails: | 799 didCommitNavigationWithDetails: |
| 800 (const web::LoadCommittedDetails&)load_details { | 800 (const web::LoadCommittedDetails&)load_details { |
| 801 [self dismissUI]; | 801 [self dismissUI]; |
| 802 [self enableCurrentWebState]; | 802 [self enableCurrentWebState]; |
| 803 } | 803 } |
| 804 | 804 |
| 805 @end | 805 @end |
| OLD | NEW |