Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(548)

Side by Side Diff: chrome/browser/ui/views/payments/payment_request_dialog.h

Issue 2631133003: [Payments] Introduce basic interactive browsertests for Payment Request (Closed)
Patch Set: ObserverForTest Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « chrome/browser/ui/BUILD.gn ('k') | chrome/browser/ui/views/payments/payment_request_dialog.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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_PAYMENT_REQUEST_DIALOG_H_ 5 #ifndef CHROME_BROWSER_UI_VIEWS_PAYMENTS_PAYMENT_REQUEST_DIALOG_H_
6 #define CHROME_BROWSER_UI_VIEWS_PAYMENTS_PAYMENT_REQUEST_DIALOG_H_ 6 #define CHROME_BROWSER_UI_VIEWS_PAYMENTS_PAYMENT_REQUEST_DIALOG_H_
7 7
8 #include <map> 8 #include <map>
9 #include <memory> 9 #include <memory>
10 10
(...skipping 10 matching lines...) Expand all
21 // PaymentRequestDialog is responsible for listening for those views being 21 // PaymentRequestDialog is responsible for listening for those views being
22 // removed from the hierarchy and delete the associated controllers. 22 // removed from the hierarchy and delete the associated controllers.
23 using ControllerMap = 23 using ControllerMap =
24 std::map<views::View*, std::unique_ptr<PaymentRequestSheetController>>; 24 std::map<views::View*, std::unique_ptr<PaymentRequestSheetController>>;
25 25
26 // The dialog delegate that represents a desktop WebPayments dialog. This class 26 // The dialog delegate that represents a desktop WebPayments dialog. This class
27 // is responsible for displaying the view associated with the current state of 27 // is responsible for displaying the view associated with the current state of
28 // the WebPayments flow and managing the transition between those states. 28 // the WebPayments flow and managing the transition between those states.
29 class PaymentRequestDialog : public views::DialogDelegateView { 29 class PaymentRequestDialog : public views::DialogDelegateView {
30 public: 30 public:
31 explicit PaymentRequestDialog(PaymentRequest* request); 31 class ObserverForTest {
32 public:
33 virtual void OnDialogOpened() = 0;
34 };
35
36 // Build a Dialog around the PaymentRequest object. |observer| is used to
37 // be notified of dialog events as they happen (but may be NULL) and should
38 // outlive this object.
39 PaymentRequestDialog(PaymentRequest* request,
40 PaymentRequestDialog::ObserverForTest* observer);
32 ~PaymentRequestDialog() override; 41 ~PaymentRequestDialog() override;
33 42
34 // views::WidgetDelegate 43 // views::WidgetDelegate
35 ui::ModalType GetModalType() const override; 44 ui::ModalType GetModalType() const override;
36 45
37 // views::DialogDelegate 46 // views::DialogDelegate
38 bool Cancel() override; 47 bool Cancel() override;
39 bool ShouldShowCloseButton() const override; 48 bool ShouldShowCloseButton() const override;
40 int GetDialogButtons() const override; 49 int GetDialogButtons() const override;
41 50
42 void GoBack(); 51 void GoBack();
43 void ShowOrderSummary(); 52 void ShowOrderSummary();
44 void ShowPaymentMethodSheet(); 53 void ShowPaymentMethodSheet();
45 void CloseDialog(); 54 void CloseDialog();
46 55
56 static void ShowWebModalPaymentDialog(PaymentRequestDialog* dialog,
57 PaymentRequest* request);
58
47 private: 59 private:
48 void ShowInitialPaymentSheet(); 60 void ShowInitialPaymentSheet();
49 61
50 // views::View 62 // views::View
51 gfx::Size GetPreferredSize() const override; 63 gfx::Size GetPreferredSize() const override;
52 void ViewHierarchyChanged(const ViewHierarchyChangedDetails& details) 64 void ViewHierarchyChanged(const ViewHierarchyChangedDetails& details)
53 override; 65 override;
54 66
55 // Non-owned reference to the PaymentRequest that initiated this dialog. Since 67 // Non-owned reference to the PaymentRequest that initiated this dialog. Since
56 // the PaymentRequest object always outlives this one, the pointer should 68 // the PaymentRequest object always outlives this one, the pointer should
57 // always be valid even though there is no direct ownership relationship 69 // always be valid even though there is no direct ownership relationship
58 // between the two. 70 // between the two.
59 PaymentRequest* request_; 71 PaymentRequest* request_;
72 // May be null.
73 ObserverForTest* observer_;
60 ControllerMap controller_map_; 74 ControllerMap controller_map_;
61 ViewStack view_stack_; 75 ViewStack view_stack_;
62 76
63 DISALLOW_COPY_AND_ASSIGN(PaymentRequestDialog); 77 DISALLOW_COPY_AND_ASSIGN(PaymentRequestDialog);
64 }; 78 };
65 79
66 } // namespace payments 80 } // namespace payments
67 81
68 #endif // CHROME_BROWSER_UI_VIEWS_PAYMENTS_PAYMENT_REQUEST_DIALOG_H_ 82 #endif // CHROME_BROWSER_UI_VIEWS_PAYMENTS_PAYMENT_REQUEST_DIALOG_H_
OLDNEW
« no previous file with comments | « chrome/browser/ui/BUILD.gn ('k') | chrome/browser/ui/views/payments/payment_request_dialog.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698