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