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 #ifndef CHROME_BROWSER_PAYMENTS_CHROME_PAYMENT_REQUEST_DELEGATE_H_ | 5 #ifndef CHROME_BROWSER_PAYMENTS_CHROME_PAYMENT_REQUEST_DELEGATE_H_ |
6 #define CHROME_BROWSER_PAYMENTS_CHROME_PAYMENT_REQUEST_DELEGATE_H_ | 6 #define CHROME_BROWSER_PAYMENTS_CHROME_PAYMENT_REQUEST_DELEGATE_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 #include <string> | 9 #include <string> |
10 | 10 |
11 #include "base/macros.h" | 11 #include "base/macros.h" |
12 #include "components/payments/core/address_normalizer.h" | |
13 #include "components/payments/core/payment_request_delegate.h" | 12 #include "components/payments/core/payment_request_delegate.h" |
14 | 13 |
15 namespace content { | 14 namespace content { |
16 class WebContents; | 15 class WebContents; |
17 } | 16 } |
18 | 17 |
19 namespace payments { | 18 namespace payments { |
20 | 19 |
21 class PaymentRequestDialog; | 20 class PaymentRequestDialog; |
22 | 21 |
23 class ChromePaymentRequestDelegate : public PaymentRequestDelegate { | 22 class ChromePaymentRequestDelegate : public PaymentRequestDelegate { |
24 public: | 23 public: |
25 explicit ChromePaymentRequestDelegate(content::WebContents* web_contents); | 24 explicit ChromePaymentRequestDelegate(content::WebContents* web_contents); |
26 ~ChromePaymentRequestDelegate() override; | 25 ~ChromePaymentRequestDelegate() override {} |
27 | 26 |
28 // PaymentRequestDelegate: | 27 // PaymentRequestDelegate: |
29 void ShowDialog(PaymentRequest* request) override; | 28 void ShowDialog(PaymentRequest* request) override; |
30 void CloseDialog() override; | 29 void CloseDialog() override; |
31 void ShowErrorMessage() override; | 30 void ShowErrorMessage() override; |
32 autofill::PersonalDataManager* GetPersonalDataManager() override; | 31 autofill::PersonalDataManager* GetPersonalDataManager() override; |
33 const std::string& GetApplicationLocale() const override; | 32 const std::string& GetApplicationLocale() const override; |
34 bool IsIncognito() const override; | 33 bool IsIncognito() const override; |
35 bool IsSslCertificateValid() override; | 34 bool IsSslCertificateValid() override; |
36 const GURL& GetLastCommittedURL() const override; | 35 const GURL& GetLastCommittedURL() const override; |
37 void DoFullCardRequest( | 36 void DoFullCardRequest( |
38 const autofill::CreditCard& credit_card, | 37 const autofill::CreditCard& credit_card, |
39 base::WeakPtr<autofill::payments::FullCardRequest::ResultDelegate> | 38 base::WeakPtr<autofill::payments::FullCardRequest::ResultDelegate> |
40 result_delegate) override; | 39 result_delegate) override; |
41 std::unique_ptr<::i18n::addressinput::Source> GetAddressInputSource() | 40 std::unique_ptr<const ::i18n::addressinput::Source> GetAddressInputSource() |
42 override; | 41 override; |
43 std::unique_ptr<::i18n::addressinput::Storage> GetAddressInputStorage() | 42 std::unique_ptr<::i18n::addressinput::Storage> GetAddressInputStorage() |
44 override; | 43 override; |
45 AddressNormalizer* GetAddressNormalizer() override; | |
46 | 44 |
47 protected: | 45 protected: |
48 // Reference to the dialog so that we can satisfy calls to CloseDialog(). This | 46 // Reference to the dialog so that we can satisfy calls to CloseDialog(). This |
49 // reference is invalid once CloseDialog() has been called on it, because the | 47 // reference is invalid once CloseDialog() has been called on it, because the |
50 // dialog will be destroyed. Protected for testing. | 48 // dialog will be destroyed. Protected for testing. |
51 PaymentRequestDialog* dialog_; | 49 PaymentRequestDialog* dialog_; |
52 | 50 |
53 private: | 51 private: |
54 // Not owned but outlives the PaymentRequest object that owns this. | 52 // Not owned but outlives the PaymentRequest object that owns this. |
55 content::WebContents* web_contents_; | 53 content::WebContents* web_contents_; |
56 | 54 |
57 // The address normalizer to use for the duration of the Payment Request. | |
58 AddressNormalizer address_normalizer_; | |
59 | |
60 DISALLOW_COPY_AND_ASSIGN(ChromePaymentRequestDelegate); | 55 DISALLOW_COPY_AND_ASSIGN(ChromePaymentRequestDelegate); |
61 }; | 56 }; |
62 | 57 |
63 } // namespace payments | 58 } // namespace payments |
64 | 59 |
65 #endif // CHROME_BROWSER_PAYMENTS_CHROME_PAYMENT_REQUEST_DELEGATE_H_ | 60 #endif // CHROME_BROWSER_PAYMENTS_CHROME_PAYMENT_REQUEST_DELEGATE_H_ |
OLD | NEW |