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

Unified Diff: content/browser/payments/payment_app_database.cc

Issue 2847533003: PaymentHandler: Add a key prefix to avoid key conflicts with others. (Closed)
Patch Set: PaymentHandler: Add a key prefix to avoid key conflicts with others. Created 3 years, 8 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: content/browser/payments/payment_app_database.cc
diff --git a/content/browser/payments/payment_app_database.cc b/content/browser/payments/payment_app_database.cc
index 324bdcea6e186245d97cc90fa7205c0538c12e59..a5e3994cc19e78ee8c44ab078c3bda837eebbf65 100644
--- a/content/browser/payments/payment_app_database.cc
+++ b/content/browser/payments/payment_app_database.cc
@@ -8,6 +8,7 @@
#include "base/bind.h"
#include "base/optional.h"
+#include "base/strings/stringprintf.h"
please use gerrit instead 2017/04/27 15:48:31 No longer used.
#include "content/browser/payments/payment_app.pb.h"
#include "content/browser/payments/payment_app_context_impl.h"
#include "content/browser/service_worker/service_worker_context_wrapper.h"
@@ -22,6 +23,11 @@ using ::payments::mojom::PaymentInstrument;
using ::payments::mojom::PaymentInstrumentPtr;
const char kPaymentAppManifestDataKey[] = "PaymentAppManifestData";
+const char kPaymentInstrumentKeyPrefix[] = "PaymentInstrument:";
+
+std::string CreatePaymentInstrumentKey(const std::string& instrument_key) {
+ return kPaymentInstrumentKeyPrefix + instrument_key;
+}
payments::mojom::PaymentAppManifestPtr DeserializePaymentAppManifest(
const std::string& input) {
@@ -288,7 +294,7 @@ void PaymentAppDatabase::DidFindRegistrationToDeletePaymentInstrument(
}
service_worker_context_->GetRegistrationUserData(
- registration->id(), {instrument_key},
+ registration->id(), {CreatePaymentInstrumentKey(instrument_key)},
base::Bind(&PaymentAppDatabase::DidFindPaymentInstrument,
weak_ptr_factory_.GetWeakPtr(), registration->id(),
instrument_key, base::Passed(std::move(callback))));
@@ -307,7 +313,7 @@ void PaymentAppDatabase::DidFindPaymentInstrument(
}
service_worker_context_->ClearRegistrationUserData(
- registration_id, {instrument_key},
+ registration_id, {CreatePaymentInstrumentKey(instrument_key)},
base::Bind(&PaymentAppDatabase::DidDeletePaymentInstrument,
weak_ptr_factory_.GetWeakPtr(),
base::Passed(std::move(callback))));
@@ -335,7 +341,7 @@ void PaymentAppDatabase::DidFindRegistrationToReadPaymentInstrument(
}
service_worker_context_->GetRegistrationUserData(
- registration->id(), {instrument_key},
+ registration->id(), {CreatePaymentInstrumentKey(instrument_key)},
base::Bind(&PaymentAppDatabase::DidReadPaymentInstrument,
weak_ptr_factory_.GetWeakPtr(),
base::Passed(std::move(callback))));
@@ -374,7 +380,7 @@ void PaymentAppDatabase::DidFindRegistrationToHasPaymentInstrument(
}
service_worker_context_->GetRegistrationUserData(
- registration->id(), {instrument_key},
+ registration->id(), {CreatePaymentInstrumentKey(instrument_key)},
base::Bind(&PaymentAppDatabase::DidHasPaymentInstrument,
weak_ptr_factory_.GetWeakPtr(), registration->id(),
instrument_key, base::Passed(std::move(callback))));
@@ -421,7 +427,7 @@ void PaymentAppDatabase::DidFindRegistrationToWritePaymentInstrument(
service_worker_context_->StoreRegistrationUserData(
registration->id(), registration->pattern().GetOrigin(),
- {{instrument_key, serialized}},
+ {{CreatePaymentInstrumentKey(instrument_key), serialized}},
base::Bind(&PaymentAppDatabase::DidWritePaymentInstrument,
weak_ptr_factory_.GetWeakPtr(),
base::Passed(std::move(callback))));
« 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