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/profiles/profile.h" | 11 #include "chrome/browser/profiles/profile.h" |
11 #include "chrome/browser/ui/browser_dialogs.h" | 12 #include "chrome/browser/ui/browser_dialogs.h" |
12 #include "components/autofill/core/browser/personal_data_manager.h" | 13 #include "components/autofill/core/browser/personal_data_manager.h" |
13 #include "components/payments/content/payment_request_dialog.h" | 14 #include "components/payments/content/payment_request_dialog.h" |
14 #include "content/public/browser/web_contents.h" | 15 #include "content/public/browser/web_contents.h" |
15 #include "third_party/libaddressinput/chromium/chrome_metadata_source.h" | 16 #include "third_party/libaddressinput/chromium/chrome_metadata_source.h" |
16 #include "third_party/libaddressinput/chromium/chrome_storage_impl.h" | 17 #include "third_party/libaddressinput/chromium/chrome_storage_impl.h" |
17 | 18 |
18 namespace payments { | 19 namespace payments { |
19 | 20 |
(...skipping 28 matching lines...) Expand all Loading... | |
48 const std::string& ChromePaymentRequestDelegate::GetApplicationLocale() const { | 49 const std::string& ChromePaymentRequestDelegate::GetApplicationLocale() const { |
49 return g_browser_process->GetApplicationLocale(); | 50 return g_browser_process->GetApplicationLocale(); |
50 } | 51 } |
51 | 52 |
52 bool ChromePaymentRequestDelegate::IsIncognito() const { | 53 bool ChromePaymentRequestDelegate::IsIncognito() const { |
53 Profile* profile = | 54 Profile* profile = |
54 Profile::FromBrowserContext(web_contents_->GetBrowserContext()); | 55 Profile::FromBrowserContext(web_contents_->GetBrowserContext()); |
55 return profile && profile->GetProfileType() == Profile::INCOGNITO_PROFILE; | 56 return profile && profile->GetProfileType() == Profile::INCOGNITO_PROFILE; |
56 } | 57 } |
57 | 58 |
59 bool ChromePaymentRequestDelegate::IsValidSslCertificate() { | |
60 return SslValidityChecker::IsValidSslCertificate(web_contents_); | |
Mathieu
2017/04/17 03:20:45
This is apparently true in tests? How?
please use gerrit instead
2017/04/17 18:19:54
Tests use such URLs as https://127.0.0.1:45436/pay
| |
61 } | |
62 | |
63 const GURL& ChromePaymentRequestDelegate::GetLastCommittedURL() const { | |
64 return web_contents_->GetLastCommittedURL(); | |
65 } | |
66 | |
58 void ChromePaymentRequestDelegate::DoFullCardRequest( | 67 void ChromePaymentRequestDelegate::DoFullCardRequest( |
59 const autofill::CreditCard& credit_card, | 68 const autofill::CreditCard& credit_card, |
60 base::WeakPtr<autofill::payments::FullCardRequest::ResultDelegate> | 69 base::WeakPtr<autofill::payments::FullCardRequest::ResultDelegate> |
61 result_delegate) { | 70 result_delegate) { |
62 dialog_->ShowCvcUnmaskPrompt(credit_card, result_delegate, web_contents_); | 71 dialog_->ShowCvcUnmaskPrompt(credit_card, result_delegate, web_contents_); |
63 } | 72 } |
64 | 73 |
65 std::unique_ptr<const ::i18n::addressinput::Source> | 74 std::unique_ptr<const ::i18n::addressinput::Source> |
66 ChromePaymentRequestDelegate::GetAddressInputSource() { | 75 ChromePaymentRequestDelegate::GetAddressInputSource() { |
67 return base::WrapUnique(new autofill::ChromeMetadataSource( | 76 return base::WrapUnique(new autofill::ChromeMetadataSource( |
68 I18N_ADDRESS_VALIDATION_DATA_URL, | 77 I18N_ADDRESS_VALIDATION_DATA_URL, |
69 GetPersonalDataManager()->GetURLRequestContextGetter())); | 78 GetPersonalDataManager()->GetURLRequestContextGetter())); |
70 } | 79 } |
71 std::unique_ptr<::i18n::addressinput::Storage> | 80 std::unique_ptr<::i18n::addressinput::Storage> |
72 ChromePaymentRequestDelegate::GetAddressInputStorage() { | 81 ChromePaymentRequestDelegate::GetAddressInputStorage() { |
73 return autofill::ValidationRulesStorageFactory::CreateStorage(); | 82 return autofill::ValidationRulesStorageFactory::CreateStorage(); |
74 } | 83 } |
75 | 84 |
76 } // namespace payments | 85 } // namespace payments |
OLD | NEW |