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

Unified Diff: components/payments/payment_request.h

Issue 2649683002: [Payments] Improve the closing of the PR dialog. (Closed)
Patch Set: Initial Created 3 years, 11 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: components/payments/payment_request.h
diff --git a/components/payments/payment_request.h b/components/payments/payment_request.h
index 6c55cca9ae4910cb4377dfa08fdf5251239c8fc6..f155cdc6c46c9690b53923253b13bd9cbe57dfb5 100644
--- a/components/payments/payment_request.h
+++ b/components/payments/payment_request.h
@@ -43,12 +43,20 @@ class PaymentRequest : payments::mojom::PaymentRequest {
payments::mojom::PaymentOptionsPtr options) override;
void Show() override;
void UpdateWith(payments::mojom::PaymentDetailsPtr details) override {}
- void Abort() override {}
+ void Abort() override;
void Complete(payments::mojom::PaymentComplete result) override {}
void CanMakePayment() override {}
- void Cancel();
- void OnError();
+ // Called when the user explicitely cancelled the flow. Will send a message
+ // to the renderer which will indirectly destroy this object (through
+ // OnConnectionTerminated).
+ void UserCancelled();
+
+ // As a result of a browser-side error or renderer-initiated mojo channel
+ // closure (e.g. there was an error on the renderer side, or payment was
+ // successful), this method is called. It is responsible for cleaning up,
+ // such as possibly closing the dialog.
+ void OnConnectionTerminated();
// Returns the CurrencyFormatter instance for this PaymentRequest.
// |locale_name| should be the result of the browser's GetApplicationLocale().
@@ -84,6 +92,7 @@ class PaymentRequest : payments::mojom::PaymentRequest {
payments::mojom::PaymentDetailsPtr details_;
std::unique_ptr<CurrencyFormatter> currency_formatter_;
std::unique_ptr<autofill::AutofillProfile> profile_;
+ bool user_cancelled_dialog_;
DISALLOW_COPY_AND_ASSIGN(PaymentRequest);
};

Powered by Google App Engine
This is Rietveld 408576698