OLD | NEW |
---|---|
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/payments/content/payment_request_dialog.h" | 13 #include "components/payments/content/payment_request_dialog.h" |
14 #include "components/payments/content/payment_request_spec.h" | 14 #include "components/payments/content/payment_request_spec.h" |
15 #include "ui/views/controls/throbber.h" | |
15 #include "ui/views/window/dialog_delegate.h" | 16 #include "ui/views/window/dialog_delegate.h" |
16 | 17 |
17 namespace payments { | 18 namespace payments { |
18 | 19 |
19 class PaymentRequest; | 20 class PaymentRequest; |
20 class PaymentRequestSheetController; | 21 class PaymentRequestSheetController; |
21 | 22 |
22 // Maps views owned by PaymentRequestDialogView::view_stack_ to their | 23 // Maps views owned by PaymentRequestDialogView::view_stack_ to their |
23 // controller. PaymentRequestDialogView is responsible for listening for those | 24 // controller. PaymentRequestDialogView is responsible for listening for those |
24 // views being removed from the hierarchy and delete the associated controllers. | 25 // views being removed from the hierarchy and delete the associated controllers. |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
93 void ShowCreditCardEditor(); | 94 void ShowCreditCardEditor(); |
94 void ShowShippingAddressEditor(); | 95 void ShowShippingAddressEditor(); |
95 void EditorViewUpdated(); | 96 void EditorViewUpdated(); |
96 | 97 |
97 void ShowCvcUnmaskPrompt( | 98 void ShowCvcUnmaskPrompt( |
98 const autofill::CreditCard& credit_card, | 99 const autofill::CreditCard& credit_card, |
99 base::WeakPtr<autofill::payments::FullCardRequest::ResultDelegate> | 100 base::WeakPtr<autofill::payments::FullCardRequest::ResultDelegate> |
100 result_delegate, | 101 result_delegate, |
101 content::WebContents* web_contents) override; | 102 content::WebContents* web_contents) override; |
102 | 103 |
104 void ShowProcessingSpinner(); | |
105 | |
103 ViewStack* view_stack_for_testing() { return &view_stack_; } | 106 ViewStack* view_stack_for_testing() { return &view_stack_; } |
104 | 107 |
105 private: | 108 private: |
106 void ShowInitialPaymentSheet(); | 109 void ShowInitialPaymentSheet(); |
110 void SetupSpinnerOverlay(); | |
107 | 111 |
108 // views::View | 112 // views::View |
109 gfx::Size GetPreferredSize() const override; | 113 gfx::Size GetPreferredSize() const override; |
110 void ViewHierarchyChanged( | 114 void ViewHierarchyChanged( |
111 const ViewHierarchyChangedDetails& details) override; | 115 const ViewHierarchyChangedDetails& details) override; |
112 | 116 |
113 // Non-owned reference to the PaymentRequest that initiated this dialog. Since | 117 // Non-owned reference to the PaymentRequest that initiated this dialog. Since |
114 // the PaymentRequest object always outlives this one, the pointer should | 118 // the PaymentRequest object always outlives this one, the pointer should |
115 // always be valid even though there is no direct ownership relationship | 119 // always be valid even though there is no direct ownership relationship |
116 // between the two. | 120 // between the two. |
117 PaymentRequest* request_; | 121 PaymentRequest* request_; |
118 ControllerMap controller_map_; | 122 ControllerMap controller_map_; |
119 ViewStack view_stack_; | 123 ViewStack view_stack_; |
120 | 124 |
125 // A full dialog overlay that shows a spinner and the "processing" label. It's | |
Mathieu
2017/04/06 19:06:23
nit: We could have this sort of documentation on S
anthonyvd
2017/04/06 20:15:08
Done.
| |
126 // hidden until ShowProcessingSpinner is called. | |
127 views::View throbber_overlay_; | |
128 views::Throbber throbber_; | |
129 | |
121 // May be null. | 130 // May be null. |
122 ObserverForTest* observer_for_testing_; | 131 ObserverForTest* observer_for_testing_; |
123 | 132 |
124 // Used when the dialog is being closed to avoid re-entrancy into the | 133 // Used when the dialog is being closed to avoid re-entrancy into the |
125 // controller_map_. | 134 // controller_map_. |
126 bool being_closed_; | 135 bool being_closed_; |
127 | 136 |
128 DISALLOW_COPY_AND_ASSIGN(PaymentRequestDialogView); | 137 DISALLOW_COPY_AND_ASSIGN(PaymentRequestDialogView); |
129 }; | 138 }; |
130 | 139 |
131 } // namespace payments | 140 } // namespace payments |
132 | 141 |
133 #endif // CHROME_BROWSER_UI_VIEWS_PAYMENTS_PAYMENT_REQUEST_DIALOG_VIEW_H_ | 142 #endif // CHROME_BROWSER_UI_VIEWS_PAYMENTS_PAYMENT_REQUEST_DIALOG_VIEW_H_ |
OLD | NEW |