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

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

Issue 2779283002: [Web Payments] Implement the CVC Unmask dialog. (Closed)
Patch Set: Created 3 years, 8 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
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_VIEW_H_ 5 #ifndef CHROME_BROWSER_UI_VIEWS_PAYMENTS_PAYMENT_REQUEST_DIALOG_VIEW_H_
6 #define CHROME_BROWSER_UI_VIEWS_PAYMENTS_PAYMENT_REQUEST_DIALOG_VIEW_H_ 6 #define CHROME_BROWSER_UI_VIEWS_PAYMENTS_PAYMENT_REQUEST_DIALOG_VIEW_H_
7 7
8 #include <map> 8 #include <map>
9 #include <memory> 9 #include <memory>
10 10
11 #include "base/macros.h" 11 #include "base/macros.h"
12 #include "chrome/browser/ui/views/payments/view_stack.h" 12 #include "chrome/browser/ui/views/payments/view_stack.h"
13 #include "components/autofill/core/browser/payments/full_card_request.h"
13 #include "components/payments/content/payment_request_dialog.h" 14 #include "components/payments/content/payment_request_dialog.h"
14 #include "ui/views/window/dialog_delegate.h" 15 #include "ui/views/window/dialog_delegate.h"
15 16
16 namespace payments { 17 namespace payments {
17 18
19 class CvcUnmaskUIDelegate;
20 class CvcUnmaskViewController;
18 class PaymentRequest; 21 class PaymentRequest;
19 class PaymentRequestSheetController; 22 class PaymentRequestSheetController;
20 23
21 // Maps views owned by PaymentRequestDialogView::view_stack_ to their 24 // Maps views owned by PaymentRequestDialogView::view_stack_ to their
22 // controller. PaymentRequestDialogView is responsible for listening for those 25 // controller. PaymentRequestDialogView is responsible for listening for those
23 // views being removed from the hierarchy and delete the associated controllers. 26 // views being removed from the hierarchy and delete the associated controllers.
24 using ControllerMap = 27 using ControllerMap =
25 std::map<views::View*, std::unique_ptr<PaymentRequestSheetController>>; 28 std::map<views::View*, std::unique_ptr<PaymentRequestSheetController>>;
26 29
27 // The dialog delegate that represents a desktop WebPayments dialog. This class 30 // The dialog delegate that represents a desktop WebPayments dialog. This class
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 ui::ModalType GetModalType() const override; 65 ui::ModalType GetModalType() const override;
63 66
64 // views::DialogDelegate 67 // views::DialogDelegate
65 bool Cancel() override; 68 bool Cancel() override;
66 bool ShouldShowCloseButton() const override; 69 bool ShouldShowCloseButton() const override;
67 int GetDialogButtons() const override; 70 int GetDialogButtons() const override;
68 71
69 // payments::PaymentRequestDialog 72 // payments::PaymentRequestDialog
70 void ShowDialog() override; 73 void ShowDialog() override;
71 void CloseDialog() override; 74 void CloseDialog() override;
75 base::WeakPtr<autofill::payments::FullCardRequest::UIDelegate>
76 GetFullCardRequestUIDelegate() override;
72 77
73 void Pay(); 78 void Pay();
74 void GoBack(); 79 void GoBack();
75 void ShowContactProfileSheet(); 80 void ShowContactProfileSheet();
76 void ShowOrderSummary(); 81 void ShowOrderSummary();
77 void ShowShippingProfileSheet(); 82 void ShowShippingProfileSheet();
78 void ShowPaymentMethodSheet(); 83 void ShowPaymentMethodSheet();
79 void ShowShippingOptionSheet(); 84 void ShowShippingOptionSheet();
80 void ShowCreditCardEditor(); 85 void ShowCreditCardEditor();
81 void ShowShippingAddressEditor(); 86 void ShowShippingAddressEditor();
82 void EditorViewUpdated(); 87 void EditorViewUpdated();
83 88
89 void ShowCvcUnmaskSheet(
90 std::unique_ptr<CvcUnmaskViewController> view_controller);
91
84 ViewStack* view_stack_for_testing() { return &view_stack_; } 92 ViewStack* view_stack_for_testing() { return &view_stack_; }
85 93
86 private: 94 private:
87 void ShowInitialPaymentSheet(); 95 void ShowInitialPaymentSheet();
88 96
89 // views::View 97 // views::View
90 gfx::Size GetPreferredSize() const override; 98 gfx::Size GetPreferredSize() const override;
91 void ViewHierarchyChanged( 99 void ViewHierarchyChanged(
92 const ViewHierarchyChangedDetails& details) override; 100 const ViewHierarchyChangedDetails& details) override;
93 101
94 // Non-owned reference to the PaymentRequest that initiated this dialog. Since 102 // Non-owned reference to the PaymentRequest that initiated this dialog. Since
95 // the PaymentRequest object always outlives this one, the pointer should 103 // the PaymentRequest object always outlives this one, the pointer should
96 // always be valid even though there is no direct ownership relationship 104 // always be valid even though there is no direct ownership relationship
97 // between the two. 105 // between the two.
98 PaymentRequest* request_; 106 PaymentRequest* request_;
99 ControllerMap controller_map_; 107 ControllerMap controller_map_;
100 ViewStack view_stack_; 108 ViewStack view_stack_;
101 109
102 // May be null. 110 // May be null.
103 ObserverForTest* observer_for_testing_; 111 ObserverForTest* observer_for_testing_;
104 112
105 // Used when the dialog is being closed to avoid re-entrancy into the 113 // Used when the dialog is being closed to avoid re-entrancy into the
106 // controller_map_. 114 // controller_map_.
107 bool being_closed_; 115 bool being_closed_;
108 116
117 std::unique_ptr<CvcUnmaskUIDelegate> cvc_unmask_ui_delegate_;
118
109 DISALLOW_COPY_AND_ASSIGN(PaymentRequestDialogView); 119 DISALLOW_COPY_AND_ASSIGN(PaymentRequestDialogView);
110 }; 120 };
111 121
112 } // namespace payments 122 } // namespace payments
113 123
114 #endif // CHROME_BROWSER_UI_VIEWS_PAYMENTS_PAYMENT_REQUEST_DIALOG_VIEW_H_ 124 #endif // CHROME_BROWSER_UI_VIEWS_PAYMENTS_PAYMENT_REQUEST_DIALOG_VIEW_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698