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

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..d59277459d731f3e0ed8395c5e28f157b4816990 100644
--- a/content/browser/payments/payment_app_database.cc
+++ b/content/browser/payments/payment_app_database.cc
@@ -22,6 +22,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 +293,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 +312,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 +340,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 +379,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 +426,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