Chromium Code Reviews| 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 894 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 905 } | 905 } |
| 906 | 906 |
| 907 void GCMProfileService::MessageReceived(const std::string& app_id, | 907 void GCMProfileService::MessageReceived(const std::string& app_id, |
| 908 GCMClient::IncomingMessage message) { | 908 GCMClient::IncomingMessage message) { |
| 909 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); | 909 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); |
| 910 | 910 |
| 911 // Drop the event if signed out. | 911 // Drop the event if signed out. |
| 912 if (username_.empty()) | 912 if (username_.empty()) |
| 913 return; | 913 return; |
| 914 | 914 |
| 915 GetEventRouter(app_id)->OnMessage(app_id, message); | 915 RegistrationInfoMap::iterator info_iter = registration_info_map_.find(app_id); |
| 916 if (info_iter == registration_info_map_.end()) | |
| 917 return; | |
| 918 | |
| 919 for (std::vector<std::string>::const_iterator iter = | |
|
jianli
2014/03/05 01:33:02
nit: Please add a comment like:
// Drop the mess
fgorski
2014/03/05 19:30:22
Done.
| |
| 920 info_iter->second.sender_ids.begin(); | |
| 921 iter != info_iter->second.sender_ids.end(); | |
| 922 ++iter) { | |
| 923 if (*iter == message.sender_id) { | |
| 924 GetEventRouter(app_id)->OnMessage(app_id, message); | |
| 925 return; | |
| 926 } | |
| 927 } | |
| 916 } | 928 } |
| 917 | 929 |
| 918 void GCMProfileService::MessagesDeleted(const std::string& app_id) { | 930 void GCMProfileService::MessagesDeleted(const std::string& app_id) { |
| 919 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); | 931 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); |
| 920 | 932 |
| 921 // Drop the event if signed out. | 933 // Drop the event if signed out. |
| 922 if (username_.empty()) | 934 if (username_.empty()) |
| 923 return; | 935 return; |
| 924 | 936 |
| 925 GetEventRouter(app_id)->OnMessagesDeleted(app_id); | 937 GetEventRouter(app_id)->OnMessagesDeleted(app_id); |
| (...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1069 | 1081 |
| 1070 return true; | 1082 return true; |
| 1071 } | 1083 } |
| 1072 | 1084 |
| 1073 // static | 1085 // static |
| 1074 const char* GCMProfileService::GetPersistentRegisterKeyForTesting() { | 1086 const char* GCMProfileService::GetPersistentRegisterKeyForTesting() { |
| 1075 return kRegistrationKey; | 1087 return kRegistrationKey; |
| 1076 } | 1088 } |
| 1077 | 1089 |
| 1078 } // namespace gcm | 1090 } // namespace gcm |
| OLD | NEW |