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

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: address comment Created 5 years, 2 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 | « chrome/browser/push_messaging/push_messaging_browsertest.cc ('k') | components/components_tests.gyp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 d1de44616f6ac2a3bd176a426bf0c6badbf43b67..82beef52a6cae031234447b15f9bac10de35dd5b 100644
--- a/chrome/browser/push_messaging/push_messaging_service_impl.cc
+++ b/chrome/browser/push_messaging/push_messaging_service_impl.cc
@@ -231,28 +231,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.decrypted)
+ data = message.raw_data;
content::BrowserContext::DeliverPushMessage(
profile_,
« no previous file with comments | « chrome/browser/push_messaging/push_messaging_browsertest.cc ('k') | components/components_tests.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698