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

Side by Side Diff: components/payments/content/payment_request_state.cc

Issue 2759253002: [Web Payments] Implement item selection in lists. (Closed)
Patch Set: Assert back navigation in browser tests. 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 #include "components/payments/content/payment_request_state.h" 5 #include "components/payments/content/payment_request_state.h"
6 6
7 #include <set>
8
7 #include "components/autofill/core/browser/autofill_data_util.h" 9 #include "components/autofill/core/browser/autofill_data_util.h"
8 #include "components/autofill/core/browser/autofill_profile.h" 10 #include "components/autofill/core/browser/autofill_profile.h"
9 #include "components/autofill/core/browser/credit_card.h" 11 #include "components/autofill/core/browser/credit_card.h"
10 #include "components/autofill/core/browser/personal_data_manager.h" 12 #include "components/autofill/core/browser/personal_data_manager.h"
11 #include "components/payments/content/payment_request_spec.h" 13 #include "components/payments/content/payment_request_spec.h"
12 #include "components/payments/core/autofill_payment_instrument.h" 14 #include "components/payments/core/autofill_payment_instrument.h"
13 15
14 namespace payments { 16 namespace payments {
15 17
16 PaymentRequestState::PaymentRequestState( 18 PaymentRequestState::PaymentRequestState(
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 delegate_->OnPaymentResponseAvailable(std::move(payment_response)); 55 delegate_->OnPaymentResponseAvailable(std::move(payment_response));
54 } 56 }
55 57
56 void PaymentRequestState::GeneratePaymentResponse() { 58 void PaymentRequestState::GeneratePaymentResponse() {
57 DCHECK(is_ready_to_pay()); 59 DCHECK(is_ready_to_pay());
58 // Fetch the instrument details, will call back into 60 // Fetch the instrument details, will call back into
59 // PaymentRequest::OnInstrumentsDetailsReady. 61 // PaymentRequest::OnInstrumentsDetailsReady.
60 selected_instrument_->InvokePaymentApp(this); 62 selected_instrument_->InvokePaymentApp(this);
61 } 63 }
62 64
65 void PaymentRequestState::SetSelectedShippingOption(
66 mojom::PaymentShippingOption* option) {
67 selected_shipping_option_ = option;
68 UpdateIsReadyToPayAndNotifyObservers();
69 }
70
63 void PaymentRequestState::SetSelectedShippingProfile( 71 void PaymentRequestState::SetSelectedShippingProfile(
64 autofill::AutofillProfile* profile) { 72 autofill::AutofillProfile* profile) {
65 selected_shipping_profile_ = profile; 73 selected_shipping_profile_ = profile;
66 UpdateIsReadyToPayAndNotifyObservers(); 74 UpdateIsReadyToPayAndNotifyObservers();
67 } 75 }
68 76
69 void PaymentRequestState::SetSelectedContactProfile( 77 void PaymentRequestState::SetSelectedContactProfile(
70 autofill::AutofillProfile* profile) { 78 autofill::AutofillProfile* profile) {
71 selected_contact_profile_ = profile; 79 selected_contact_profile_ = profile;
72 UpdateIsReadyToPayAndNotifyObservers(); 80 UpdateIsReadyToPayAndNotifyObservers();
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
212 spec_->details().shipping_options.rend(), 220 spec_->details().shipping_options.rend(),
213 [](const payments::mojom::PaymentShippingOptionPtr& element) { 221 [](const payments::mojom::PaymentShippingOptionPtr& element) {
214 return element->selected; 222 return element->selected;
215 }); 223 });
216 if (selected_shipping_option_it != spec_->details().shipping_options.rend()) { 224 if (selected_shipping_option_it != spec_->details().shipping_options.rend()) {
217 selected_shipping_option_ = selected_shipping_option_it->get(); 225 selected_shipping_option_ = selected_shipping_option_it->get();
218 } 226 }
219 } 227 }
220 228
221 } // namespace payments 229 } // namespace payments
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698