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

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

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 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 <algorithm> 7 #include <algorithm>
8 #include <set> 8 #include <set>
9 #include <utility> 9 #include <utility>
10 10
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 return true; 81 return true;
82 } 82 }
83 } 83 }
84 return false; 84 return false;
85 } 85 }
86 86
87 bool PaymentRequestState::AreRequestedMethodsSupported() const { 87 bool PaymentRequestState::AreRequestedMethodsSupported() const {
88 return !spec_->supported_card_networks().empty(); 88 return !spec_->supported_card_networks().empty();
89 } 89 }
90 90
91 std::string PaymentRequestState::GetAuthenticatedEmail() const {
92 return payment_request_delegate_->GetAuthenticatedEmail();
93 }
94
91 void PaymentRequestState::AddObserver(Observer* observer) { 95 void PaymentRequestState::AddObserver(Observer* observer) {
92 CHECK(observer); 96 CHECK(observer);
93 observers_.AddObserver(observer); 97 observers_.AddObserver(observer);
94 } 98 }
95 99
96 void PaymentRequestState::RemoveObserver(Observer* observer) { 100 void PaymentRequestState::RemoveObserver(Observer* observer) {
97 observers_.RemoveObserver(observer); 101 observers_.RemoveObserver(observer);
98 } 102 }
99 103
100 void PaymentRequestState::GeneratePaymentResponse() { 104 void PaymentRequestState::GeneratePaymentResponse() {
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
186 } 190 }
187 191
188 autofill::PersonalDataManager* PaymentRequestState::GetPersonalDataManager() { 192 autofill::PersonalDataManager* PaymentRequestState::GetPersonalDataManager() {
189 return personal_data_manager_; 193 return personal_data_manager_;
190 } 194 }
191 195
192 autofill::RegionDataLoader* PaymentRequestState::GetRegionDataLoader() { 196 autofill::RegionDataLoader* PaymentRequestState::GetRegionDataLoader() {
193 return payment_request_delegate_->GetRegionDataLoader(); 197 return payment_request_delegate_->GetRegionDataLoader();
194 } 198 }
195 199
200 content::BrowserContext* PaymentRequestState::GetBrowserContext() {
201 return payment_request_delegate_->GetBrowserContext();
202 }
203
196 void PaymentRequestState::PopulateProfileCache() { 204 void PaymentRequestState::PopulateProfileCache() {
197 std::vector<autofill::AutofillProfile*> profiles = 205 std::vector<autofill::AutofillProfile*> profiles =
198 personal_data_manager_->GetProfilesToSuggest(); 206 personal_data_manager_->GetProfilesToSuggest();
199 207
200 // PaymentRequest may outlive the Profiles returned by the Data Manager. 208 // PaymentRequest may outlive the Profiles returned by the Data Manager.
201 // Thus, we store copies, and return a vector of pointers to these copies 209 // Thus, we store copies, and return a vector of pointers to these copies
202 // whenever Profiles are requested. The same is true for credit cards. 210 // whenever Profiles are requested. The same is true for credit cards.
203 for (size_t i = 0; i < profiles.size(); i++) { 211 for (size_t i = 0; i < profiles.size(); i++) {
204 profile_cache_.push_back( 212 profile_cache_.push_back(
205 base::MakeUnique<autofill::AutofillProfile>(*profiles[i])); 213 base::MakeUnique<autofill::AutofillProfile>(*profiles[i]));
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
274 if (is_waiting_for_merchant_validation_) 282 if (is_waiting_for_merchant_validation_)
275 return false; 283 return false;
276 284
277 if (!profile_comparator()->IsShippingComplete(selected_shipping_profile_)) 285 if (!profile_comparator()->IsShippingComplete(selected_shipping_profile_))
278 return false; 286 return false;
279 287
280 return profile_comparator()->IsContactInfoComplete(selected_contact_profile_); 288 return profile_comparator()->IsContactInfoComplete(selected_contact_profile_);
281 } 289 }
282 290
283 } // namespace payments 291 } // namespace payments
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698