Chromium Code Reviews| Index: chrome/browser/ui/views/payments/payment_request_dialog.cc |
| diff --git a/chrome/browser/ui/views/payments/payment_request_dialog.cc b/chrome/browser/ui/views/payments/payment_request_dialog.cc |
| index 3f8daf32b5efc406805363a76e26f49b766fba6e..311fe05c650bdb5df790e28f9f25a30f782516b7 100644 |
| --- a/chrome/browser/ui/views/payments/payment_request_dialog.cc |
| +++ b/chrome/browser/ui/views/payments/payment_request_dialog.cc |
| @@ -17,6 +17,17 @@ |
| #include "ui/base/l10n/l10n_util.h" |
| #include "ui/views/layout/fill_layout.h" |
| +namespace chrome { |
| + |
| +void ShowPaymentRequestDialog(payments::PaymentRequestImpl* impl) { |
| + constrained_window::ShowWebModalDialogViews( |
| + new payments::PaymentRequestDialog(impl), impl->web_contents()); |
| +} |
| + |
| +} // namespace chrome |
| + |
| +namespace payments { |
| + |
|
please use gerrit instead
2017/01/04 19:17:11
nit: no blank line
anthonyvd
2017/01/05 16:45:42
Done.
|
| namespace { |
| // This function creates an instance of a PaymentRequestSheetController |
| @@ -37,17 +48,6 @@ std::unique_ptr<views::View> CreateViewAndInstallController( |
| } // namespace |
| -namespace chrome { |
| - |
| -void ShowPaymentRequestDialog(payments::PaymentRequestImpl* impl) { |
| - constrained_window::ShowWebModalDialogViews( |
| - new payments::PaymentRequestDialog(impl), impl->web_contents()); |
| -} |
| - |
| -} // namespace chrome |
| - |
| -namespace payments { |
| - |
| PaymentRequestDialog::PaymentRequestDialog(PaymentRequestImpl* impl) |
| : impl_(impl) { |
| DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
| @@ -71,6 +71,23 @@ bool PaymentRequestDialog::Cancel() { |
| return true; |
| } |
| +bool PaymentRequestDialog::ShouldShowCloseButton() const { |
| + // Don't show the normal close button on the dialog. This is because the |
| + // typical dialog header doesn't allow displaying anything other that the |
| + // title and the close button. This is insufficient for the PaymentRequest |
| + // dialog, which must sometimes show the back arrow next to the title. |
| + // Moreover, the title (and back arrow) should animate with the view they're |
| + // attached to. |
| + return false; |
| +} |
| + |
| +int PaymentRequestDialog::GetDialogButtons() const { |
| + // The buttons should animate along with the different dialog sheets since |
| + // each sheet presents a different set of buttons. Because of this, hide the |
| + // usual dialog buttons. |
| + return ui::DIALOG_BUTTON_NONE; |
| +} |
| + |
| void PaymentRequestDialog::GoBack() { |
| view_stack_.Pop(); |
| } |
| @@ -82,6 +99,10 @@ void PaymentRequestDialog::ShowOrderSummary() { |
| true); |
| } |
| +void PaymentRequestDialog::CloseDialog() { |
| + GetWidget()->Close(); |
| +} |
| + |
| void PaymentRequestDialog::ShowInitialPaymentSheet() { |
| view_stack_.Push( |
| CreateViewAndInstallController<PaymentSheetViewController>( |