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 // Shows a full dialog spinner with the "processing" label that doesn't offer |
| 105 // a way of closing the dialog. |
| 106 void ShowProcessingSpinner(); |
| 107 |
103 ViewStack* view_stack_for_testing() { return &view_stack_; } | 108 ViewStack* view_stack_for_testing() { return &view_stack_; } |
104 | 109 |
105 private: | 110 private: |
106 void ShowInitialPaymentSheet(); | 111 void ShowInitialPaymentSheet(); |
| 112 void SetupSpinnerOverlay(); |
107 | 113 |
108 // views::View | 114 // views::View |
109 gfx::Size GetPreferredSize() const override; | 115 gfx::Size GetPreferredSize() const override; |
110 void ViewHierarchyChanged( | 116 void ViewHierarchyChanged( |
111 const ViewHierarchyChangedDetails& details) override; | 117 const ViewHierarchyChangedDetails& details) override; |
112 | 118 |
113 // Non-owned reference to the PaymentRequest that initiated this dialog. Since | 119 // Non-owned reference to the PaymentRequest that initiated this dialog. Since |
114 // the PaymentRequest object always outlives this one, the pointer should | 120 // the PaymentRequest object always outlives this one, the pointer should |
115 // always be valid even though there is no direct ownership relationship | 121 // always be valid even though there is no direct ownership relationship |
116 // between the two. | 122 // between the two. |
117 PaymentRequest* request_; | 123 PaymentRequest* request_; |
118 ControllerMap controller_map_; | 124 ControllerMap controller_map_; |
119 ViewStack view_stack_; | 125 ViewStack view_stack_; |
120 | 126 |
| 127 // A full dialog overlay that shows a spinner and the "processing" label. It's |
| 128 // hidden until ShowProcessingSpinner is called. |
| 129 views::View throbber_overlay_; |
| 130 views::Throbber throbber_; |
| 131 |
121 // May be null. | 132 // May be null. |
122 ObserverForTest* observer_for_testing_; | 133 ObserverForTest* observer_for_testing_; |
123 | 134 |
124 // Used when the dialog is being closed to avoid re-entrancy into the | 135 // Used when the dialog is being closed to avoid re-entrancy into the |
125 // controller_map_. | 136 // controller_map_. |
126 bool being_closed_; | 137 bool being_closed_; |
127 | 138 |
128 DISALLOW_COPY_AND_ASSIGN(PaymentRequestDialogView); | 139 DISALLOW_COPY_AND_ASSIGN(PaymentRequestDialogView); |
129 }; | 140 }; |
130 | 141 |
131 } // namespace payments | 142 } // namespace payments |
132 | 143 |
133 #endif // CHROME_BROWSER_UI_VIEWS_PAYMENTS_PAYMENT_REQUEST_DIALOG_VIEW_H_ | 144 #endif // CHROME_BROWSER_UI_VIEWS_PAYMENTS_PAYMENT_REQUEST_DIALOG_VIEW_H_ |
OLD | NEW |