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

Unified Diff: components/gcm_driver/gcm_driver_desktop.cc

Issue 324913004: Skeleton GCMAppHandler for Push API (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix compile Created 6 years, 6 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/gcm_driver_desktop.cc
diff --git a/components/gcm_driver/gcm_driver_desktop.cc b/components/gcm_driver/gcm_driver_desktop.cc
index 9f6a7c2c24b7996428458929cd64b6f2869ad4ba..a1d1a77a2d6d80f8f56e39beb354c83fa3bbf6a0 100644
--- a/components/gcm_driver/gcm_driver_desktop.cc
+++ b/components/gcm_driver/gcm_driver_desktop.cc
@@ -394,7 +394,25 @@ void GCMDriverDesktop::RemoveAppHandler(const std::string& app_id) {
GCMDriver::RemoveAppHandler(app_id);
// Stops the GCM service when no app intends to consume it.
- if (app_handlers().empty())
+ if (app_handlers().empty() && wildcard_app_handlers().empty())
+ Stop();
+}
+
+void GCMDriverDesktop::AddWildcardAppHandler(GCMWildcardAppHandler* handler) {
+ DCHECK(ui_thread_->RunsTasksOnCurrentThread());
+ GCMDriver::AddWildcardAppHandler(handler);
+
+ // Ensures that the GCM service is started when there is an interest.
+ EnsureStarted();
+}
+
+void GCMDriverDesktop::RemoveWildcardAppHandler(
+ GCMWildcardAppHandler* handler) {
+ DCHECK(ui_thread_->RunsTasksOnCurrentThread());
+ GCMDriver::RemoveWildcardAppHandler(handler);
+
+ // Stops the GCM service when no app intends to consume it.
+ if (app_handlers().empty() && wildcard_app_handlers().empty())
Stop();
}
@@ -567,7 +585,7 @@ GCMClient::Result GCMDriverDesktop::EnsureStarted() {
return GCMClient::GCM_DISABLED;
// Have any app requested the service?
- if (app_handlers().empty())
+ if (app_handlers().empty() && wildcard_app_handlers().empty())
return GCMClient::UNKNOWN_ERROR;
// Is the user signed in?

Powered by Google App Engine
This is Rietveld 408576698