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

Unified Diff: google_apis/gcm/gcm_client_impl.cc

Issue 185933003: [GCM] Only allow the senders that the application is currently registered for (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebasing 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 d7e5ef8ea297d8fcd43cb64ecd0de1dee92fb7cc..e760c423f1ce4e2a56ea85b2ad7908afa89cd275 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,11 @@ 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