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

Unified Diff: chrome/browser/ui/views/payments/payment_request_dialog_view.cc

Issue 2724063002: [Payments] Add a Pay button in the Order summary screen (Closed)
Patch Set: Initial Created 3 years, 10 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/views/payments/payment_request_dialog_view.cc
diff --git a/chrome/browser/ui/views/payments/payment_request_dialog_view.cc b/chrome/browser/ui/views/payments/payment_request_dialog_view.cc
index d6a122e5ad73950e18d6ad7ab4cffd4a46c5285c..cf9f4b732ab437670505225bc6330caf070a2d6c 100644
--- a/chrome/browser/ui/views/payments/payment_request_dialog_view.cc
+++ b/chrome/browser/ui/views/payments/payment_request_dialog_view.cc
@@ -65,9 +65,12 @@ ui::ModalType PaymentRequestDialogView::GetModalType() const {
}
bool PaymentRequestDialogView::Cancel() {
- // Called when the widget is about to close. We send a message to the
- // PaymentRequest object to signal user cancellation.
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
+ // Called when the widget is about to close. We send a message to the
+ // PaymentRequest object to signal user cancellation. Before destroying the
+ // PaymentRequest object, we destroy all controllers so that they are not left
+ // alive with an invalid PaymentRequest pointer.
+ controller_map_.clear();
request_->UserCancelled();
return true;
}
@@ -140,6 +143,7 @@ void PaymentRequestDialogView::ShowDialog() {
void PaymentRequestDialogView::CloseDialog() {
// This calls PaymentRequestDialogView::Cancel() before closing.
+ // ViewHierarchyChanged() also gets called after Cancel().
GetWidget()->Close();
}

Powered by Google App Engine
This is Rietveld 408576698