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..cbb9353de5ddf53d2c681e94f66a7b45138314cf 100644 |
--- a/chrome/browser/ui/views/payments/payment_request_dialog.cc |
+++ b/chrome/browser/ui/views/payments/payment_request_dialog.cc |
@@ -17,6 +17,16 @@ |
#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 { |
namespace { |
// This function creates an instance of a PaymentRequestSheetController |
@@ -37,17 +47,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 +70,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 +98,10 @@ void PaymentRequestDialog::ShowOrderSummary() { |
true); |
} |
+void PaymentRequestDialog::CloseDialog() { |
+ GetWidget()->Close(); |
+} |
+ |
void PaymentRequestDialog::ShowInitialPaymentSheet() { |
view_stack_.Push( |
CreateViewAndInstallController<PaymentSheetViewController>( |