OLD | NEW |
---|---|
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/autofill/validation_rules_storage_factory.h" |
9 #include "chrome/browser/browser_process.h" | 9 #include "chrome/browser/browser_process.h" |
10 #include "chrome/browser/payments/ssl_validity_checker.h" | 10 #include "chrome/browser/payments/ssl_validity_checker.h" |
11 #include "chrome/browser/profiles/profile.h" | 11 #include "chrome/browser/profiles/profile.h" |
12 #include "chrome/browser/ui/browser_dialogs.h" | 12 #include "chrome/browser/ui/browser_dialogs.h" |
13 #include "components/autofill/core/browser/personal_data_manager.h" | 13 #include "components/autofill/core/browser/personal_data_manager.h" |
14 #include "components/payments/content/payment_request_dialog.h" | 14 #include "components/payments/content/payment_request_dialog.h" |
15 #include "components/payments/core/address_normalizer.h" | |
15 #include "content/public/browser/web_contents.h" | 16 #include "content/public/browser/web_contents.h" |
16 #include "third_party/libaddressinput/chromium/chrome_metadata_source.h" | 17 #include "third_party/libaddressinput/chromium/chrome_metadata_source.h" |
17 #include "third_party/libaddressinput/chromium/chrome_storage_impl.h" | 18 #include "third_party/libaddressinput/chromium/chrome_storage_impl.h" |
18 | 19 |
19 namespace payments { | 20 namespace payments { |
20 | 21 |
21 ChromePaymentRequestDelegate::ChromePaymentRequestDelegate( | 22 ChromePaymentRequestDelegate::ChromePaymentRequestDelegate( |
22 content::WebContents* web_contents) | 23 content::WebContents* web_contents) |
23 : dialog_(nullptr), web_contents_(web_contents) {} | 24 : dialog_(nullptr), |
25 web_contents_(web_contents), | |
26 address_normalizer_( | |
please use gerrit instead
2017/04/20 20:15:20
address_normalizer_(GetAddressInputSource(), GetAd
sebsg
2017/04/20 21:06:19
Done.
| |
27 base::MakeUnique<AddressNormalizer>(GetAddressInputSource(), | |
28 GetAddressInputStorage())) {} | |
29 | |
30 ChromePaymentRequestDelegate::~ChromePaymentRequestDelegate() {} | |
24 | 31 |
25 void ChromePaymentRequestDelegate::ShowDialog(PaymentRequest* request) { | 32 void ChromePaymentRequestDelegate::ShowDialog(PaymentRequest* request) { |
26 DCHECK_EQ(nullptr, dialog_); | 33 DCHECK_EQ(nullptr, dialog_); |
27 dialog_ = chrome::CreatePaymentRequestDialog(request); | 34 dialog_ = chrome::CreatePaymentRequestDialog(request); |
28 dialog_->ShowDialog(); | 35 dialog_->ShowDialog(); |
29 } | 36 } |
30 | 37 |
31 void ChromePaymentRequestDelegate::CloseDialog() { | 38 void ChromePaymentRequestDelegate::CloseDialog() { |
32 if (dialog_) { | 39 if (dialog_) { |
33 dialog_->CloseDialog(); | 40 dialog_->CloseDialog(); |
(...skipping 30 matching lines...) Expand all Loading... | |
64 return web_contents_->GetLastCommittedURL(); | 71 return web_contents_->GetLastCommittedURL(); |
65 } | 72 } |
66 | 73 |
67 void ChromePaymentRequestDelegate::DoFullCardRequest( | 74 void ChromePaymentRequestDelegate::DoFullCardRequest( |
68 const autofill::CreditCard& credit_card, | 75 const autofill::CreditCard& credit_card, |
69 base::WeakPtr<autofill::payments::FullCardRequest::ResultDelegate> | 76 base::WeakPtr<autofill::payments::FullCardRequest::ResultDelegate> |
70 result_delegate) { | 77 result_delegate) { |
71 dialog_->ShowCvcUnmaskPrompt(credit_card, result_delegate, web_contents_); | 78 dialog_->ShowCvcUnmaskPrompt(credit_card, result_delegate, web_contents_); |
72 } | 79 } |
73 | 80 |
74 std::unique_ptr<const ::i18n::addressinput::Source> | 81 std::unique_ptr<::i18n::addressinput::Source> |
75 ChromePaymentRequestDelegate::GetAddressInputSource() { | 82 ChromePaymentRequestDelegate::GetAddressInputSource() { |
76 return base::WrapUnique(new autofill::ChromeMetadataSource( | 83 return base::WrapUnique(new autofill::ChromeMetadataSource( |
77 I18N_ADDRESS_VALIDATION_DATA_URL, | 84 I18N_ADDRESS_VALIDATION_DATA_URL, |
78 GetPersonalDataManager()->GetURLRequestContextGetter())); | 85 GetPersonalDataManager()->GetURLRequestContextGetter())); |
79 } | 86 } |
80 std::unique_ptr<::i18n::addressinput::Storage> | 87 std::unique_ptr<::i18n::addressinput::Storage> |
81 ChromePaymentRequestDelegate::GetAddressInputStorage() { | 88 ChromePaymentRequestDelegate::GetAddressInputStorage() { |
82 return autofill::ValidationRulesStorageFactory::CreateStorage(); | 89 return autofill::ValidationRulesStorageFactory::CreateStorage(); |
83 } | 90 } |
84 | 91 |
92 AddressNormalizer* ChromePaymentRequestDelegate::GetAddressNormalizer() { | |
93 return address_normalizer_.get(); | |
please use gerrit instead
2017/04/20 20:15:20
return &address_normaliser_;
sebsg
2017/04/20 21:06:19
Done.
| |
94 } | |
95 | |
85 } // namespace payments | 96 } // namespace payments |
OLD | NEW |