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

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

Issue 2695653004: [Web Payments] Add a mechanism to build item lists in the PR dialog. (Closed)
Patch Set: Fix up some comments. Created 3 years, 10 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_PAYMENT_REQUEST_H_ 5 #ifndef COMPONENTS_PAYMENTS_PAYMENT_REQUEST_H_
6 #define COMPONENTS_PAYMENTS_PAYMENT_REQUEST_H_ 6 #define COMPONENTS_PAYMENTS_PAYMENT_REQUEST_H_
7 7
8 #include <memory> 8 #include <memory>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 void set_selected_shipping_profile(autofill::AutofillProfile* profile) { 84 void set_selected_shipping_profile(autofill::AutofillProfile* profile) {
85 selected_shipping_profile_ = profile; 85 selected_shipping_profile_ = profile;
86 } 86 }
87 autofill::AutofillProfile* selected_contact_profile() const { 87 autofill::AutofillProfile* selected_contact_profile() const {
88 return selected_contact_profile_; 88 return selected_contact_profile_;
89 } 89 }
90 void set_selected_contact_profile(autofill::AutofillProfile* profile) { 90 void set_selected_contact_profile(autofill::AutofillProfile* profile) {
91 selected_contact_profile_ = profile; 91 selected_contact_profile_ = profile;
92 } 92 }
93 93
94 const std::vector<autofill::CreditCard*>& credit_cards();
95
94 // Returns the currently selected credit card for this PaymentRequest flow. 96 // Returns the currently selected credit card for this PaymentRequest flow.
95 // It's not guaranteed to be complete. Returns nullptr if there is no selected 97 // It's not guaranteed to be complete. Returns nullptr if there is no selected
96 // card. 98 // card.
97 autofill::CreditCard* GetCurrentlySelectedCreditCard(); 99 autofill::CreditCard* selected_credit_card() { return selected_credit_card_; }
98 100
99 autofill::PersonalDataManager* personal_data_manager() { 101 autofill::PersonalDataManager* personal_data_manager() {
100 return delegate_->GetPersonalDataManager(); 102 return delegate_->GetPersonalDataManager();
101 } 103 }
102 104
103 payments::mojom::PaymentDetails* details() { return details_.get(); } 105 payments::mojom::PaymentDetails* details() { return details_.get(); }
104 const std::vector<std::string>& supported_card_networks() { 106 const std::vector<std::string>& supported_card_networks() {
105 return supported_card_networks_; 107 return supported_card_networks_;
106 } 108 }
107 content::WebContents* web_contents() { return web_contents_; } 109 content::WebContents* web_contents() { return web_contents_; }
108 110
109 private: 111 private:
110 // Fetches the Autofill Profiles for this user from the PersonalDataManager, 112 // Fetches the Autofill Profiles for this user from the PersonalDataManager,
111 // and stores copies of them, owned by this Request, in profile_cache_. 113 // and stores copies of them, owned by this Request, in profile_cache_.
112 void PopulateProfileCache(); 114 void PopulateProfileCache();
113 115
114 // Sets the default values for the selected Shipping and Contact profiles. 116 // Sets the default values for the selected Shipping and Contact profiles, as
117 // well as the selected Credit Card.
115 void SetDefaultProfileSelections(); 118 void SetDefaultProfileSelections();
116 119
117 // Validates the |method_data| and fills |supported_card_networks_|. 120 // Validates the |method_data| and fills |supported_card_networks_|.
118 void PopulateValidatedMethodData( 121 void PopulateValidatedMethodData(
119 const std::vector<payments::mojom::PaymentMethodDataPtr>& method_data); 122 const std::vector<payments::mojom::PaymentMethodDataPtr>& method_data);
120 123
121 content::WebContents* web_contents_; 124 content::WebContents* web_contents_;
122 std::unique_ptr<PaymentRequestDelegate> delegate_; 125 std::unique_ptr<PaymentRequestDelegate> delegate_;
123 // |manager_| owns this PaymentRequest. 126 // |manager_| owns this PaymentRequest.
124 PaymentRequestWebContentsManager* manager_; 127 PaymentRequestWebContentsManager* manager_;
125 mojo::Binding<payments::mojom::PaymentRequest> binding_; 128 mojo::Binding<payments::mojom::PaymentRequest> binding_;
126 payments::mojom::PaymentRequestClientPtr client_; 129 payments::mojom::PaymentRequestClientPtr client_;
127 payments::mojom::PaymentDetailsPtr details_; 130 payments::mojom::PaymentDetailsPtr details_;
128 std::unique_ptr<CurrencyFormatter> currency_formatter_; 131 std::unique_ptr<CurrencyFormatter> currency_formatter_;
129 // A set of supported basic card networks. 132 // A set of supported basic card networks.
130 std::vector<std::string> supported_card_networks_; 133 std::vector<std::string> supported_card_networks_;
131 134
132 // Profiles may change due to (e.g.) sync events, so profiles are cached after 135 // Profiles may change due to (e.g.) sync events, so profiles are cached after
133 // loading and owned here. They are populated once only, and ordered by 136 // loading and owned here. They are populated once only, and ordered by
134 // frecency. 137 // frecency.
135 std::vector<std::unique_ptr<autofill::AutofillProfile>> profile_cache_; 138 std::vector<std::unique_ptr<autofill::AutofillProfile>> profile_cache_;
136 std::vector<autofill::AutofillProfile*> shipping_profiles_; 139 std::vector<autofill::AutofillProfile*> shipping_profiles_;
137 std::vector<autofill::AutofillProfile*> contact_profiles_; 140 std::vector<autofill::AutofillProfile*> contact_profiles_;
138 autofill::AutofillProfile* selected_shipping_profile_; 141 autofill::AutofillProfile* selected_shipping_profile_;
139 autofill::AutofillProfile* selected_contact_profile_; 142 autofill::AutofillProfile* selected_contact_profile_;
143 std::vector<std::unique_ptr<autofill::CreditCard>> card_cache_;
144 std::vector<autofill::CreditCard*> credit_cards_;
145 autofill::CreditCard* selected_credit_card_;
140 146
141 DISALLOW_COPY_AND_ASSIGN(PaymentRequest); 147 DISALLOW_COPY_AND_ASSIGN(PaymentRequest);
142 }; 148 };
143 149
144 } // namespace payments 150 } // namespace payments
145 151
146 #endif // COMPONENTS_PAYMENTS_PAYMENT_REQUEST_H_ 152 #endif // COMPONENTS_PAYMENTS_PAYMENT_REQUEST_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698