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

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

Issue 2876663002: [Web Payments] Add data attribution string to dialog (Closed)
Patch Set: Created 3 years, 7 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 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 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_STATE_H_ 5 #ifndef COMPONENTS_PAYMENTS_CONTENT_PAYMENT_REQUEST_STATE_H_
6 #define COMPONENTS_PAYMENTS_CONTENT_PAYMENT_REQUEST_STATE_H_ 6 #define COMPONENTS_PAYMENTS_CONTENT_PAYMENT_REQUEST_STATE_H_
7 7
8 #include <memory> 8 #include <memory>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
11 11
12 #include "base/macros.h" 12 #include "base/macros.h"
13 #include "base/observer_list.h" 13 #include "base/observer_list.h"
14 #include "components/payments/content/payment_request_spec.h" 14 #include "components/payments/content/payment_request_spec.h"
15 #include "components/payments/content/payment_response_helper.h" 15 #include "components/payments/content/payment_response_helper.h"
16 #include "components/payments/core/address_normalizer.h" 16 #include "components/payments/core/address_normalizer.h"
17 #include "components/payments/core/payments_profile_comparator.h" 17 #include "components/payments/core/payments_profile_comparator.h"
18 #include "components/payments/mojom/payment_request.mojom.h" 18 #include "components/payments/mojom/payment_request.mojom.h"
19 19
20 namespace autofill { 20 namespace autofill {
21 class AutofillProfile; 21 class AutofillProfile;
22 class CreditCard; 22 class CreditCard;
23 class PersonalDataManager; 23 class PersonalDataManager;
24 class RegionDataLoader; 24 class RegionDataLoader;
25 } // namespace autofill 25 } // namespace autofill
26 26
27 namespace content {
28 class BrowserContext;
29 }
30
27 namespace payments { 31 namespace payments {
28 32
29 class PaymentInstrument; 33 class PaymentInstrument;
30 class PaymentRequestDelegate; 34 class PaymentRequestDelegate;
31 35
32 // Keeps track of the information currently selected by the user and whether the 36 // Keeps track of the information currently selected by the user and whether the
33 // user is ready to pay. Uses information from the PaymentRequestSpec, which is 37 // user is ready to pay. Uses information from the PaymentRequestSpec, which is
34 // what the merchant has specified, as input into the "is ready to pay" 38 // what the merchant has specified, as input into the "is ready to pay"
35 // computation. 39 // computation.
36 class PaymentRequestState : public PaymentResponseHelper::Delegate, 40 class PaymentRequestState : public PaymentResponseHelper::Delegate,
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 92
89 // Returns whether the user has at least one instrument that satisfies the 93 // Returns whether the user has at least one instrument that satisfies the
90 // specified supported payment methods. 94 // specified supported payment methods.
91 bool CanMakePayment() const; 95 bool CanMakePayment() const;
92 96
93 // Returns true if the payment methods that the merchant website have 97 // Returns true if the payment methods that the merchant website have
94 // requested are supported. For example, may return true for "basic-card", but 98 // requested are supported. For example, may return true for "basic-card", but
95 // false for "https://bobpay.com". 99 // false for "https://bobpay.com".
96 bool AreRequestedMethodsSupported() const; 100 bool AreRequestedMethodsSupported() const;
97 101
102 // Returns authenticated user email, or empty string.
103 std::string GetAuthenticatedEmail() const;
104
98 void AddObserver(Observer* observer); 105 void AddObserver(Observer* observer);
99 void RemoveObserver(Observer* observer); 106 void RemoveObserver(Observer* observer);
100 107
101 // Initiates the generation of the PaymentResponse. Callers should check 108 // Initiates the generation of the PaymentResponse. Callers should check
102 // |is_ready_to_pay|, which is inexpensive. 109 // |is_ready_to_pay|, which is inexpensive.
103 void GeneratePaymentResponse(); 110 void GeneratePaymentResponse();
104 111
105 // Gets the Autofill Profile representing the shipping address or contact 112 // Gets the Autofill Profile representing the shipping address or contact
106 // information currently selected for this PaymentRequest flow. Can return 113 // information currently selected for this PaymentRequest flow. Can return
107 // null. 114 // null.
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 void SetSelectedShippingProfile(autofill::AutofillProfile* profile); 156 void SetSelectedShippingProfile(autofill::AutofillProfile* profile);
150 void SetSelectedContactProfile(autofill::AutofillProfile* profile); 157 void SetSelectedContactProfile(autofill::AutofillProfile* profile);
151 void SetSelectedInstrument(PaymentInstrument* instrument); 158 void SetSelectedInstrument(PaymentInstrument* instrument);
152 159
153 bool is_ready_to_pay() { return is_ready_to_pay_; } 160 bool is_ready_to_pay() { return is_ready_to_pay_; }
154 161
155 const std::string& GetApplicationLocale(); 162 const std::string& GetApplicationLocale();
156 autofill::PersonalDataManager* GetPersonalDataManager(); 163 autofill::PersonalDataManager* GetPersonalDataManager();
157 autofill::RegionDataLoader* GetRegionDataLoader(); 164 autofill::RegionDataLoader* GetRegionDataLoader();
158 165
166 content::BrowserContext* GetBrowserContext();
167
159 Delegate* delegate() { return delegate_; } 168 Delegate* delegate() { return delegate_; }
160 169
161 PaymentsProfileComparator* profile_comparator() { 170 PaymentsProfileComparator* profile_comparator() {
162 return &profile_comparator_; 171 return &profile_comparator_;
163 } 172 }
164 173
165 private: 174 private:
166 // Fetches the Autofill Profiles for this user from the PersonalDataManager, 175 // Fetches the Autofill Profiles for this user from the PersonalDataManager,
167 // and stores copies of them, owned by this PaymentRequestState, in 176 // and stores copies of them, owned by this PaymentRequestState, in
168 // profile_cache_. 177 // profile_cache_.
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
219 PaymentsProfileComparator profile_comparator_; 228 PaymentsProfileComparator profile_comparator_;
220 229
221 base::ObserverList<Observer> observers_; 230 base::ObserverList<Observer> observers_;
222 231
223 DISALLOW_COPY_AND_ASSIGN(PaymentRequestState); 232 DISALLOW_COPY_AND_ASSIGN(PaymentRequestState);
224 }; 233 };
225 234
226 } // namespace payments 235 } // namespace payments
227 236
228 #endif // COMPONENTS_PAYMENTS_CONTENT_PAYMENT_REQUEST_STATE_H_ 237 #endif // COMPONENTS_PAYMENTS_CONTENT_PAYMENT_REQUEST_STATE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698