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

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

Issue 2772103002: [Payments] Desktop: never return false in incognito mode for canMakePayment (Closed)
Patch Set: 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
« no previous file with comments | « components/payments/content/payment_request_delegate.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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> 7 #include <set>
8 8
9 #include "components/autofill/core/browser/autofill_data_util.h" 9 #include "components/autofill/core/browser/autofill_data_util.h"
10 #include "components/autofill/core/browser/autofill_profile.h" 10 #include "components/autofill/core/browser/autofill_profile.h"
(...skipping 17 matching lines...) Expand all
28 selected_shipping_profile_(nullptr), 28 selected_shipping_profile_(nullptr),
29 selected_contact_profile_(nullptr), 29 selected_contact_profile_(nullptr),
30 selected_instrument_(nullptr), 30 selected_instrument_(nullptr),
31 selected_shipping_option_(nullptr) { 31 selected_shipping_option_(nullptr) {
32 PopulateProfileCache(); 32 PopulateProfileCache();
33 UpdateSelectedShippingOption(); 33 UpdateSelectedShippingOption();
34 SetDefaultProfileSelections(); 34 SetDefaultProfileSelections();
35 } 35 }
36 36
37 bool PaymentRequestState::CanMakePayment() const { 37 bool PaymentRequestState::CanMakePayment() const {
38 // TODO(crbug.com/704675): Handle incognito mode when replying to this method.
39 for (const std::unique_ptr<PaymentInstrument>& instrument : 38 for (const std::unique_ptr<PaymentInstrument>& instrument :
40 available_instruments_) { 39 available_instruments_) {
41 if (instrument.get()->IsValid() && 40 if (instrument.get()->IsValid() &&
42 spec_->supported_card_networks_set().count( 41 spec_->supported_card_networks_set().count(
43 instrument.get()->method_name())) { 42 instrument.get()->method_name())) {
44 return true; 43 return true;
45 } 44 }
46 } 45 }
47 return false; 46 return false;
48 } 47 }
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after
233 spec_->details().shipping_options.rend(), 232 spec_->details().shipping_options.rend(),
234 [](const payments::mojom::PaymentShippingOptionPtr& element) { 233 [](const payments::mojom::PaymentShippingOptionPtr& element) {
235 return element->selected; 234 return element->selected;
236 }); 235 });
237 if (selected_shipping_option_it != spec_->details().shipping_options.rend()) { 236 if (selected_shipping_option_it != spec_->details().shipping_options.rend()) {
238 selected_shipping_option_ = selected_shipping_option_it->get(); 237 selected_shipping_option_ = selected_shipping_option_it->get();
239 } 238 }
240 } 239 }
241 240
242 } // namespace payments 241 } // namespace payments
OLDNEW
« no previous file with comments | « components/payments/content/payment_request_delegate.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698