| 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_SPEC_H_ | 5 #ifndef COMPONENTS_PAYMENTS_CONTENT_PAYMENT_REQUEST_SPEC_H_ |
| 6 #define COMPONENTS_PAYMENTS_CONTENT_PAYMENT_REQUEST_SPEC_H_ | 6 #define COMPONENTS_PAYMENTS_CONTENT_PAYMENT_REQUEST_SPEC_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <set> | 9 #include <set> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 114 friend class PaymentRequestDialogView; | 114 friend class PaymentRequestDialogView; |
| 115 void add_observer_for_testing(Observer* observer_for_testing) { | 115 void add_observer_for_testing(Observer* observer_for_testing) { |
| 116 observer_for_testing_ = observer_for_testing; | 116 observer_for_testing_ = observer_for_testing; |
| 117 } | 117 } |
| 118 | 118 |
| 119 // Validates the |method_data| and fills |supported_card_networks_|, | 119 // Validates the |method_data| and fills |supported_card_networks_|, |
| 120 // |supported_card_networks_set_| and |basic_card_specified_networks_|. | 120 // |supported_card_networks_set_| and |basic_card_specified_networks_|. |
| 121 void PopulateValidatedMethodData( | 121 void PopulateValidatedMethodData( |
| 122 const std::vector<mojom::PaymentMethodDataPtr>& method_data); | 122 const std::vector<mojom::PaymentMethodDataPtr>& method_data); |
| 123 | 123 |
| 124 // Updates the selected_shipping_option based on the data passed to this | 124 // Updates the |selected_shipping_option| based on the data passed to this |
| 125 // payment request by the website. This will set selected_shipping_option_ to | 125 // payment request by the website. This will set selected_shipping_option_ to |
| 126 // the last option marked selected in the options array. | 126 // the last option marked selected in the options array. If no options are |
| 127 void UpdateSelectedShippingOption(); | 127 // provided and this method is called |after_update|, it means the merchant |
| 128 // doesn't ship to this location. In this case, |
| 129 // |selected_shipping_option_error_| will be set. |
| 130 void UpdateSelectedShippingOption(bool after_update); |
| 128 | 131 |
| 129 // Will notify all observers that the spec has changed. | 132 // Will notify all observers that the spec has changed. |
| 130 void NotifyOnSpecUpdated(); | 133 void NotifyOnSpecUpdated(); |
| 131 | 134 |
| 132 // Returns the CurrencyFormatter instance for this PaymentRequest. | 135 // Returns the CurrencyFormatter instance for this PaymentRequest. |
| 133 // |locale_name| should be the result of the browser's GetApplicationLocale(). | 136 // |locale_name| should be the result of the browser's GetApplicationLocale(). |
| 134 // Note: Having multiple currencies per PaymentRequest is not supported; hence | 137 // Note: Having multiple currencies per PaymentRequest is not supported; hence |
| 135 // the CurrencyFormatter is cached here. | 138 // the CurrencyFormatter is cached here. |
| 136 CurrencyFormatter* GetOrCreateCurrencyFormatter( | 139 CurrencyFormatter* GetOrCreateCurrencyFormatter( |
| 137 const std::string& currency_code, | 140 const std::string& currency_code, |
| (...skipping 27 matching lines...) Expand all Loading... |
| 165 // notified. | 168 // notified. |
| 166 base::ObserverList<Observer> observers_; | 169 base::ObserverList<Observer> observers_; |
| 167 Observer* observer_for_testing_; | 170 Observer* observer_for_testing_; |
| 168 | 171 |
| 169 DISALLOW_COPY_AND_ASSIGN(PaymentRequestSpec); | 172 DISALLOW_COPY_AND_ASSIGN(PaymentRequestSpec); |
| 170 }; | 173 }; |
| 171 | 174 |
| 172 } // namespace payments | 175 } // namespace payments |
| 173 | 176 |
| 174 #endif // COMPONENTS_PAYMENTS_CONTENT_PAYMENT_REQUEST_SPEC_H_ | 177 #endif // COMPONENTS_PAYMENTS_CONTENT_PAYMENT_REQUEST_SPEC_H_ |
| OLD | NEW |