| OLD | NEW |
| 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 #ifndef COMPONENTS_PAYMENTS_CONTENT_PAYMENT_REQUEST_STATE_H_ | 5 #ifndef COMPONENTS_PAYMENTS_CONTENT_PAYMENT_REQUEST_STATE_H_ |
| 6 #define COMPONENTS_PAYMENTS_CONTENT_PAYMENT_REQUEST_STATE_H_ | 6 #define COMPONENTS_PAYMENTS_CONTENT_PAYMENT_REQUEST_STATE_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 107 | 107 |
| 108 // Record the use of the data models that were used in the Payment Request. | 108 // Record the use of the data models that were used in the Payment Request. |
| 109 void RecordUseStats(); | 109 void RecordUseStats(); |
| 110 | 110 |
| 111 // Gets the Autofill Profile representing the shipping address or contact | 111 // Gets the Autofill Profile representing the shipping address or contact |
| 112 // information currently selected for this PaymentRequest flow. Can return | 112 // information currently selected for this PaymentRequest flow. Can return |
| 113 // null. | 113 // null. |
| 114 autofill::AutofillProfile* selected_shipping_profile() const { | 114 autofill::AutofillProfile* selected_shipping_profile() const { |
| 115 return selected_shipping_profile_; | 115 return selected_shipping_profile_; |
| 116 } | 116 } |
| 117 // If |spec()->selected_shipping_option_error()| is not empty, this contains |
| 118 // the profile for which the error is about. |
| 119 autofill::AutofillProfile* selected_shipping_option_error_profile() const { |
| 120 return selected_shipping_option_error_profile_; |
| 121 } |
| 117 autofill::AutofillProfile* selected_contact_profile() const { | 122 autofill::AutofillProfile* selected_contact_profile() const { |
| 118 return selected_contact_profile_; | 123 return selected_contact_profile_; |
| 119 } | 124 } |
| 120 // Returns the currently selected instrument for this PaymentRequest flow. | 125 // Returns the currently selected instrument for this PaymentRequest flow. |
| 121 // It's not guaranteed to be complete. Returns nullptr if there is no selected | 126 // It's not guaranteed to be complete. Returns nullptr if there is no selected |
| 122 // instrument. | 127 // instrument. |
| 123 PaymentInstrument* selected_instrument() const { | 128 PaymentInstrument* selected_instrument() const { |
| 124 return selected_instrument_; | 129 return selected_instrument_; |
| 125 } | 130 } |
| 126 | 131 |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 209 bool is_waiting_for_merchant_validation_; | 214 bool is_waiting_for_merchant_validation_; |
| 210 | 215 |
| 211 const std::string app_locale_; | 216 const std::string app_locale_; |
| 212 | 217 |
| 213 // Not owned. Never null. Both outlive this object. | 218 // Not owned. Never null. Both outlive this object. |
| 214 PaymentRequestSpec* spec_; | 219 PaymentRequestSpec* spec_; |
| 215 Delegate* delegate_; | 220 Delegate* delegate_; |
| 216 autofill::PersonalDataManager* personal_data_manager_; | 221 autofill::PersonalDataManager* personal_data_manager_; |
| 217 | 222 |
| 218 autofill::AutofillProfile* selected_shipping_profile_; | 223 autofill::AutofillProfile* selected_shipping_profile_; |
| 224 autofill::AutofillProfile* selected_shipping_option_error_profile_; |
| 219 autofill::AutofillProfile* selected_contact_profile_; | 225 autofill::AutofillProfile* selected_contact_profile_; |
| 220 PaymentInstrument* selected_instrument_; | 226 PaymentInstrument* selected_instrument_; |
| 221 | 227 |
| 222 // Profiles may change due to (e.g.) sync events, so profiles are cached after | 228 // Profiles may change due to (e.g.) sync events, so profiles are cached after |
| 223 // loading and owned here. They are populated once only, and ordered by | 229 // loading and owned here. They are populated once only, and ordered by |
| 224 // frecency. | 230 // frecency. |
| 225 std::vector<std::unique_ptr<autofill::AutofillProfile>> profile_cache_; | 231 std::vector<std::unique_ptr<autofill::AutofillProfile>> profile_cache_; |
| 226 std::vector<autofill::AutofillProfile*> shipping_profiles_; | 232 std::vector<autofill::AutofillProfile*> shipping_profiles_; |
| 227 std::vector<autofill::AutofillProfile*> contact_profiles_; | 233 std::vector<autofill::AutofillProfile*> contact_profiles_; |
| 228 // Credit cards are directly owned by the instruments in this list. | 234 // Credit cards are directly owned by the instruments in this list. |
| 229 std::vector<std::unique_ptr<PaymentInstrument>> available_instruments_; | 235 std::vector<std::unique_ptr<PaymentInstrument>> available_instruments_; |
| 230 | 236 |
| 231 PaymentRequestDelegate* payment_request_delegate_; | 237 PaymentRequestDelegate* payment_request_delegate_; |
| 232 | 238 |
| 233 std::unique_ptr<PaymentResponseHelper> response_helper_; | 239 std::unique_ptr<PaymentResponseHelper> response_helper_; |
| 234 | 240 |
| 235 PaymentsProfileComparator profile_comparator_; | 241 PaymentsProfileComparator profile_comparator_; |
| 236 | 242 |
| 237 base::ObserverList<Observer> observers_; | 243 base::ObserverList<Observer> observers_; |
| 238 | 244 |
| 239 DISALLOW_COPY_AND_ASSIGN(PaymentRequestState); | 245 DISALLOW_COPY_AND_ASSIGN(PaymentRequestState); |
| 240 }; | 246 }; |
| 241 | 247 |
| 242 } // namespace payments | 248 } // namespace payments |
| 243 | 249 |
| 244 #endif // COMPONENTS_PAYMENTS_CONTENT_PAYMENT_REQUEST_STATE_H_ | 250 #endif // COMPONENTS_PAYMENTS_CONTENT_PAYMENT_REQUEST_STATE_H_ |
| OLD | NEW |