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

Unified Diff: google_apis/gcm/gcm_client_impl.cc

Issue 185133008: [GCM] Only allow the senders that the application is currently registered for (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Moving the comment up Created 6 years, 10 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 | « google_apis/gcm/gcm_client.h ('k') | google_apis/gcm/gcm_client_impl_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: google_apis/gcm/gcm_client_impl.cc
diff --git a/google_apis/gcm/gcm_client_impl.cc b/google_apis/gcm/gcm_client_impl.cc
index 640977afb806f28efd0624d4a181f0d7495b2a5c..8bfa624fb7cdd838fe18f2b3e99d94e3681c24dc 100644
--- a/google_apis/gcm/gcm_client_impl.cc
+++ b/google_apis/gcm/gcm_client_impl.cc
@@ -456,9 +456,13 @@ void GCMClientImpl::OnMCSError() {
}
void GCMClientImpl::HandleIncomingMessage(const gcm::MCSMessage& message) {
+ DCHECK(delegate_);
+
const mcs_proto::DataMessageStanza& data_message_stanza =
reinterpret_cast<const mcs_proto::DataMessageStanza&>(
message.GetProtobuf());
+ DCHECK_EQ(data_message_stanza.device_user_id(), kDefaultUserSerialNumber);
+
IncomingMessage incoming_message;
MessageType message_type = DATA_MESSAGE;
for (int i = 0; i < data_message_stanza.app_data_size(); ++i) {
@@ -469,14 +473,12 @@ void GCMClientImpl::HandleIncomingMessage(const gcm::MCSMessage& message) {
incoming_message.data[key] = data_message_stanza.app_data(i).value();
}
- if (data_message_stanza.has_token())
- incoming_message.collapse_key = data_message_stanza.token();
-
- DCHECK_EQ(data_message_stanza.device_user_id(), kDefaultUserSerialNumber);
- DCHECK(delegate_);
switch (message_type) {
case DATA_MESSAGE:
+ incoming_message.sender_id = data_message_stanza.from();
+ if (data_message_stanza.has_token())
+ incoming_message.collapse_key = data_message_stanza.token();
delegate_->OnMessageReceived(data_message_stanza.category(),
incoming_message);
break;
« no previous file with comments | « google_apis/gcm/gcm_client.h ('k') | google_apis/gcm/gcm_client_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698