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

Unified Diff: chrome/browser/extensions/extension_gcm_app_handler.cc

Issue 913943002: Unregister from GCM when the only GCM app is removed (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix test Created 5 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 | « no previous file | chrome/browser/extensions/extension_gcm_app_handler_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/extensions/extension_gcm_app_handler.cc
diff --git a/chrome/browser/extensions/extension_gcm_app_handler.cc b/chrome/browser/extensions/extension_gcm_app_handler.cc
index 92cec5e6db5ecfd81d1ca91e911fe3d05bb662cb..6a9f27538590fcbe1d3e37fd02c11e1cf78d389b 100644
--- a/chrome/browser/extensions/extension_gcm_app_handler.cc
+++ b/chrome/browser/extensions/extension_gcm_app_handler.cc
@@ -124,7 +124,11 @@ void ExtensionGCMAppHandler::OnExtensionUnloaded(
weak_factory_.GetWeakPtr()));
}
- RemoveAppHandler(extension->id());
+ // When the extention is being uninstalled, it will be unloaded first. We
+ // should not remove the app handler in this case and it will be handled
+ // in OnExtensionUninstalled.
+ if (reason != UnloadedExtensionInfo::REASON_UNINSTALL)
+ RemoveAppHandler(extension->id());
}
void ExtensionGCMAppHandler::OnExtensionUninstalled(
@@ -137,7 +141,6 @@ void ExtensionGCMAppHandler::OnExtensionUninstalled(
base::Bind(&ExtensionGCMAppHandler::OnUnregisterCompleted,
weak_factory_.GetWeakPtr(),
extension->id()));
- RemoveAppHandler(extension->id());
}
}
@@ -155,7 +158,7 @@ gcm::GCMDriver* ExtensionGCMAppHandler::GetGCMDriver() const {
void ExtensionGCMAppHandler::OnUnregisterCompleted(
const std::string& app_id, gcm::GCMClient::Result result) {
- // Nothing to do.
+ RemoveAppHandler(app_id);
}
void ExtensionGCMAppHandler::AddAppHandler(const std::string& app_id) {
« no previous file with comments | « no previous file | chrome/browser/extensions/extension_gcm_app_handler_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698