| 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> |
| 11 | 11 |
| 12 #include "base/macros.h" | 12 #include "base/macros.h" |
| 13 #include "base/observer_list.h" | 13 #include "base/observer_list.h" |
| 14 #include "components/payments/content/payment_response_helper.h" | 14 #include "components/payments/content/payment_response_helper.h" |
| 15 #include "components/payments/core/profile_util.h" |
| 15 #include "components/payments/mojom/payment_request.mojom.h" | 16 #include "components/payments/mojom/payment_request.mojom.h" |
| 16 | 17 |
| 17 namespace autofill { | 18 namespace autofill { |
| 18 class AutofillProfile; | 19 class AutofillProfile; |
| 19 class CreditCard; | 20 class CreditCard; |
| 20 class PersonalDataManager; | 21 class PersonalDataManager; |
| 21 class RegionDataLoader; | 22 class RegionDataLoader; |
| 22 } // namespace autofill | 23 } // namespace autofill |
| 23 | 24 |
| 24 namespace payments { | 25 namespace payments { |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 138 void SetSelectedInstrument(PaymentInstrument* instrument); | 139 void SetSelectedInstrument(PaymentInstrument* instrument); |
| 139 | 140 |
| 140 bool is_ready_to_pay() { return is_ready_to_pay_; } | 141 bool is_ready_to_pay() { return is_ready_to_pay_; } |
| 141 | 142 |
| 142 const std::string& GetApplicationLocale(); | 143 const std::string& GetApplicationLocale(); |
| 143 autofill::PersonalDataManager* GetPersonalDataManager(); | 144 autofill::PersonalDataManager* GetPersonalDataManager(); |
| 144 autofill::RegionDataLoader* GetRegionDataLoader(); | 145 autofill::RegionDataLoader* GetRegionDataLoader(); |
| 145 | 146 |
| 146 Delegate* delegate() { return delegate_; } | 147 Delegate* delegate() { return delegate_; } |
| 147 | 148 |
| 149 PaymentsProfileComparator* profile_comparator() { |
| 150 return &profile_comparator_; |
| 151 } |
| 152 |
| 148 private: | 153 private: |
| 149 // Fetches the Autofill Profiles for this user from the PersonalDataManager, | 154 // Fetches the Autofill Profiles for this user from the PersonalDataManager, |
| 150 // and stores copies of them, owned by this PaymentRequestState, in | 155 // and stores copies of them, owned by this PaymentRequestState, in |
| 151 // profile_cache_. | 156 // profile_cache_. |
| 152 void PopulateProfileCache(); | 157 void PopulateProfileCache(); |
| 153 | 158 |
| 154 // Sets the initial selections for instruments and profiles, and notifies | 159 // Sets the initial selections for instruments and profiles, and notifies |
| 155 // observers. | 160 // observers. |
| 156 void SetDefaultProfileSelections(); | 161 void SetDefaultProfileSelections(); |
| 157 | 162 |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 189 std::vector<std::unique_ptr<autofill::AutofillProfile>> profile_cache_; | 194 std::vector<std::unique_ptr<autofill::AutofillProfile>> profile_cache_; |
| 190 std::vector<autofill::AutofillProfile*> shipping_profiles_; | 195 std::vector<autofill::AutofillProfile*> shipping_profiles_; |
| 191 std::vector<autofill::AutofillProfile*> contact_profiles_; | 196 std::vector<autofill::AutofillProfile*> contact_profiles_; |
| 192 // Credit cards are directly owned by the instruments in this list. | 197 // Credit cards are directly owned by the instruments in this list. |
| 193 std::vector<std::unique_ptr<PaymentInstrument>> available_instruments_; | 198 std::vector<std::unique_ptr<PaymentInstrument>> available_instruments_; |
| 194 | 199 |
| 195 PaymentRequestDelegate* payment_request_delegate_; | 200 PaymentRequestDelegate* payment_request_delegate_; |
| 196 | 201 |
| 197 std::unique_ptr<PaymentResponseHelper> response_helper_; | 202 std::unique_ptr<PaymentResponseHelper> response_helper_; |
| 198 | 203 |
| 204 PaymentsProfileComparator profile_comparator_; |
| 205 |
| 199 base::ObserverList<Observer> observers_; | 206 base::ObserverList<Observer> observers_; |
| 200 | 207 |
| 201 DISALLOW_COPY_AND_ASSIGN(PaymentRequestState); | 208 DISALLOW_COPY_AND_ASSIGN(PaymentRequestState); |
| 202 }; | 209 }; |
| 203 | 210 |
| 204 } // namespace payments | 211 } // namespace payments |
| 205 | 212 |
| 206 #endif // COMPONENTS_PAYMENTS_CONTENT_PAYMENT_REQUEST_STATE_H_ | 213 #endif // COMPONENTS_PAYMENTS_CONTENT_PAYMENT_REQUEST_STATE_H_ |
| OLD | NEW |