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