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

Unified Diff: components/gcm_driver/crypto/gcm_key_store.cc

Issue 1701973003: Remove associated keying material when unregistering from GCM (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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
Index: components/gcm_driver/crypto/gcm_key_store.cc
diff --git a/components/gcm_driver/crypto/gcm_key_store.cc b/components/gcm_driver/crypto/gcm_key_store.cc
index 346208d0bbf3e078a02b31f0760bf105e68790a6..b21d2e563a692506c22c5071b82e76cf5fbf7da1 100644
--- a/components/gcm_driver/crypto/gcm_key_store.cc
+++ b/components/gcm_driver/crypto/gcm_key_store.cc
@@ -142,18 +142,18 @@ void GCMKeyStore::DidStoreKeys(const std::string& app_id,
callback.Run(key_pairs_[app_id], auth_secret);
}
-void GCMKeyStore::DeleteKeys(const std::string& app_id,
- const DeleteCallback& callback) {
- LazyInitialize(base::Bind(&GCMKeyStore::DeleteKeysAfterInitialize,
+void GCMKeyStore::RemoveKeys(const std::string& app_id,
+ const base::Closure& callback) {
+ LazyInitialize(base::Bind(&GCMKeyStore::RemoveKeysAfterInitialize,
weak_factory_.GetWeakPtr(), app_id, callback));
}
-void GCMKeyStore::DeleteKeysAfterInitialize(const std::string& app_id,
- const DeleteCallback& callback) {
+void GCMKeyStore::RemoveKeysAfterInitialize(const std::string& app_id,
+ const base::Closure& callback) {
DCHECK(state_ == State::INITIALIZED || state_ == State::FAILED);
const auto iter = key_pairs_.find(app_id);
if (iter == key_pairs_.end() || state_ != State::INITIALIZED) {
- callback.Run(true /* success */);
+ callback.Run();
return;
}
@@ -166,23 +166,23 @@ void GCMKeyStore::DeleteKeysAfterInitialize(const std::string& app_id,
database_->UpdateEntries(
std::move(entries_to_save), std::move(keys_to_remove),
- base::Bind(&GCMKeyStore::DidDeleteKeys, weak_factory_.GetWeakPtr(),
+ base::Bind(&GCMKeyStore::DidRemoveKeys, weak_factory_.GetWeakPtr(),
app_id, callback));
}
-void GCMKeyStore::DidDeleteKeys(const std::string& app_id,
- const DeleteCallback& callback,
+void GCMKeyStore::DidRemoveKeys(const std::string& app_id,
+ const base::Closure& callback,
bool success) {
- if (!success) {
+ // TODO(peter): Add a histogram for tracking |success|.
+
+ if (success) {
+ key_pairs_.erase(app_id);
+ auth_secrets_.erase(app_id);
+ } else {
DVLOG(1) << "Unable to delete a key from the GCM Key Store.";
- callback.Run(false /* success */);
- return;
}
- key_pairs_.erase(app_id);
- auth_secrets_.erase(app_id);
-
- callback.Run(true /* success */);
+ callback.Run();
}
void GCMKeyStore::LazyInitialize(const base::Closure& done_closure) {
« no previous file with comments | « components/gcm_driver/crypto/gcm_key_store.h ('k') | components/gcm_driver/crypto/gcm_key_store_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698