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

Unified Diff: chrome/browser/payments/payment_request_impl.cc

Issue 2568933002: [WebPayments] Desktop: Adding validation and binding checks (Closed)
Patch Set: Rebasing + Adding error handling 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/payments/payment_request_impl.cc
diff --git a/chrome/browser/payments/payment_request_impl.cc b/chrome/browser/payments/payment_request_impl.cc
index 743ab19e26bf7dad196d9ced28889fdbc322523d..b5484f1472a5a0b242d440c087b03b5319c911b1 100644
--- a/chrome/browser/payments/payment_request_impl.cc
+++ b/chrome/browser/payments/payment_request_impl.cc
@@ -8,6 +8,7 @@
#include "base/lazy_instance.h"
#include "chrome/browser/ui/browser_dialogs.h"
+#include "components/payments/payment_details_validation.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/web_contents.h"
@@ -62,10 +63,16 @@ void PaymentRequestImpl::Init(
payments::mojom::PaymentOptionsPtr options) {
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
client_ = std::move(client);
+ std::string err_msg;
+ if (!validatePaymentDetails(details, &err_msg)) {
please use gerrit instead 2017/01/05 20:11:58 Also: LOG(ERROR) << err_msg; By the way, you may
+ client_->OnError(payments::mojom::PaymentErrorReason::USER_CANCEL);
+ client_.reset();
+ }
}
void PaymentRequestImpl::Show() {
- chrome::ShowPaymentRequestDialog(this);
+ if (client_.is_bound() && binding_.is_bound())
+ chrome::ShowPaymentRequestDialog(this);
}
please use gerrit instead 2017/01/05 20:11:58 Can you do this? it should ensure that PaymentRequ
void PaymentRequestImpl::Cancel() {
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698