| 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 #ifndef CHROME_BROWSER_SERVICES_GCM_GCM_PROFILE_SERVICE_H_ | 5 #ifndef CHROME_BROWSER_SERVICES_GCM_GCM_PROFILE_SERVICE_H_ |
| 6 #define CHROME_BROWSER_SERVICES_GCM_GCM_PROFILE_SERVICE_H_ | 6 #define CHROME_BROWSER_SERVICES_GCM_GCM_PROFILE_SERVICE_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 153 void MessageReceived(const std::string& app_id, | 153 void MessageReceived(const std::string& app_id, |
| 154 GCMClient::IncomingMessage message); | 154 GCMClient::IncomingMessage message); |
| 155 void MessagesDeleted(const std::string& app_id); | 155 void MessagesDeleted(const std::string& app_id); |
| 156 void MessageSendError(const std::string& app_id, | 156 void MessageSendError(const std::string& app_id, |
| 157 const std::string& message_id, | 157 const std::string& message_id, |
| 158 GCMClient::Result result); | 158 GCMClient::Result result); |
| 159 void CheckGCMClientLoadingFinished(bool is_loading); | 159 void CheckGCMClientLoadingFinished(bool is_loading); |
| 160 void GCMClientLoadingFinished(); | 160 void GCMClientLoadingFinished(); |
| 161 | 161 |
| 162 // Returns the event router to fire the event for the given app. | 162 // Returns the event router to fire the event for the given app. |
| 163 GCMEventRouter* GetEventRouter(const std::string& app_id); | 163 GCMEventRouter* GetEventRouter(const std::string& app_id) const; |
| 164 | 164 |
| 165 // Used to persist registration info into the app's state store. | 165 // Used to persist registration info into the app's state store. |
| 166 void DeleteRegistrationInfo(const std::string& app_id); | 166 void DeleteRegistrationInfo(const std::string& app_id); |
| 167 void WriteRegistrationInfo(const std::string& app_id); | 167 void WriteRegistrationInfo(const std::string& app_id); |
| 168 void ReadRegistrationInfo(const std::string& app_id); | 168 void ReadRegistrationInfo(const std::string& app_id); |
| 169 void ReadRegistrationInfoFinished(const std::string& app_id, | 169 void ReadRegistrationInfoFinished(const std::string& app_id, |
| 170 scoped_ptr<base::Value> value); | 170 scoped_ptr<base::Value> value); |
| 171 bool ParsePersistedRegistrationInfo(scoped_ptr<base::Value> value, | 171 bool ParsePersistedRegistrationInfo(scoped_ptr<base::Value> value, |
| 172 RegistrationInfo* registration_info); | 172 RegistrationInfo* registration_info); |
| 173 | 173 |
| (...skipping 25 matching lines...) Expand all Loading... |
| 199 std::map<std::string, RegisterCallback> register_callbacks_; | 199 std::map<std::string, RegisterCallback> register_callbacks_; |
| 200 | 200 |
| 201 // Callback map (from <app_id, message_id> to callback) for Send. | 201 // Callback map (from <app_id, message_id> to callback) for Send. |
| 202 std::map<std::pair<std::string, std::string>, SendCallback> send_callbacks_; | 202 std::map<std::pair<std::string, std::string>, SendCallback> send_callbacks_; |
| 203 | 203 |
| 204 // Map from app_id to registration info (sender ids & registration ID). | 204 // Map from app_id to registration info (sender ids & registration ID). |
| 205 typedef std::map<std::string, RegistrationInfo> RegistrationInfoMap; | 205 typedef std::map<std::string, RegistrationInfo> RegistrationInfoMap; |
| 206 RegistrationInfoMap registration_info_map_; | 206 RegistrationInfoMap registration_info_map_; |
| 207 | 207 |
| 208 // Event router to talk with JS API. | 208 // Event router to talk with JS API. |
| 209 #if !defined(OS_ANDROID) |
| 209 scoped_ptr<GCMEventRouter> js_event_router_; | 210 scoped_ptr<GCMEventRouter> js_event_router_; |
| 211 #endif |
| 210 | 212 |
| 211 // For testing purpose. | 213 // For testing purpose. |
| 212 TestingDelegate* testing_delegate_; | 214 TestingDelegate* testing_delegate_; |
| 213 | 215 |
| 214 // Used to pass a weak pointer to the IO worker. | 216 // Used to pass a weak pointer to the IO worker. |
| 215 base::WeakPtrFactory<GCMProfileService> weak_ptr_factory_; | 217 base::WeakPtrFactory<GCMProfileService> weak_ptr_factory_; |
| 216 | 218 |
| 217 DISALLOW_COPY_AND_ASSIGN(GCMProfileService); | 219 DISALLOW_COPY_AND_ASSIGN(GCMProfileService); |
| 218 }; | 220 }; |
| 219 | 221 |
| 220 } // namespace gcm | 222 } // namespace gcm |
| 221 | 223 |
| 222 #endif // CHROME_BROWSER_SERVICES_GCM_GCM_PROFILE_SERVICE_H_ | 224 #endif // CHROME_BROWSER_SERVICES_GCM_GCM_PROFILE_SERVICE_H_ |
| OLD | NEW |