| Index: chrome/browser/services/gcm/push_messaging_service_impl.cc
|
| diff --git a/chrome/browser/services/gcm/push_messaging_service_impl.cc b/chrome/browser/services/gcm/push_messaging_service_impl.cc
|
| index bb7507deb27716efd0d3fe793973dcb554627995..3adb908e8a22a0c4aba021b90369daf1f46d369e 100644
|
| --- a/chrome/browser/services/gcm/push_messaging_service_impl.cc
|
| +++ b/chrome/browser/services/gcm/push_messaging_service_impl.cc
|
| @@ -21,6 +21,7 @@
|
| #include "components/gcm_driver/gcm_driver.h"
|
| #include "components/pref_registry/pref_registry_syncable.h"
|
| #include "content/public/browser/push_messaging_application_id.h"
|
| +#include "content/public/browser/push_messaging_router.h"
|
| #include "content/public/browser/render_frame_host.h"
|
| #include "content/public/browser/web_contents.h"
|
|
|
| @@ -72,6 +73,7 @@ PushMessagingServiceImpl::PushMessagingServiceImpl(
|
| Profile* profile)
|
| : gcm_profile_service_(gcm_profile_service),
|
| profile_(profile),
|
| + push_messaging_router_(content::PushMessagingRouter::Create(profile)),
|
| weak_factory_(this) {
|
| }
|
|
|
| @@ -109,9 +111,14 @@ void PushMessagingServiceImpl::OnMessage(
|
| DCHECK(application_id.IsValid());
|
| GCMClient::MessageData::const_iterator it = message.data.find("data");
|
| if (application_id.IsValid() && it != message.data.end()) {
|
| - const std::string& data ALLOW_UNUSED = it->second;
|
| - // TODO(mvanouwerkerk): Fire push event with data on the Service Worker
|
| - // corresponding to app_id (and remove ALLOW_UNUSED above).
|
| + const std::string& data = it->second;
|
| + push_messaging_router_->DeliverMessage(
|
| + application_id,
|
| + data,
|
| + base::Bind(&PushMessagingServiceImpl::DeliverMessageCallback,
|
| + weak_factory_.GetWeakPtr(),
|
| + application_id,
|
| + message));
|
| } else {
|
| // Drop the message, as it is invalid.
|
| // TODO(mvanouwerkerk): Show a warning in the developer console of the
|
| @@ -121,6 +128,14 @@ void PushMessagingServiceImpl::OnMessage(
|
| }
|
| }
|
|
|
| +void PushMessagingServiceImpl::DeliverMessageCallback(
|
| + const content::PushMessagingApplicationId& application_id,
|
| + const GCMClient::IncomingMessage& message,
|
| + content::PushMessagingStatus status) {
|
| + // TODO(mvanouwerkerk): UMA logging.
|
| + // TODO(mvanouwerkerk): Is there a way to recover from failure?
|
| +}
|
| +
|
| void PushMessagingServiceImpl::OnMessagesDeleted(const std::string& app_id) {
|
| // TODO(mvanouwerkerk): Fire push error event on the Service Worker
|
| // corresponding to app_id.
|
|
|