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

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

Issue 2528503002: [WebPayments] Implement state transitions in desktop WebPayments dialog. (Closed)
Patch Set: Make PaymentDialogState own the view returned through GetView Created 4 years 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
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 "ui/views/controls/label.h" 8 #include "chrome/browser/ui/views/payments/order_summary_state.h"
9 #include "chrome/browser/ui/views/payments/payment_sheet_state.h"
10 #include "ui/views/animation/bounds_animator.h"
9 #include "ui/views/window/dialog_delegate.h" 11 #include "ui/views/window/dialog_delegate.h"
10 12
11 namespace payments { 13 namespace payments {
12 14
13 class PaymentRequestImpl; 15 class PaymentRequestImpl;
14 16
15 // The dialog delegate that represents a desktop WebPayments dialog. This class 17 // The dialog delegate that represents a desktop WebPayments dialog. This class
16 // is responsible for displaying the view associated with the current state of 18 // is responsible for displaying the view associated with the current state of
17 // the WebPayments flow and managing the transition between those states. 19 // the WebPayments flow and managing the transition between those states.
18 class PaymentRequestDialog : public views::DialogDelegateView { 20 class PaymentRequestDialog : public views::DialogDelegateView,
21 public PaymentSheetState::Observer,
22 public OrderSummaryState::Observer {
19 public: 23 public:
20 explicit PaymentRequestDialog(PaymentRequestImpl* impl); 24 explicit PaymentRequestDialog(PaymentRequestImpl* impl);
21 ~PaymentRequestDialog() override; 25 ~PaymentRequestDialog() override;
22 26
23 // views::WidgetDelegate: 27 void PushState(std::unique_ptr<PaymentDialogState> state);
28 void PopState();
29
30 // views::WidgetDelegate
24 ui::ModalType GetModalType() const override; 31 ui::ModalType GetModalType() const override;
25 32
26 // views::View: 33 // views::View
27 gfx::Size GetPreferredSize() const override; 34 gfx::Size GetPreferredSize() const override;
28 35
29 // views::DialogDelegate: 36 // views::DialogDelegate
30 bool Cancel() override; 37 bool Cancel() override;
31 38
39 // PaymentSheetState::Observer:
40 void OnOrderSummaryClicked() override;
41
42 // OrderSummaryState::Observer:
43 void OnBackClicked() override;
44
32 private: 45 private:
33 // Non-owned reference to the PaymentRequestImpl that initiated this dialog. 46 // Non-owned reference to the PaymentRequestImpl that initiated this dialog.
34 // Since the PaymentRequestImpl object always outlives this one, the pointer 47 // Since the PaymentRequestImpl object always outlives this one, the pointer
35 // should always be valid even though there is no direct ownership 48 // should always be valid even though there is no direct ownership
36 // relationship between the two. 49 // relationship between the two.
37 PaymentRequestImpl* impl_; 50 PaymentRequestImpl* impl_;
38 std::unique_ptr<views::Label> label_; 51 std::unique_ptr<views::BoundsAnimator> slide_in_animator_;
52 std::unique_ptr<views::BoundsAnimator> slide_out_animator_;
53
54 std::stack<std::unique_ptr<PaymentDialogState> > state_stack_;
sky 2016/12/08 03:58:17 You shouldn't need the space between '>' and '>'.
anthonyvd 2016/12/08 20:31:22 Done.
39 55
40 DISALLOW_COPY_AND_ASSIGN(PaymentRequestDialog); 56 DISALLOW_COPY_AND_ASSIGN(PaymentRequestDialog);
41 }; 57 };
42 58
43 } // namespace payments 59 } // namespace payments
44 60
45 #endif // CHROME_BROWSER_UI_VIEWS_PAYMENTS_PAYMENT_REQUEST_DIALOG_H_ 61 #endif // CHROME_BROWSER_UI_VIEWS_PAYMENTS_PAYMENT_REQUEST_DIALOG_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698