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

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: Address comments. 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
8 #include "chrome/browser/ui/views/payments/view_stack.h" 10 #include "chrome/browser/ui/views/payments/view_stack.h"
9 #include "ui/views/controls/button/button.h" 11 #include "ui/views/controls/button/button.h"
please use gerrit instead 2016/12/15 19:11:15 no longer used.
anthonyvd 2016/12/15 19:55:06 Done.
10 #include "ui/views/window/dialog_delegate.h" 12 #include "ui/views/window/dialog_delegate.h"
11 13
12 class ViewStack; 14 class ViewStack;
please use gerrit instead 2016/12/15 19:11:15 Redundant with view_stack.h include.
please use gerrit instead 2016/12/15 20:29:33 Missed one.
anthonyvd 2016/12/15 20:58:08 For some reason codereview didn't show this commen
13 15
14 namespace payments { 16 namespace payments {
15 17
16 class PaymentRequestImpl; 18 class PaymentRequestImpl;
19 class PaymentRequestSheetController;
20
21 using ControllerMap =
please use gerrit instead 2016/12/15 19:11:15 Who owns these View* pointers?
anthonyvd 2016/12/15 19:55:06 The ViewStack does, added a comment.
22 std::map<views::View*, std::unique_ptr<PaymentRequestSheetController>>;
please use gerrit instead 2016/12/15 19:11:15 #include <memory> for unique_ptr.
anthonyvd 2016/12/15 19:55:06 Done.
17 23
18 // The dialog delegate that represents a desktop WebPayments dialog. This class 24 // The dialog delegate that represents a desktop WebPayments dialog. This class
19 // is responsible for displaying the view associated with the current state of 25 // is responsible for displaying the view associated with the current state of
20 // the WebPayments flow and managing the transition between those states. 26 // the WebPayments flow and managing the transition between those states.
21 class PaymentRequestDialog : public views::DialogDelegateView, 27 class PaymentRequestDialog : public views::DialogDelegateView {
22 public views::ButtonListener {
23 public: 28 public:
24 explicit PaymentRequestDialog(PaymentRequestImpl* impl); 29 explicit PaymentRequestDialog(PaymentRequestImpl* impl);
25 ~PaymentRequestDialog() override; 30 ~PaymentRequestDialog() override;
26 31
27 // views::WidgetDelegate 32 // views::WidgetDelegate
28 ui::ModalType GetModalType() const override; 33 ui::ModalType GetModalType() const override;
29 34
30 // views::View
31 gfx::Size GetPreferredSize() const override;
32
33 // views::DialogDelegate 35 // views::DialogDelegate
34 bool Cancel() override; 36 bool Cancel() override;
35 37
38 void GoBack();
39 void ShowOrderSummary();
40
36 private: 41 private:
37 void ShowInitialPaymentSheet(); 42 void ShowInitialPaymentSheet();
38 void ShowOrderSummary();
39 void GoBack();
40 43
41 // views::ButtonListener: 44 // views::View
42 void ButtonPressed(views::Button* sender, const ui::Event& event) override; 45 gfx::Size GetPreferredSize() const override;
46 void ViewHierarchyChanged(const ViewHierarchyChangedDetails& details)
47 override;
43 48
44 // Non-owned reference to the PaymentRequestImpl that initiated this dialog. 49 // Non-owned reference to the PaymentRequestImpl that initiated this dialog.
45 // Since the PaymentRequestImpl object always outlives this one, the pointer 50 // Since the PaymentRequestImpl object always outlives this one, the pointer
46 // should always be valid even though there is no direct ownership 51 // should always be valid even though there is no direct ownership
47 // relationship between the two. 52 // relationship between the two.
48 PaymentRequestImpl* impl_; 53 PaymentRequestImpl* impl_;
54 ControllerMap controller_map_;
49 ViewStack view_stack_; 55 ViewStack view_stack_;
50 56
51 DISALLOW_COPY_AND_ASSIGN(PaymentRequestDialog); 57 DISALLOW_COPY_AND_ASSIGN(PaymentRequestDialog);
please use gerrit instead 2016/12/15 19:11:15 #include "base/macros.h"
anthonyvd 2016/12/15 19:55:06 Done.
52 }; 58 };
53 59
54 } // namespace payments 60 } // namespace payments
55 61
56 #endif // CHROME_BROWSER_UI_VIEWS_PAYMENTS_PAYMENT_REQUEST_DIALOG_H_ 62 #endif // CHROME_BROWSER_UI_VIEWS_PAYMENTS_PAYMENT_REQUEST_DIALOG_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698