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

Side by Side Diff: components/payments/content/payment_request_state.cc

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
OLDNEW
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 #include "components/payments/content/payment_request_state.h" 5 #include "components/payments/content/payment_request_state.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <set> 8 #include <set>
9 #include <utility> 9 #include <utility>
10 10
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 PaymentRequestState::~PaymentRequestState() {} 43 PaymentRequestState::~PaymentRequestState() {}
44 44
45 void PaymentRequestState::OnPaymentResponseReady( 45 void PaymentRequestState::OnPaymentResponseReady(
46 mojom::PaymentResponsePtr payment_response) { 46 mojom::PaymentResponsePtr payment_response) {
47 delegate_->OnPaymentResponseAvailable(std::move(payment_response)); 47 delegate_->OnPaymentResponseAvailable(std::move(payment_response));
48 } 48 }
49 49
50 bool PaymentRequestState::CanMakePayment() const { 50 bool PaymentRequestState::CanMakePayment() const {
51 for (const std::unique_ptr<PaymentInstrument>& instrument : 51 for (const std::unique_ptr<PaymentInstrument>& instrument :
52 available_instruments_) { 52 available_instruments_) {
53 if (instrument->IsValidForCanMakePayment() && 53 if (instrument->IsValidForCanMakePayment()) {
54 spec_->supported_card_networks_set().count( 54 // AddAutofillPaymentInstrument() filters out available instruments based
55 instrument.get()->method_name())) { 55 // on supported card networks.
56 DCHECK(spec_->supported_card_networks_set().find(
57 instrument->method_name()) !=
58 spec_->supported_card_networks_set().end());
56 return true; 59 return true;
57 } 60 }
58 } 61 }
59 return false; 62 return false;
60 } 63 }
61 64
65 bool PaymentRequestState::AreRequestedMethodsSupported() const {
66 return !spec_->supported_card_networks().empty();
67 }
68
62 void PaymentRequestState::AddObserver(Observer* observer) { 69 void PaymentRequestState::AddObserver(Observer* observer) {
63 CHECK(observer); 70 CHECK(observer);
64 observers_.AddObserver(observer); 71 observers_.AddObserver(observer);
65 } 72 }
66 73
67 void PaymentRequestState::RemoveObserver(Observer* observer) { 74 void PaymentRequestState::RemoveObserver(Observer* observer) {
68 observers_.RemoveObserver(observer); 75 observers_.RemoveObserver(observer);
69 } 76 }
70 77
71 void PaymentRequestState::GeneratePaymentResponse() { 78 void PaymentRequestState::GeneratePaymentResponse() {
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
229 bool PaymentRequestState::ArePaymentOptionsSatisfied() { 236 bool PaymentRequestState::ArePaymentOptionsSatisfied() {
230 // TODO(mathp): Have a measure of shipping address completeness. 237 // TODO(mathp): Have a measure of shipping address completeness.
231 if (spec_->request_shipping() && selected_shipping_profile_ == nullptr) 238 if (spec_->request_shipping() && selected_shipping_profile_ == nullptr)
232 return false; 239 return false;
233 240
234 profile_util::PaymentsProfileComparator comparator(app_locale_, *spec_); 241 profile_util::PaymentsProfileComparator comparator(app_locale_, *spec_);
235 return comparator.IsContactInfoComplete(selected_contact_profile_); 242 return comparator.IsContactInfoComplete(selected_contact_profile_);
236 } 243 }
237 244
238 } // namespace payments 245 } // namespace payments
OLDNEW
« no previous file with comments | « components/payments/content/payment_request_state.h ('k') | components/payments/content/payment_response_helper_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698