| 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 COMPONENTS_PAYMENTS_CONTENT_PAYMENT_REQUEST_DELEGATE_H_ | 5 #ifndef COMPONENTS_PAYMENTS_CONTENT_PAYMENT_REQUEST_DELEGATE_H_ |
| 6 #define COMPONENTS_PAYMENTS_CONTENT_PAYMENT_REQUEST_DELEGATE_H_ | 6 #define COMPONENTS_PAYMENTS_CONTENT_PAYMENT_REQUEST_DELEGATE_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "components/payments/core/autofill_payment_instrument.h" |
| 11 |
| 10 namespace autofill { | 12 namespace autofill { |
| 11 class PersonalDataManager; | 13 class PersonalDataManager; |
| 12 } | 14 } |
| 13 | 15 |
| 16 namespace content { |
| 17 class WebContents; |
| 18 } |
| 19 |
| 14 namespace payments { | 20 namespace payments { |
| 15 | 21 |
| 16 class PaymentRequest; | 22 class PaymentRequest; |
| 17 | 23 |
| 18 class PaymentRequestDelegate { | 24 class PaymentRequestDelegate |
| 25 : public AutofillPaymentInstrument::FullCardRequestDelegate { |
| 19 public: | 26 public: |
| 20 virtual ~PaymentRequestDelegate() {} | 27 ~PaymentRequestDelegate() override {} |
| 21 | 28 |
| 22 // Shows the Payment Request dialog for the given |request|. | 29 // Shows the Payment Request dialog for the given |request|. |
| 23 virtual void ShowDialog(PaymentRequest* request) = 0; | 30 virtual void ShowDialog(PaymentRequest* request) = 0; |
| 24 | 31 |
| 25 // Closes the same dialog that was opened by this delegate. Must be safe to | 32 // Closes the same dialog that was opened by this delegate. Must be safe to |
| 26 // call when the dialog is not showing. | 33 // call when the dialog is not showing. |
| 27 virtual void CloseDialog() = 0; | 34 virtual void CloseDialog() = 0; |
| 28 | 35 |
| 29 // Disables the dialog and shows an error message that the transaction has | 36 // Disables the dialog and shows an error message that the transaction has |
| 30 // failed. | 37 // failed. |
| 31 virtual void ShowErrorMessage() = 0; | 38 virtual void ShowErrorMessage() = 0; |
| 32 | 39 |
| 33 // Gets the PersonalDataManager associated with this PaymentRequest flow. | 40 // Gets the PersonalDataManager associated with this PaymentRequest flow. |
| 34 // Cannot be null. | 41 // Cannot be null. |
| 35 virtual autofill::PersonalDataManager* GetPersonalDataManager() = 0; | 42 virtual autofill::PersonalDataManager* GetPersonalDataManager() = 0; |
| 36 | 43 |
| 37 virtual const std::string& GetApplicationLocale() const = 0; | 44 virtual const std::string& GetApplicationLocale() const = 0; |
| 38 | 45 |
| 39 // Returns whether the user is in Incognito mode. | 46 // Returns whether the user is in Incognito mode. |
| 40 virtual bool IsIncognito() const = 0; | 47 virtual bool IsIncognito() const = 0; |
| 48 |
| 49 // Returns the current request's web contents. |
| 50 virtual content::WebContents* GetWebContents() = 0; |
| 41 }; | 51 }; |
| 42 | 52 |
| 43 } // namespace payments | 53 } // namespace payments |
| 44 | 54 |
| 45 #endif // COMPONENTS_PAYMENTS_CONTENT_PAYMENT_REQUEST_DELEGATE_H_ | 55 #endif // COMPONENTS_PAYMENTS_CONTENT_PAYMENT_REQUEST_DELEGATE_H_ |
| OLD | NEW |