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

Side by Side Diff: ios/chrome/browser/payments/payment_request.mm

Issue 2815763002: Prevent usage of web payments API over insecure HTTPS. (Closed)
Patch Set: Fix typo Created 3 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
« no previous file with comments | « components/payments/core/payment_request_delegate.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 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 #include "ios/chrome/browser/payments/payment_request.h" 5 #include "ios/chrome/browser/payments/payment_request.h"
6 6
7 #include "base/strings/utf_string_conversions.h" 7 #include "base/strings/utf_string_conversions.h"
8 #include "components/autofill/core/browser/autofill_data_util.h" 8 #include "components/autofill/core/browser/autofill_data_util.h"
9 #include "components/autofill/core/browser/autofill_profile.h" 9 #include "components/autofill/core/browser/autofill_profile.h"
10 #include "components/autofill/core/browser/credit_card.h" 10 #include "components/autofill/core/browser/credit_card.h"
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 contact_profiles_, GetApplicationContext()->GetApplicationLocale(), 101 contact_profiles_, GetApplicationContext()->GetApplicationLocale(),
102 *this); 102 *this);
103 103
104 if (!shipping_profiles_.empty()) 104 if (!shipping_profiles_.empty())
105 selected_shipping_profile_ = shipping_profiles_[0]; 105 selected_shipping_profile_ = shipping_profiles_[0];
106 if (!contact_profiles_.empty()) 106 if (!contact_profiles_.empty())
107 selected_contact_profile_ = contact_profiles_[0]; 107 selected_contact_profile_ = contact_profiles_[0];
108 } 108 }
109 109
110 void PaymentRequest::PopulateCreditCardCache() { 110 void PaymentRequest::PopulateCreditCardCache() {
111 if (!payments::data_util::ParseBasicCardSupportedNetworks( 111 // TODO(crbug.com/709036): Validate method data.
112 web_payment_request_.method_data, &supported_card_networks_, 112 payments::data_util::ParseBasicCardSupportedNetworks(
113 &basic_card_specified_networks_)) { 113 web_payment_request_.method_data, &supported_card_networks_,
114 // TODO(crbug.com/709036): close the UI and reject the promise since the 114 &basic_card_specified_networks_);
115 // data is invalid.
116 return;
117 }
118 115
119 const std::vector<autofill::CreditCard*>& credit_cards_to_suggest = 116 const std::vector<autofill::CreditCard*>& credit_cards_to_suggest =
120 personal_data_manager_->GetCreditCardsToSuggest(); 117 personal_data_manager_->GetCreditCardsToSuggest();
121 credit_card_cache_.reserve(credit_cards_to_suggest.size()); 118 credit_card_cache_.reserve(credit_cards_to_suggest.size());
122 119
123 for (const auto* credit_card : credit_cards_to_suggest) { 120 for (const auto* credit_card : credit_cards_to_suggest) {
124 std::string spec_card_type = 121 std::string spec_card_type =
125 autofill::data_util::GetPaymentRequestData(credit_card->type()) 122 autofill::data_util::GetPaymentRequestData(credit_card->type())
126 .basic_card_payment_type; 123 .basic_card_payment_type;
127 if (std::find(supported_card_networks_.begin(), 124 if (std::find(supported_card_networks_.begin(),
(...skipping 21 matching lines...) Expand all
149 146
150 selected_shipping_option_ = nullptr; 147 selected_shipping_option_ = nullptr;
151 for (auto* shipping_option : shipping_options_) { 148 for (auto* shipping_option : shipping_options_) {
152 if (shipping_option->selected) { 149 if (shipping_option->selected) {
153 // If more than one option has |selected| set, the last one in the 150 // If more than one option has |selected| set, the last one in the
154 // sequence should be treated as the selected item. 151 // sequence should be treated as the selected item.
155 selected_shipping_option_ = shipping_option; 152 selected_shipping_option_ = shipping_option;
156 } 153 }
157 } 154 }
158 } 155 }
OLDNEW
« no previous file with comments | « components/payments/core/payment_request_delegate.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698