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" |
11 #include "chrome/browser/payments/chrome_payment_request_delegate.h" | 11 #include "chrome/browser/payments/chrome_payment_request_delegate.h" |
12 #include "chrome/browser/ui/views/payments/payment_request_dialog_view.h" | 12 #include "chrome/browser/ui/views/payments/payment_request_dialog_view.h" |
13 | 13 |
14 namespace content { | 14 namespace content { |
15 class WebContents; | 15 class WebContents; |
16 } | 16 } |
17 | 17 |
18 namespace views { | |
19 class WidgetObserver; | |
20 } | |
21 | |
22 namespace payments { | 18 namespace payments { |
23 | 19 |
24 class PaymentRequest; | 20 class PaymentRequest; |
25 | 21 |
26 // Implementation of the Payment Request delegate used in tests. | 22 // Implementation of the Payment Request delegate used in tests. |
27 class TestChromePaymentRequestDelegate : public ChromePaymentRequestDelegate { | 23 class TestChromePaymentRequestDelegate : public ChromePaymentRequestDelegate { |
28 public: | 24 public: |
29 TestChromePaymentRequestDelegate( | 25 TestChromePaymentRequestDelegate( |
30 content::WebContents* web_contents, | 26 content::WebContents* web_contents, |
31 PaymentRequestDialogView::ObserverForTest* observer, | 27 PaymentRequestDialogView::ObserverForTest* observer, |
32 views::WidgetObserver* widget_observer, | |
33 bool is_incognito, | 28 bool is_incognito, |
34 bool is_valid_ssl); | 29 bool is_valid_ssl); |
35 | 30 |
36 void SetRegionDataLoader(autofill::RegionDataLoader* region_data_loader) { | 31 void SetRegionDataLoader(autofill::RegionDataLoader* region_data_loader) { |
37 region_data_loader_ = region_data_loader; | 32 region_data_loader_ = region_data_loader; |
38 } | 33 } |
39 | 34 |
40 // ChromePaymentRequestDelegate. | 35 // ChromePaymentRequestDelegate. |
41 void ShowDialog(PaymentRequest* request) override; | 36 void ShowDialog(PaymentRequest* request) override; |
42 bool IsIncognito() const override; | 37 bool IsIncognito() const override; |
43 bool IsSslCertificateValid() override; | 38 bool IsSslCertificateValid() override; |
44 autofill::RegionDataLoader* GetRegionDataLoader() override; | 39 autofill::RegionDataLoader* GetRegionDataLoader() override; |
45 | 40 |
46 PaymentRequestDialogView* dialog_view() { | 41 PaymentRequestDialogView* dialog_view() { |
47 return static_cast<PaymentRequestDialogView*>(dialog_); | 42 return static_cast<PaymentRequestDialogView*>(dialog_); |
48 } | 43 } |
49 | 44 |
50 private: | 45 private: |
51 // Not owned so must outlive the PaymentRequest object; | 46 // Not owned so must outlive the PaymentRequest object; |
52 autofill::RegionDataLoader* region_data_loader_; | 47 autofill::RegionDataLoader* region_data_loader_; |
53 | 48 |
54 PaymentRequestDialogView::ObserverForTest* observer_; | 49 PaymentRequestDialogView::ObserverForTest* observer_; |
55 views::WidgetObserver* widget_observer_; | |
56 bool is_incognito_; | 50 bool is_incognito_; |
57 bool is_valid_ssl_; | 51 bool is_valid_ssl_; |
58 | 52 |
59 DISALLOW_COPY_AND_ASSIGN(TestChromePaymentRequestDelegate); | 53 DISALLOW_COPY_AND_ASSIGN(TestChromePaymentRequestDelegate); |
60 }; | 54 }; |
61 | 55 |
62 } // namespace payments | 56 } // namespace payments |
63 | 57 |
64 #endif // CHROME_BROWSER_UI_VIEWS_PAYMENTS_TEST_CHROME_PAYMENT_REQUEST_DELEGATE
_H_ | 58 #endif // CHROME_BROWSER_UI_VIEWS_PAYMENTS_TEST_CHROME_PAYMENT_REQUEST_DELEGATE
_H_ |
OLD | NEW |