| 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?
|
|
|