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

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: 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 void UpdateSelectedShippingOptionFromDetails();
Mathieu 2017/03/09 19:07:03 Let's add a comment
anthonyvd 2017/03/09 19:43:55 Done.
188
183 content::WebContents* web_contents_; 189 content::WebContents* web_contents_;
184 std::unique_ptr<PaymentRequestDelegate> delegate_; 190 std::unique_ptr<PaymentRequestDelegate> delegate_;
185 // |manager_| owns this PaymentRequest. 191 // |manager_| owns this PaymentRequest.
186 PaymentRequestWebContentsManager* manager_; 192 PaymentRequestWebContentsManager* manager_;
187 mojo::Binding<payments::mojom::PaymentRequest> binding_; 193 mojo::Binding<payments::mojom::PaymentRequest> binding_;
188 payments::mojom::PaymentRequestClientPtr client_; 194 payments::mojom::PaymentRequestClientPtr client_;
189 payments::mojom::PaymentDetailsPtr details_; 195 payments::mojom::PaymentDetailsPtr details_;
190 payments::mojom::PaymentOptionsPtr options_; 196 payments::mojom::PaymentOptionsPtr options_;
191 std::unique_ptr<CurrencyFormatter> currency_formatter_; 197 std::unique_ptr<CurrencyFormatter> currency_formatter_;
192 // A set of supported basic card networks. 198 // A set of supported basic card networks.
193 std::vector<std::string> supported_card_networks_; 199 std::vector<std::string> supported_card_networks_;
194 bool is_ready_to_pay_; 200 bool is_ready_to_pay_;
195 std::unique_ptr<PaymentInstrument> selected_payment_instrument_; 201 std::unique_ptr<PaymentInstrument> selected_payment_instrument_;
196 mojom::PaymentResponsePtr payment_response_; 202 mojom::PaymentResponsePtr payment_response_;
197 203
198 base::ObserverList<Observer> observers_; 204 base::ObserverList<Observer> observers_;
199 205
200 // Profiles may change due to (e.g.) sync events, so profiles are cached after 206 // 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 207 // loading and owned here. They are populated once only, and ordered by
202 // frecency. 208 // frecency.
203 std::vector<std::unique_ptr<autofill::AutofillProfile>> profile_cache_; 209 std::vector<std::unique_ptr<autofill::AutofillProfile>> profile_cache_;
204 std::vector<autofill::AutofillProfile*> shipping_profiles_; 210 std::vector<autofill::AutofillProfile*> shipping_profiles_;
205 std::vector<autofill::AutofillProfile*> contact_profiles_; 211 std::vector<autofill::AutofillProfile*> contact_profiles_;
206 autofill::AutofillProfile* selected_shipping_profile_; 212 autofill::AutofillProfile* selected_shipping_profile_;
207 autofill::AutofillProfile* selected_contact_profile_; 213 autofill::AutofillProfile* selected_contact_profile_;
208 std::vector<std::unique_ptr<autofill::CreditCard>> card_cache_; 214 std::vector<std::unique_ptr<autofill::CreditCard>> card_cache_;
209 std::vector<autofill::CreditCard*> credit_cards_; 215 std::vector<autofill::CreditCard*> credit_cards_;
210 autofill::CreditCard* selected_credit_card_; 216 autofill::CreditCard* selected_credit_card_;
217 payments::mojom::PaymentShippingOption* selected_shipping_option_;
Mathieu 2017/03/09 19:07:03 Should we initialize this (and maybe other pointer
anthonyvd 2017/03/09 19:43:55 Done.
211 218
212 DISALLOW_COPY_AND_ASSIGN(PaymentRequest); 219 DISALLOW_COPY_AND_ASSIGN(PaymentRequest);
213 }; 220 };
214 221
215 } // namespace payments 222 } // namespace payments
216 223
217 #endif // COMPONENTS_PAYMENTS_CONTENT_PAYMENT_REQUEST_H_ 224 #endif // COMPONENTS_PAYMENTS_CONTENT_PAYMENT_REQUEST_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698