OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/browser/services/gcm/gcm_profile_service.h" | 5 #include "chrome/browser/services/gcm/gcm_profile_service.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/base64.h" | 10 #include "base/base64.h" |
(...skipping 888 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
899 } | 899 } |
900 | 900 |
901 void GCMProfileService::MessageReceived(const std::string& app_id, | 901 void GCMProfileService::MessageReceived(const std::string& app_id, |
902 GCMClient::IncomingMessage message) { | 902 GCMClient::IncomingMessage message) { |
903 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); | 903 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); |
904 | 904 |
905 // Drop the event if signed out. | 905 // Drop the event if signed out. |
906 if (username_.empty()) | 906 if (username_.empty()) |
907 return; | 907 return; |
908 | 908 |
| 909 RegistrationInfoMap::iterator iter = registration_info_map_.find(app_id); |
| 910 if (iter == registration_info_map_.end() || |
| 911 iter->second.sender_id != message.sender_id) { |
| 912 return; |
| 913 } |
| 914 |
909 GetEventRouter(app_id)->OnMessage(app_id, message); | 915 GetEventRouter(app_id)->OnMessage(app_id, message); |
910 } | 916 } |
911 | 917 |
912 void GCMProfileService::MessagesDeleted(const std::string& app_id) { | 918 void GCMProfileService::MessagesDeleted(const std::string& app_id) { |
913 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); | 919 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); |
914 | 920 |
915 // Drop the event if signed out. | 921 // Drop the event if signed out. |
916 if (username_.empty()) | 922 if (username_.empty()) |
917 return; | 923 return; |
918 | 924 |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1054 // allowed. | 1060 // allowed. |
1055 return false; | 1061 return false; |
1056 } | 1062 } |
1057 | 1063 |
1058 // static | 1064 // static |
1059 const char* GCMProfileService::GetPersistentRegisterKeyForTesting() { | 1065 const char* GCMProfileService::GetPersistentRegisterKeyForTesting() { |
1060 return kRegistrationKey; | 1066 return kRegistrationKey; |
1061 } | 1067 } |
1062 | 1068 |
1063 } // namespace gcm | 1069 } // namespace gcm |
OLD | NEW |