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

Unified Diff: ios/chrome/browser/payments/payment_request.mm

Issue 2968503002: [Payment Request] CanMakePayment (Closed)
Patch Set: Created 3 years, 6 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 | « ios/chrome/browser/payments/payment_request.h ('k') | ios/chrome/browser/payments/test_payment_request.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ios/chrome/browser/payments/payment_request.mm
diff --git a/ios/chrome/browser/payments/payment_request.mm b/ios/chrome/browser/payments/payment_request.mm
index b9bea51377f90643691988d8cc1763333324132d..c40fb13d62ea86e0357e16324c4fb0a8de4e83a4 100644
--- a/ios/chrome/browser/payments/payment_request.mm
+++ b/ios/chrome/browser/payments/payment_request.mm
@@ -20,6 +20,7 @@
#include "components/payments/core/payment_request_data_util.h"
#include "ios/chrome/browser/application_context.h"
#include "ios/chrome/browser/autofill/validation_rules_storage_factory.h"
+#include "ios/chrome/browser/browser_state/chrome_browser_state.h"
#import "ios/chrome/browser/payments/payment_request_util.h"
#include "ios/web/public/payments/payment_request.h"
#include "third_party/libaddressinput/chromium/chrome_metadata_source.h"
@@ -47,9 +48,11 @@ std::unique_ptr<::i18n::addressinput::Storage> GetAddressInputStorage() {
PaymentRequest::PaymentRequest(
const web::PaymentRequest& web_payment_request,
+ ios::ChromeBrowserState* browser_state,
autofill::PersonalDataManager* personal_data_manager,
id<PaymentRequestUIDelegate> payment_request_ui_delegate)
: web_payment_request_(web_payment_request),
+ browser_state_(browser_state),
personal_data_manager_(personal_data_manager),
payment_request_ui_delegate_(payment_request_ui_delegate),
address_normalizer_(new payments::AddressNormalizerImpl(
@@ -108,8 +111,7 @@ const std::string& PaymentRequest::GetApplicationLocale() const {
}
bool PaymentRequest::IsIncognito() const {
- NOTREACHED() << "Implementation is never used";
- return false;
+ return browser_state_->IsOffTheRecord();
}
bool PaymentRequest::IsSslCertificateValid() {
@@ -272,6 +274,13 @@ bool PaymentRequest::CanMakePayment() const {
}
void PaymentRequest::PopulateCreditCardCache() {
+ for (const payments::PaymentMethodData& method_data_entry :
+ web_payment_request_.method_data) {
+ for (const std::string& method : method_data_entry.supported_methods) {
+ stringified_method_data_[method].insert(method_data_entry.data);
+ }
+ }
+
// TODO(crbug.com/709036): Validate method data.
payments::data_util::ParseBasicCardSupportedNetworks(
web_payment_request_.method_data, &supported_card_networks_,
« no previous file with comments | « ios/chrome/browser/payments/payment_request.h ('k') | ios/chrome/browser/payments/test_payment_request.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698