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

Unified Diff: components/payments/content/payment_request.cc

Issue 2713033004: Layered component for web payments (Closed)
Patch Set: Rebase 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
« no previous file with comments | « components/payments/content/payment_request.h ('k') | components/payments/content/payment_request.mojom » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/payments/content/payment_request.cc
diff --git a/components/payments/payment_request.cc b/components/payments/content/payment_request.cc
similarity index 93%
rename from components/payments/payment_request.cc
rename to components/payments/content/payment_request.cc
index 7dda081e0a79f506d87998cf2ee943651a302b27..0a83cf2c5afd7ef3d4b6ffe48c37e57d90770c37 100644
--- a/components/payments/payment_request.cc
+++ b/components/payments/content/payment_request.cc
@@ -2,25 +2,21 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "components/payments/payment_request.h"
+#include "components/payments/content/payment_request.h"
+
+#include <unordered_map>
+#include <utility>
#include "base/memory/ptr_util.h"
-#include "components/payments/payment_details_validation.h"
-#include "components/payments/payment_request_web_contents_manager.h"
+#include "components/autofill/core/browser/personal_data_manager.h"
+#include "components/payments/content/payment_details_validation.h"
+#include "components/payments/content/payment_request_web_contents_manager.h"
+#include "components/payments/core/currency_formatter.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/web_contents.h"
-using payments::mojom::BasicCardNetwork;
-
namespace payments {
-namespace {
-
-// Identifier for the basic card payment method in the PaymentMethodData.
-const char* const kBasicCardMethodName = "basic-card";
-
-} // namespace
-
PaymentRequest::PaymentRequest(
content::WebContents* web_contents,
std::unique_ptr<PaymentRequestDelegate> delegate,
@@ -40,7 +36,6 @@ PaymentRequest::PaymentRequest(
// set_connection_error_with_reason_handler with Binding::CloseWithReason.
binding_.set_connection_error_handler(base::Bind(
&PaymentRequest::OnConnectionTerminated, base::Unretained(this)));
-
}
PaymentRequest::~PaymentRequest() {}
@@ -120,12 +115,12 @@ CurrencyFormatter* PaymentRequest::GetOrCreateCurrencyFormatter(
}
const std::vector<autofill::AutofillProfile*>&
- PaymentRequest::shipping_profiles() {
+PaymentRequest::shipping_profiles() {
return shipping_profiles_;
}
const std::vector<autofill::AutofillProfile*>&
- PaymentRequest::contact_profiles() {
+PaymentRequest::contact_profiles() {
return contact_profiles_;
}
@@ -180,6 +175,8 @@ void PaymentRequest::PopulateValidatedMethodData(
return;
}
+ // Identifier for the basic card payment method in the PaymentMethodData.
+ const char* const kBasicCardMethodName = "basic-card";
std::set<std::string> card_networks{"amex", "diners", "discover",
"jcb", "mastercard", "mir",
"unionpay", "visa"};
@@ -218,6 +215,7 @@ void PaymentRequest::PopulateValidatedMethodData(
} else {
// The merchant has specified a few basic card supported networks. Use
// the mapping to transform to known basic-card types.
+ using ::payments::mojom::BasicCardNetwork;
std::unordered_map<BasicCardNetwork, std::string> networks = {
{BasicCardNetwork::AMEX, "amex"},
{BasicCardNetwork::DINERS, "diners"},
« no previous file with comments | « components/payments/content/payment_request.h ('k') | components/payments/content/payment_request.mojom » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698