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