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

Unified Diff: chrome/browser/push_messaging/push_messaging_service_impl.cc

Issue 1243563002: Teach the GCM Driver how to decrypt incoming messages. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@gcm-push-keys
Patch Set: Created 5 years, 4 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: chrome/browser/push_messaging/push_messaging_service_impl.cc
diff --git a/chrome/browser/push_messaging/push_messaging_service_impl.cc b/chrome/browser/push_messaging/push_messaging_service_impl.cc
index 10cb6bb7a8dd628f52a99d648433fdfb95ddd44f..7b4d9dda11bd212e16234d66ccdbf0322d9abd0a 100644
--- a/chrome/browser/push_messaging/push_messaging_service_impl.cc
+++ b/chrome/browser/push_messaging/push_messaging_service_impl.cc
@@ -194,28 +194,9 @@ void PushMessagingServiceImpl::OnMessage(const std::string& app_id,
"PushMessaging.MessageReceived.Origin",
app_identifier.origin());
- // The Push API only exposes a single string of data in the push event fired
- // on the Service Worker. When developers send messages using GCM to the Push
- // API and want to include a message payload, they must pass a single key-
- // value pair, where the key is "data" and the value is the string they want
- // to be passed to their Service Worker. For example, they could send the
- // following JSON using the HTTPS GCM API:
- // {
- // "registration_ids": ["FOO", "BAR"],
- // "data": {
- // "data": "BAZ",
- // },
- // "delay_while_idle": true,
- // }
- // TODO(johnme): Make sure this is clearly documented for developers.
std::string data;
- // TODO(peter): Message payloads are disabled pending mandatory encryption.
- // https://crbug.com/449184
- if (AreMessagePayloadsEnabled()) {
- gcm::MessageData::const_iterator it = message.data.find("data");
- if (it != message.data.end())
- data = it->second;
- }
+ if (AreMessagePayloadsEnabled() && message.raw_data.size())
+ data = message.raw_data;
content::BrowserContext::DeliverPushMessage(
profile_,

Powered by Google App Engine
This is Rietveld 408576698