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 #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 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
73 | 73 |
74 void PaymentRequestState::RemoveObserver(Observer* observer) { | 74 void PaymentRequestState::RemoveObserver(Observer* observer) { |
75 observers_.RemoveObserver(observer); | 75 observers_.RemoveObserver(observer); |
76 } | 76 } |
77 | 77 |
78 void PaymentRequestState::GeneratePaymentResponse() { | 78 void PaymentRequestState::GeneratePaymentResponse() { |
79 DCHECK(is_ready_to_pay()); | 79 DCHECK(is_ready_to_pay()); |
80 | 80 |
81 // Once the response is ready, will call back into OnPaymentResponseReady. | 81 // Once the response is ready, will call back into OnPaymentResponseReady. |
82 response_helper_ = base::MakeUnique<PaymentResponseHelper>( | 82 response_helper_ = base::MakeUnique<PaymentResponseHelper>( |
83 app_locale_, spec_, selected_instrument_, payment_request_delegate_, | 83 app_locale_, spec_, selected_instrument_, selected_shipping_profile_, |
84 selected_shipping_profile_, selected_contact_profile_, this); | 84 selected_contact_profile_, this); |
85 } | 85 } |
86 | 86 |
87 void PaymentRequestState::AddAutofillPaymentInstrument( | 87 void PaymentRequestState::AddAutofillPaymentInstrument( |
88 bool selected, | 88 bool selected, |
89 const autofill::CreditCard& card) { | 89 const autofill::CreditCard& card) { |
90 std::string basic_card_network = | 90 std::string basic_card_network = |
91 autofill::data_util::GetPaymentRequestData(card.type()) | 91 autofill::data_util::GetPaymentRequestData(card.type()) |
92 .basic_card_payment_type; | 92 .basic_card_payment_type; |
93 if (!spec_->supported_card_networks_set().count(basic_card_network)) | 93 if (!spec_->supported_card_networks_set().count(basic_card_network)) |
94 return; | 94 return; |
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
236 bool PaymentRequestState::ArePaymentOptionsSatisfied() { | 236 bool PaymentRequestState::ArePaymentOptionsSatisfied() { |
237 // TODO(mathp): Have a measure of shipping address completeness. | 237 // TODO(mathp): Have a measure of shipping address completeness. |
238 if (spec_->request_shipping() && selected_shipping_profile_ == nullptr) | 238 if (spec_->request_shipping() && selected_shipping_profile_ == nullptr) |
239 return false; | 239 return false; |
240 | 240 |
241 profile_util::PaymentsProfileComparator comparator(app_locale_, *spec_); | 241 profile_util::PaymentsProfileComparator comparator(app_locale_, *spec_); |
242 return comparator.IsContactInfoComplete(selected_contact_profile_); | 242 return comparator.IsContactInfoComplete(selected_contact_profile_); |
243 } | 243 } |
244 | 244 |
245 } // namespace payments | 245 } // namespace payments |
OLD | NEW |