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

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: Self-review 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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 spec_->supported_card_networks_set().count(
Mathieu 2017/04/17 03:20:45 can you file a bug that this line is unnecessary s
please use gerrit instead 2017/04/17 18:19:54 I've changed this to DCHECK instead.
55 instrument.get()->method_name())) { 55 instrument.get()->method_name())) {
56 return true; 56 return true;
57 } 57 }
58 } 58 }
59 return false; 59 return false;
60 } 60 }
61 61
62 bool PaymentRequestState::AreRequestedMethodsSupported() const {
63 return !spec_->supported_card_networks().empty();
64 }
65
62 void PaymentRequestState::AddObserver(Observer* observer) { 66 void PaymentRequestState::AddObserver(Observer* observer) {
63 CHECK(observer); 67 CHECK(observer);
64 observers_.AddObserver(observer); 68 observers_.AddObserver(observer);
65 } 69 }
66 70
67 void PaymentRequestState::RemoveObserver(Observer* observer) { 71 void PaymentRequestState::RemoveObserver(Observer* observer) {
68 observers_.RemoveObserver(observer); 72 observers_.RemoveObserver(observer);
69 } 73 }
70 74
71 void PaymentRequestState::GeneratePaymentResponse() { 75 void PaymentRequestState::GeneratePaymentResponse() {
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
229 bool PaymentRequestState::ArePaymentOptionsSatisfied() { 233 bool PaymentRequestState::ArePaymentOptionsSatisfied() {
230 // TODO(mathp): Have a measure of shipping address completeness. 234 // TODO(mathp): Have a measure of shipping address completeness.
231 if (spec_->request_shipping() && selected_shipping_profile_ == nullptr) 235 if (spec_->request_shipping() && selected_shipping_profile_ == nullptr)
232 return false; 236 return false;
233 237
234 profile_util::PaymentsProfileComparator comparator(app_locale_, *spec_); 238 profile_util::PaymentsProfileComparator comparator(app_locale_, *spec_);
235 return comparator.IsContactInfoComplete(selected_contact_profile_); 239 return comparator.IsContactInfoComplete(selected_contact_profile_);
236 } 240 }
237 241
238 } // namespace payments 242 } // namespace payments
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698