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

Side by Side Diff: chrome/browser/payments/chrome_payment_request_delegate.cc

Issue 2803443003: [Payments] Added region load failure tolerance and tests to PR editor. (Closed)
Patch Set: Fix a test leak by faking region data Created 3 years, 8 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 #include "chrome/browser/payments/chrome_payment_request_delegate.h" 5 #include "chrome/browser/payments/chrome_payment_request_delegate.h"
6 6
7 #include "chrome/browser/autofill/personal_data_manager_factory.h" 7 #include "chrome/browser/autofill/personal_data_manager_factory.h"
8 #include "chrome/browser/autofill/validation_rules_storage_factory.h"
8 #include "chrome/browser/browser_process.h" 9 #include "chrome/browser/browser_process.h"
9 #include "chrome/browser/profiles/profile.h" 10 #include "chrome/browser/profiles/profile.h"
10 #include "chrome/browser/ui/browser_dialogs.h" 11 #include "chrome/browser/ui/browser_dialogs.h"
12 #include "components/autofill/core/browser/personal_data_manager.h"
11 #include "components/payments/content/payment_request_dialog.h" 13 #include "components/payments/content/payment_request_dialog.h"
12 #include "content/public/browser/web_contents.h" 14 #include "content/public/browser/web_contents.h"
15 #include "third_party/libaddressinput/chromium/chrome_metadata_source.h"
16 #include "third_party/libaddressinput/chromium/chrome_storage_impl.h"
17 #include "third_party/libaddressinput/messages.h"
Mathieu 2017/04/13 13:28:31 not sure we need this
13 18
14 namespace payments { 19 namespace payments {
15 20
16 ChromePaymentRequestDelegate::ChromePaymentRequestDelegate( 21 ChromePaymentRequestDelegate::ChromePaymentRequestDelegate(
17 content::WebContents* web_contents) 22 content::WebContents* web_contents)
18 : dialog_(nullptr), web_contents_(web_contents) {} 23 : dialog_(nullptr), web_contents_(web_contents) {}
19 24
20 void ChromePaymentRequestDelegate::ShowDialog(PaymentRequest* request) { 25 void ChromePaymentRequestDelegate::ShowDialog(PaymentRequest* request) {
21 DCHECK_EQ(nullptr, dialog_); 26 DCHECK_EQ(nullptr, dialog_);
22 dialog_ = chrome::CreatePaymentRequestDialog(request); 27 dialog_ = chrome::CreatePaymentRequestDialog(request);
(...skipping 28 matching lines...) Expand all
51 return profile && profile->GetProfileType() == Profile::INCOGNITO_PROFILE; 56 return profile && profile->GetProfileType() == Profile::INCOGNITO_PROFILE;
52 } 57 }
53 58
54 void ChromePaymentRequestDelegate::DoFullCardRequest( 59 void ChromePaymentRequestDelegate::DoFullCardRequest(
55 const autofill::CreditCard& credit_card, 60 const autofill::CreditCard& credit_card,
56 base::WeakPtr<autofill::payments::FullCardRequest::ResultDelegate> 61 base::WeakPtr<autofill::payments::FullCardRequest::ResultDelegate>
57 result_delegate) { 62 result_delegate) {
58 dialog_->ShowCvcUnmaskPrompt(credit_card, result_delegate, web_contents_); 63 dialog_->ShowCvcUnmaskPrompt(credit_card, result_delegate, web_contents_);
59 } 64 }
60 65
66 std::unique_ptr<const ::i18n::addressinput::Source>
67 ChromePaymentRequestDelegate::GetAddressInputSource() {
68 return base::WrapUnique(new autofill::ChromeMetadataSource(
69 I18N_ADDRESS_VALIDATION_DATA_URL,
70 GetPersonalDataManager()->GetURLRequestContextGetter()));
71 }
72 std::unique_ptr<::i18n::addressinput::Storage>
73 ChromePaymentRequestDelegate::GetAddressInputStorage() {
74 return autofill::ValidationRulesStorageFactory::CreateStorage();
75 }
76
61 } // namespace payments 77 } // namespace payments
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698