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

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

Issue 2698353002: [Payments] Add the "Cards accepted" row at the top of CC editor. (Closed)
Patch Set: addressed 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 21 matching lines...) Expand all
32 public: 32 public:
33 PaymentRequest( 33 PaymentRequest(
34 content::WebContents* web_contents, 34 content::WebContents* web_contents,
35 std::unique_ptr<PaymentRequestDelegate> delegate, 35 std::unique_ptr<PaymentRequestDelegate> delegate,
36 PaymentRequestWebContentsManager* manager, 36 PaymentRequestWebContentsManager* manager,
37 mojo::InterfaceRequest<payments::mojom::PaymentRequest> request); 37 mojo::InterfaceRequest<payments::mojom::PaymentRequest> request);
38 ~PaymentRequest() override; 38 ~PaymentRequest() override;
39 39
40 // payments::mojom::PaymentRequest "stub" 40 // payments::mojom::PaymentRequest "stub"
41 void Init(payments::mojom::PaymentRequestClientPtr client, 41 void Init(payments::mojom::PaymentRequestClientPtr client,
42 std::vector<payments::mojom::PaymentMethodDataPtr> methodData, 42 std::vector<payments::mojom::PaymentMethodDataPtr> method_data,
43 payments::mojom::PaymentDetailsPtr details, 43 payments::mojom::PaymentDetailsPtr details,
44 payments::mojom::PaymentOptionsPtr options) override; 44 payments::mojom::PaymentOptionsPtr options) override;
45 void Show() override; 45 void Show() override;
46 void UpdateWith(payments::mojom::PaymentDetailsPtr details) override {} 46 void UpdateWith(payments::mojom::PaymentDetailsPtr details) override {}
47 void Abort() override; 47 void Abort() override;
48 void Complete(payments::mojom::PaymentComplete result) override {} 48 void Complete(payments::mojom::PaymentComplete result) override {}
49 void CanMakePayment() override {} 49 void CanMakePayment() override {}
50 50
51 // Called when the user explicitely cancelled the flow. Will send a message 51 // Called when the user explicitely cancelled the flow. Will send a message
52 // to the renderer which will indirectly destroy this object (through 52 // to the renderer which will indirectly destroy this object (through
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 // Returns the currently selected credit card for this PaymentRequest flow. 94 // 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 95 // It's not guaranteed to be complete. Returns nullptr if there is no selected
96 // card. 96 // card.
97 autofill::CreditCard* GetCurrentlySelectedCreditCard(); 97 autofill::CreditCard* GetCurrentlySelectedCreditCard();
98 98
99 // Validates the |method_data| and fills |supported_card_networks_|.
100 void PopulateValidatedMethodData(
please use gerrit instead 2017/02/17 15:52:35 Should be private.
Mathieu 2017/02/17 15:57:03 Done.
101 const std::vector<payments::mojom::PaymentMethodDataPtr>& method_data);
102
99 autofill::PersonalDataManager* personal_data_manager() { 103 autofill::PersonalDataManager* personal_data_manager() {
100 return delegate_->GetPersonalDataManager(); 104 return delegate_->GetPersonalDataManager();
101 } 105 }
102 106
103 payments::mojom::PaymentDetails* details() { return details_.get(); } 107 payments::mojom::PaymentDetails* details() { return details_.get(); }
108 const std::vector<std::string>& supported_card_networks() {
109 return supported_card_networks_;
110 }
104 content::WebContents* web_contents() { return web_contents_; } 111 content::WebContents* web_contents() { return web_contents_; }
105 112
106 private: 113 private:
107 // Fetches the Autofill Profiles for this user from the PersonalDataManager, 114 // Fetches the Autofill Profiles for this user from the PersonalDataManager,
108 // and stores copies of them, owned by this Request, in profile_cache_. 115 // and stores copies of them, owned by this Request, in profile_cache_.
109 void PopulateProfileCache(); 116 void PopulateProfileCache();
110 117
111 // Sets the default values for the selected Shipping and Contact profiles. 118 // Sets the default values for the selected Shipping and Contact profiles.
112 void SetDefaultProfileSelections(); 119 void SetDefaultProfileSelections();
113 120
114 content::WebContents* web_contents_; 121 content::WebContents* web_contents_;
115 std::unique_ptr<PaymentRequestDelegate> delegate_; 122 std::unique_ptr<PaymentRequestDelegate> delegate_;
116 // |manager_| owns this PaymentRequest. 123 // |manager_| owns this PaymentRequest.
117 PaymentRequestWebContentsManager* manager_; 124 PaymentRequestWebContentsManager* manager_;
118 mojo::Binding<payments::mojom::PaymentRequest> binding_; 125 mojo::Binding<payments::mojom::PaymentRequest> binding_;
119 payments::mojom::PaymentRequestClientPtr client_; 126 payments::mojom::PaymentRequestClientPtr client_;
120 payments::mojom::PaymentDetailsPtr details_; 127 payments::mojom::PaymentDetailsPtr details_;
121 std::unique_ptr<CurrencyFormatter> currency_formatter_; 128 std::unique_ptr<CurrencyFormatter> currency_formatter_;
129 // A set of supported basic card networks.
130 std::vector<std::string> supported_card_networks_;
122 131
123 // Profiles may change due to (e.g.) sync events, so profiles are cached after 132 // Profiles may change due to (e.g.) sync events, so profiles are cached after
124 // loading and owned here. They are populated once only, and ordered by 133 // loading and owned here. They are populated once only, and ordered by
125 // frecency. 134 // frecency.
126 std::vector<std::unique_ptr<autofill::AutofillProfile>> profile_cache_; 135 std::vector<std::unique_ptr<autofill::AutofillProfile>> profile_cache_;
127 std::vector<autofill::AutofillProfile*> shipping_profiles_; 136 std::vector<autofill::AutofillProfile*> shipping_profiles_;
128 std::vector<autofill::AutofillProfile*> contact_profiles_; 137 std::vector<autofill::AutofillProfile*> contact_profiles_;
129 autofill::AutofillProfile* selected_shipping_profile_; 138 autofill::AutofillProfile* selected_shipping_profile_;
130 autofill::AutofillProfile* selected_contact_profile_; 139 autofill::AutofillProfile* selected_contact_profile_;
131 140
132 DISALLOW_COPY_AND_ASSIGN(PaymentRequest); 141 DISALLOW_COPY_AND_ASSIGN(PaymentRequest);
133 }; 142 };
134 143
135 } // namespace payments 144 } // namespace payments
136 145
137 #endif // COMPONENTS_PAYMENTS_PAYMENT_REQUEST_H_ 146 #endif // COMPONENTS_PAYMENTS_PAYMENT_REQUEST_H_
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/payments/payment_sheet_view_controller.cc ('k') | components/payments/payment_request.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698