| 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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 public: | 43 public: |
| 44 typedef base::Callback<void(const std::string& registration_id, | 44 typedef base::Callback<void(const std::string& registration_id, |
| 45 GCMClient::Result result)> RegisterCallback; | 45 GCMClient::Result result)> RegisterCallback; |
| 46 typedef base::Callback<void(const std::string& message_id, | 46 typedef base::Callback<void(const std::string& message_id, |
| 47 GCMClient::Result result)> SendCallback; | 47 GCMClient::Result result)> SendCallback; |
| 48 | 48 |
| 49 // For testing purpose. | 49 // For testing purpose. |
| 50 class TestingDelegate { | 50 class TestingDelegate { |
| 51 public: | 51 public: |
| 52 virtual GCMEventRouter* GetEventRouter() const = 0; | 52 virtual GCMEventRouter* GetEventRouter() const = 0; |
| 53 virtual void CheckInFinished(const GCMClient::CheckInInfo& checkin_info, | 53 virtual void CheckInFinished(const GCMClient::CheckinInfo& checkin_info, |
| 54 GCMClient::Result result) = 0; | 54 GCMClient::Result result) = 0; |
| 55 }; | 55 }; |
| 56 | 56 |
| 57 // Returns true if the GCM support is enabled. | 57 // Returns true if the GCM support is enabled. |
| 58 static bool IsGCMEnabled(); | 58 static bool IsGCMEnabled(); |
| 59 | 59 |
| 60 // Register profile-specific prefs for GCM. | 60 // Register profile-specific prefs for GCM. |
| 61 static void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry); | 61 static void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry); |
| 62 | 62 |
| 63 explicit GCMProfileService(Profile* profile); | 63 explicit GCMProfileService(Profile* profile); |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 133 | 133 |
| 134 void DoRegister(const std::string& app_id, | 134 void DoRegister(const std::string& app_id, |
| 135 const std::vector<std::string>& sender_ids, | 135 const std::vector<std::string>& sender_ids, |
| 136 const std::string& cert, | 136 const std::string& cert, |
| 137 RegisterCallback callback); | 137 RegisterCallback callback); |
| 138 void DoSend(const std::string& app_id, | 138 void DoSend(const std::string& app_id, |
| 139 const std::string& receiver_id, | 139 const std::string& receiver_id, |
| 140 const GCMClient::OutgoingMessage& message); | 140 const GCMClient::OutgoingMessage& message); |
| 141 | 141 |
| 142 // Callbacks posted from IO thread to UI thread. | 142 // Callbacks posted from IO thread to UI thread. |
| 143 void CheckInFinished(GCMClient::CheckInInfo checkin_info, | 143 // TODO(fgorski): Update parameters to be passed by const ref. |
| 144 void CheckInFinished(GCMClient::CheckinInfo checkin_info, |
| 144 GCMClient::Result result); | 145 GCMClient::Result result); |
| 145 void RegisterFinished(std::string app_id, | 146 void RegisterFinished(std::string app_id, |
| 146 std::string registration_id, | 147 std::string registration_id, |
| 147 GCMClient::Result result); | 148 GCMClient::Result result); |
| 148 void SendFinished(std::string app_id, | 149 void SendFinished(std::string app_id, |
| 149 std::string message_id, | 150 std::string message_id, |
| 150 GCMClient::Result result); | 151 GCMClient::Result result); |
| 151 void MessageReceived(std::string app_id, | 152 void MessageReceived(std::string app_id, |
| 152 GCMClient::IncomingMessage message); | 153 GCMClient::IncomingMessage message); |
| 153 void MessagesDeleted(std::string app_id); | 154 void MessagesDeleted(std::string app_id); |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 204 | 205 |
| 205 // Used to pass a weak pointer to the IO worker. | 206 // Used to pass a weak pointer to the IO worker. |
| 206 base::WeakPtrFactory<GCMProfileService> weak_ptr_factory_; | 207 base::WeakPtrFactory<GCMProfileService> weak_ptr_factory_; |
| 207 | 208 |
| 208 DISALLOW_COPY_AND_ASSIGN(GCMProfileService); | 209 DISALLOW_COPY_AND_ASSIGN(GCMProfileService); |
| 209 }; | 210 }; |
| 210 | 211 |
| 211 } // namespace gcm | 212 } // namespace gcm |
| 212 | 213 |
| 213 #endif // CHROME_BROWSER_SERVICES_GCM_GCM_PROFILE_SERVICE_H_ | 214 #endif // CHROME_BROWSER_SERVICES_GCM_GCM_PROFILE_SERVICE_H_ |
| OLD | NEW |