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

Side by Side Diff: components/payments/content/payment_request.h

Issue 2744633002: [Web Payments] Add the shipping method section to the payment sheet (Closed)
Patch Set: Rename shipping method to shipping option. Created 3 years, 9 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 #ifndef COMPONENTS_PAYMENTS_CONTENT_PAYMENT_REQUEST_H_ 5 #ifndef COMPONENTS_PAYMENTS_CONTENT_PAYMENT_REQUEST_H_
6 #define COMPONENTS_PAYMENTS_CONTENT_PAYMENT_REQUEST_H_ 6 #define COMPONENTS_PAYMENTS_CONTENT_PAYMENT_REQUEST_H_
7 7
8 #include <memory> 8 #include <memory>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 return selected_shipping_profile_; 123 return selected_shipping_profile_;
124 } 124 }
125 autofill::AutofillProfile* selected_contact_profile() const { 125 autofill::AutofillProfile* selected_contact_profile() const {
126 return selected_contact_profile_; 126 return selected_contact_profile_;
127 } 127 }
128 // Returns the currently selected credit card for this PaymentRequest flow. 128 // Returns the currently selected credit card for this PaymentRequest flow.
129 // It's not guaranteed to be complete. Returns nullptr if there is no selected 129 // It's not guaranteed to be complete. Returns nullptr if there is no selected
130 // card. 130 // card.
131 autofill::CreditCard* selected_credit_card() { return selected_credit_card_; } 131 autofill::CreditCard* selected_credit_card() { return selected_credit_card_; }
132 132
133 payments::mojom::PaymentShippingOption* selected_shipping_option() {
134 return selected_shipping_option_;
135 }
136
133 // Sets the |profile| to be the selected one and will update state and notify 137 // Sets the |profile| to be the selected one and will update state and notify
134 // observers. 138 // observers.
135 void SetSelectedShippingProfile(autofill::AutofillProfile* profile); 139 void SetSelectedShippingProfile(autofill::AutofillProfile* profile);
136 void SetSelectedContactProfile(autofill::AutofillProfile* profile); 140 void SetSelectedContactProfile(autofill::AutofillProfile* profile);
137 void SetSelectedCreditCard(autofill::CreditCard* card); 141 void SetSelectedCreditCard(autofill::CreditCard* card);
138 142
139 autofill::PersonalDataManager* personal_data_manager() { 143 autofill::PersonalDataManager* personal_data_manager() {
140 return delegate_->GetPersonalDataManager(); 144 return delegate_->GetPersonalDataManager();
141 } 145 }
142 146
(...skipping 30 matching lines...) Expand all
173 // Notifies all observers that selected information has changed. 177 // Notifies all observers that selected information has changed.
174 void NotifyOnSelectedInformationChanged(); 178 void NotifyOnSelectedInformationChanged();
175 179
176 // Returns whether the selected data satisfies the PaymentDetails requirements 180 // Returns whether the selected data satisfies the PaymentDetails requirements
177 // (payment methods). 181 // (payment methods).
178 bool ArePaymentDetailsSatisfied(); 182 bool ArePaymentDetailsSatisfied();
179 // Returns whether the selected data satisfies the PaymentOptions requirements 183 // Returns whether the selected data satisfies the PaymentOptions requirements
180 // (contact info, shipping address). 184 // (contact info, shipping address).
181 bool ArePaymentOptionsSatisfied(); 185 bool ArePaymentOptionsSatisfied();
182 186
187 // Updates the selected_shipping_option based on the data passed to this
188 // payment request by the website. This will set selected_shipping_option_ to
189 // the last option marked selected in the options array.
190 void UpdateSelectedShippingOptionFromDetails();
191
183 content::WebContents* web_contents_; 192 content::WebContents* web_contents_;
184 std::unique_ptr<PaymentRequestDelegate> delegate_; 193 std::unique_ptr<PaymentRequestDelegate> delegate_;
185 // |manager_| owns this PaymentRequest. 194 // |manager_| owns this PaymentRequest.
186 PaymentRequestWebContentsManager* manager_; 195 PaymentRequestWebContentsManager* manager_;
187 mojo::Binding<payments::mojom::PaymentRequest> binding_; 196 mojo::Binding<payments::mojom::PaymentRequest> binding_;
188 payments::mojom::PaymentRequestClientPtr client_; 197 payments::mojom::PaymentRequestClientPtr client_;
189 payments::mojom::PaymentDetailsPtr details_; 198 payments::mojom::PaymentDetailsPtr details_;
190 payments::mojom::PaymentOptionsPtr options_; 199 payments::mojom::PaymentOptionsPtr options_;
191 std::unique_ptr<CurrencyFormatter> currency_formatter_; 200 std::unique_ptr<CurrencyFormatter> currency_formatter_;
192 // A set of supported basic card networks. 201 // A set of supported basic card networks.
193 std::vector<std::string> supported_card_networks_; 202 std::vector<std::string> supported_card_networks_;
194 bool is_ready_to_pay_; 203 bool is_ready_to_pay_;
195 std::unique_ptr<PaymentInstrument> selected_payment_instrument_; 204 std::unique_ptr<PaymentInstrument> selected_payment_instrument_;
196 mojom::PaymentResponsePtr payment_response_; 205 mojom::PaymentResponsePtr payment_response_;
197 206
198 base::ObserverList<Observer> observers_; 207 base::ObserverList<Observer> observers_;
199 208
200 // Profiles may change due to (e.g.) sync events, so profiles are cached after 209 // Profiles may change due to (e.g.) sync events, so profiles are cached after
201 // loading and owned here. They are populated once only, and ordered by 210 // loading and owned here. They are populated once only, and ordered by
202 // frecency. 211 // frecency.
203 std::vector<std::unique_ptr<autofill::AutofillProfile>> profile_cache_; 212 std::vector<std::unique_ptr<autofill::AutofillProfile>> profile_cache_;
204 std::vector<autofill::AutofillProfile*> shipping_profiles_; 213 std::vector<autofill::AutofillProfile*> shipping_profiles_;
205 std::vector<autofill::AutofillProfile*> contact_profiles_; 214 std::vector<autofill::AutofillProfile*> contact_profiles_;
206 autofill::AutofillProfile* selected_shipping_profile_; 215 autofill::AutofillProfile* selected_shipping_profile_;
207 autofill::AutofillProfile* selected_contact_profile_; 216 autofill::AutofillProfile* selected_contact_profile_;
208 std::vector<std::unique_ptr<autofill::CreditCard>> card_cache_; 217 std::vector<std::unique_ptr<autofill::CreditCard>> card_cache_;
209 std::vector<autofill::CreditCard*> credit_cards_; 218 std::vector<autofill::CreditCard*> credit_cards_;
210 autofill::CreditCard* selected_credit_card_; 219 autofill::CreditCard* selected_credit_card_;
220 // This is owned by |details_|, which is owned by this object and lives until
221 // |this| is destructed so it's safe to keep this raw pointer.
222 payments::mojom::PaymentShippingOption* selected_shipping_option_;
211 223
212 DISALLOW_COPY_AND_ASSIGN(PaymentRequest); 224 DISALLOW_COPY_AND_ASSIGN(PaymentRequest);
213 }; 225 };
214 226
215 } // namespace payments 227 } // namespace payments
216 228
217 #endif // COMPONENTS_PAYMENTS_CONTENT_PAYMENT_REQUEST_H_ 229 #endif // COMPONENTS_PAYMENTS_CONTENT_PAYMENT_REQUEST_H_
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/payments/payment_sheet_view_controller.cc ('k') | components/payments/content/payment_request.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698