Chromium Code Reviews| 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)))); |