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

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

Issue 2579513002: [WebPayments] Factor out sheet-specific logic in Controllers. (Closed)
Patch Set: Add missing include and semicolon. 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 <map>
9 #include <memory>
10
11 #include "base/macros.h"
8 #include "chrome/browser/ui/views/payments/view_stack.h" 12 #include "chrome/browser/ui/views/payments/view_stack.h"
9 #include "ui/views/controls/button/button.h"
10 #include "ui/views/window/dialog_delegate.h" 13 #include "ui/views/window/dialog_delegate.h"
11 14
12 class ViewStack;
13
14 namespace payments { 15 namespace payments {
15 16
16 class PaymentRequestImpl; 17 class PaymentRequestImpl;
18 class PaymentRequestSheetController;
19
20 // Maps views owned by PaymentRequestDialog::view_stack_ to their controller.
21 // PaymentRequestDialog is responsible for listening for those views being
22 // removed from the hierarchy and delete the associated controllers.
23 using ControllerMap =
24 std::map<views::View*, std::unique_ptr<PaymentRequestSheetController>>;
17 25
18 // The dialog delegate that represents a desktop WebPayments dialog. This class 26 // The dialog delegate that represents a desktop WebPayments dialog. This class
19 // 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
20 // the WebPayments flow and managing the transition between those states. 28 // the WebPayments flow and managing the transition between those states.
21 class PaymentRequestDialog : public views::DialogDelegateView, 29 class PaymentRequestDialog : public views::DialogDelegateView {
22 public views::ButtonListener {
23 public: 30 public:
24 explicit PaymentRequestDialog(PaymentRequestImpl* impl); 31 explicit PaymentRequestDialog(PaymentRequestImpl* impl);
25 ~PaymentRequestDialog() override; 32 ~PaymentRequestDialog() override;
26 33
27 // views::WidgetDelegate 34 // views::WidgetDelegate
28 ui::ModalType GetModalType() const override; 35 ui::ModalType GetModalType() const override;
29 36
30 // views::View
31 gfx::Size GetPreferredSize() const override;
32
33 // views::DialogDelegate 37 // views::DialogDelegate
34 bool Cancel() override; 38 bool Cancel() override;
35 39
40 void GoBack();
41 void ShowOrderSummary();
42
36 private: 43 private:
37 void ShowInitialPaymentSheet(); 44 void ShowInitialPaymentSheet();
38 void ShowOrderSummary();
39 void GoBack();
40 45
41 // views::ButtonListener: 46 // views::View
42 void ButtonPressed(views::Button* sender, const ui::Event& event) override; 47 gfx::Size GetPreferredSize() const override;
48 void ViewHierarchyChanged(const ViewHierarchyChangedDetails& details)
49 override;
43 50
44 // Non-owned reference to the PaymentRequestImpl that initiated this dialog. 51 // Non-owned reference to the PaymentRequestImpl that initiated this dialog.
45 // Since the PaymentRequestImpl object always outlives this one, the pointer 52 // Since the PaymentRequestImpl object always outlives this one, the pointer
46 // should always be valid even though there is no direct ownership 53 // should always be valid even though there is no direct ownership
47 // relationship between the two. 54 // relationship between the two.
48 PaymentRequestImpl* impl_; 55 PaymentRequestImpl* impl_;
56 ControllerMap controller_map_;
49 ViewStack view_stack_; 57 ViewStack view_stack_;
50 58
51 DISALLOW_COPY_AND_ASSIGN(PaymentRequestDialog); 59 DISALLOW_COPY_AND_ASSIGN(PaymentRequestDialog);
52 }; 60 };
53 61
54 } // namespace payments 62 } // namespace payments
55 63
56 #endif // CHROME_BROWSER_UI_VIEWS_PAYMENTS_PAYMENT_REQUEST_DIALOG_H_ 64 #endif // CHROME_BROWSER_UI_VIEWS_PAYMENTS_PAYMENT_REQUEST_DIALOG_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698