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

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: Observer pattern 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 Observer {
please use gerrit instead 2017/01/19 18:20:12 nit: ObserverForTest
Mathieu 2017/01/19 18:50:41 Done.
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).
please use gerrit instead 2017/01/19 18:20:12 Mention that the observer should outlive this obje
Mathieu 2017/01/19 18:50:41 Done.
38 PaymentRequestDialog(PaymentRequest* request,
39 PaymentRequestDialog::Observer* observer);
32 ~PaymentRequestDialog() override; 40 ~PaymentRequestDialog() override;
33 41
34 // views::WidgetDelegate 42 // views::WidgetDelegate
35 ui::ModalType GetModalType() const override; 43 ui::ModalType GetModalType() const override;
36 44
37 // views::DialogDelegate 45 // views::DialogDelegate
38 bool Cancel() override; 46 bool Cancel() override;
39 bool ShouldShowCloseButton() const override; 47 bool ShouldShowCloseButton() const override;
40 int GetDialogButtons() const override; 48 int GetDialogButtons() const override;
41 49
42 void GoBack(); 50 void GoBack();
43 void ShowOrderSummary(); 51 void ShowOrderSummary();
44 void ShowPaymentMethodSheet(); 52 void ShowPaymentMethodSheet();
45 void CloseDialog(); 53 void CloseDialog();
46 54
55 static void ShowWebModalPaymentDialog(PaymentRequestDialog* dialog,
56 PaymentRequest* request);
57
47 private: 58 private:
48 void ShowInitialPaymentSheet(); 59 void ShowInitialPaymentSheet();
49 60
50 // views::View 61 // views::View
51 gfx::Size GetPreferredSize() const override; 62 gfx::Size GetPreferredSize() const override;
52 void ViewHierarchyChanged(const ViewHierarchyChangedDetails& details) 63 void ViewHierarchyChanged(const ViewHierarchyChangedDetails& details)
53 override; 64 override;
54 65
55 // Non-owned reference to the PaymentRequest that initiated this dialog. Since 66 // Non-owned reference to the PaymentRequest that initiated this dialog. Since
56 // the PaymentRequest object always outlives this one, the pointer should 67 // the PaymentRequest object always outlives this one, the pointer should
57 // always be valid even though there is no direct ownership relationship 68 // always be valid even though there is no direct ownership relationship
58 // between the two. 69 // between the two.
59 PaymentRequest* request_; 70 PaymentRequest* request_;
71 // May be null.
72 Observer* observer_;
60 ControllerMap controller_map_; 73 ControllerMap controller_map_;
61 ViewStack view_stack_; 74 ViewStack view_stack_;
62 75
63 DISALLOW_COPY_AND_ASSIGN(PaymentRequestDialog); 76 DISALLOW_COPY_AND_ASSIGN(PaymentRequestDialog);
64 }; 77 };
65 78
66 } // namespace payments 79 } // namespace payments
67 80
68 #endif // CHROME_BROWSER_UI_VIEWS_PAYMENTS_PAYMENT_REQUEST_DIALOG_H_ 81 #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