| 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_UI_VIEWS_PAYMENTS_TEST_CHROME_PAYMENT_REQUEST_DELEGATE_H_ | 5 #ifndef CHROME_BROWSER_UI_VIEWS_PAYMENTS_TEST_CHROME_PAYMENT_REQUEST_DELEGATE_H_ |
| 6 #define CHROME_BROWSER_UI_VIEWS_PAYMENTS_TEST_CHROME_PAYMENT_REQUEST_DELEGATE_H_ | 6 #define CHROME_BROWSER_UI_VIEWS_PAYMENTS_TEST_CHROME_PAYMENT_REQUEST_DELEGATE_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 | 9 |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 | 23 |
| 24 class PaymentRequest; | 24 class PaymentRequest; |
| 25 | 25 |
| 26 // Implementation of the Payment Request delegate used in tests. | 26 // Implementation of the Payment Request delegate used in tests. |
| 27 class TestChromePaymentRequestDelegate : public ChromePaymentRequestDelegate { | 27 class TestChromePaymentRequestDelegate : public ChromePaymentRequestDelegate { |
| 28 public: | 28 public: |
| 29 TestChromePaymentRequestDelegate( | 29 TestChromePaymentRequestDelegate( |
| 30 content::WebContents* web_contents, | 30 content::WebContents* web_contents, |
| 31 PaymentRequestDialogView::ObserverForTest* observer, | 31 PaymentRequestDialogView::ObserverForTest* observer, |
| 32 views::WidgetObserver* widget_observer, | 32 views::WidgetObserver* widget_observer, |
| 33 bool is_incognito); | 33 bool is_incognito, |
| 34 bool is_valid_ssl); |
| 34 | 35 |
| 35 // This class allows tests to provide their own AddressInput data. | 36 // This class allows tests to provide their own AddressInput data. |
| 36 class AddressInputProvider { | 37 class AddressInputProvider { |
| 37 public: | 38 public: |
| 38 virtual std::unique_ptr<const ::i18n::addressinput::Source> | 39 virtual std::unique_ptr<const ::i18n::addressinput::Source> |
| 39 GetAddressInputSource() = 0; | 40 GetAddressInputSource() = 0; |
| 40 virtual std::unique_ptr<::i18n::addressinput::Storage> | 41 virtual std::unique_ptr<::i18n::addressinput::Storage> |
| 41 GetAddressInputStorage() = 0; | 42 GetAddressInputStorage() = 0; |
| 42 }; | 43 }; |
| 43 | 44 |
| 44 void SetAddressInputOverride(AddressInputProvider* address_input_provider) { | 45 void SetAddressInputOverride(AddressInputProvider* address_input_provider) { |
| 45 address_input_provider_ = address_input_provider; | 46 address_input_provider_ = address_input_provider; |
| 46 } | 47 } |
| 47 | 48 |
| 48 // ChromePaymentRequestDelegate. | 49 // ChromePaymentRequestDelegate. |
| 49 void ShowDialog(PaymentRequest* request) override; | 50 void ShowDialog(PaymentRequest* request) override; |
| 50 bool IsIncognito() const override; | 51 bool IsIncognito() const override; |
| 52 bool IsSslCertificateValid() override; |
| 51 std::unique_ptr<const ::i18n::addressinput::Source> GetAddressInputSource() | 53 std::unique_ptr<const ::i18n::addressinput::Source> GetAddressInputSource() |
| 52 override; | 54 override; |
| 53 std::unique_ptr<::i18n::addressinput::Storage> GetAddressInputStorage() | 55 std::unique_ptr<::i18n::addressinput::Storage> GetAddressInputStorage() |
| 54 override; | 56 override; |
| 55 | 57 |
| 56 PaymentRequestDialogView* dialog_view() { | 58 PaymentRequestDialogView* dialog_view() { |
| 57 return static_cast<PaymentRequestDialogView*>(dialog_); | 59 return static_cast<PaymentRequestDialogView*>(dialog_); |
| 58 } | 60 } |
| 59 | 61 |
| 60 private: | 62 private: |
| 61 // Not owned so must outlive the PaymentRequest object; | 63 // Not owned so must outlive the PaymentRequest object; |
| 62 AddressInputProvider* address_input_provider_; | 64 AddressInputProvider* address_input_provider_; |
| 63 | 65 |
| 64 PaymentRequestDialogView::ObserverForTest* observer_; | 66 PaymentRequestDialogView::ObserverForTest* observer_; |
| 65 views::WidgetObserver* widget_observer_; | 67 views::WidgetObserver* widget_observer_; |
| 66 bool is_incognito_for_testing_; | 68 bool is_incognito_; |
| 69 bool is_valid_ssl_; |
| 67 | 70 |
| 68 DISALLOW_COPY_AND_ASSIGN(TestChromePaymentRequestDelegate); | 71 DISALLOW_COPY_AND_ASSIGN(TestChromePaymentRequestDelegate); |
| 69 }; | 72 }; |
| 70 | 73 |
| 71 } // namespace payments | 74 } // namespace payments |
| 72 | 75 |
| 73 #endif // CHROME_BROWSER_UI_VIEWS_PAYMENTS_TEST_CHROME_PAYMENT_REQUEST_DELEGATE
_H_ | 76 #endif // CHROME_BROWSER_UI_VIEWS_PAYMENTS_TEST_CHROME_PAYMENT_REQUEST_DELEGATE
_H_ |
| OLD | NEW |