| 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 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 110 | 110 |
| 111 std::vector<std::string> sender_ids; | 111 std::vector<std::string> sender_ids; |
| 112 std::string registration_id; | 112 std::string registration_id; |
| 113 }; | 113 }; |
| 114 | 114 |
| 115 // Overridden from content::NotificationObserver: | 115 // Overridden from content::NotificationObserver: |
| 116 virtual void Observe(int type, | 116 virtual void Observe(int type, |
| 117 const content::NotificationSource& source, | 117 const content::NotificationSource& source, |
| 118 const content::NotificationDetails& details) OVERRIDE; | 118 const content::NotificationDetails& details) OVERRIDE; |
| 119 | 119 |
| 120 // Checks in with GCM by creating and initializing GCMClient when the profile | 120 // Returns true if GCM is enabled for the rollout channel. |
| 121 // has been signed in. | 121 bool IsGCMChannelEnabled() const; |
| 122 void CheckIn(const std::string& username); | 122 |
| 123 // Ensures that the GCMClient is initialized and the GCM check-in is done when |
| 124 // the profile was signed in. |
| 125 void EnsureCheckedIn(); |
| 123 | 126 |
| 124 // Checks out of GCM when the profile has been signed out. This will erase | 127 // Checks out of GCM when the profile has been signed out. This will erase |
| 125 // all the cached and persisted data. | 128 // all the cached and persisted data. |
| 126 void CheckOut(); | 129 void CheckOut(); |
| 127 | 130 |
| 128 // Resets the GCMClient instance. This is called when the profile is being | 131 // Resets the GCMClient instance. This is called when the profile is being |
| 129 // destroyed. | 132 // destroyed. |
| 130 void ResetGCMClient(); | 133 void ResetGCMClient(); |
| 131 | 134 |
| 132 // Ensures that the app is ready for GCM functions and events. | 135 // Ensures that the app is ready for GCM functions and events. |
| (...skipping 15 matching lines...) Expand all Loading... |
| 148 GCMClient::Result result); | 151 GCMClient::Result result); |
| 149 void SendFinished(const std::string& app_id, | 152 void SendFinished(const std::string& app_id, |
| 150 const std::string& message_id, | 153 const std::string& message_id, |
| 151 GCMClient::Result result); | 154 GCMClient::Result result); |
| 152 void MessageReceived(const std::string& app_id, | 155 void MessageReceived(const std::string& app_id, |
| 153 GCMClient::IncomingMessage message); | 156 GCMClient::IncomingMessage message); |
| 154 void MessagesDeleted(const std::string& app_id); | 157 void MessagesDeleted(const std::string& app_id); |
| 155 void MessageSendError(const std::string& app_id, | 158 void MessageSendError(const std::string& app_id, |
| 156 const std::string& message_id, | 159 const std::string& message_id, |
| 157 GCMClient::Result result); | 160 GCMClient::Result result); |
| 158 void FinishInitializationOnUI(bool ready); | 161 void FinishInitializationOnUI(); |
| 159 void GCMClientReady(); | 162 void GCMClientReady(); |
| 160 | 163 |
| 161 // Returns the event router to fire the event for the given app. | 164 // Returns the event router to fire the event for the given app. |
| 162 GCMEventRouter* GetEventRouter(const std::string& app_id) const; | 165 GCMEventRouter* GetEventRouter(const std::string& app_id) const; |
| 163 | 166 |
| 164 // Used to persist the IDs of registered apps. | 167 // Used to persist the IDs of registered apps. |
| 165 void ReadRegisteredAppIDs(); | 168 void ReadRegisteredAppIDs(); |
| 166 void WriteRegisteredAppIDs(); | 169 void WriteRegisteredAppIDs(); |
| 167 | 170 |
| 168 // Used to persist registration info into the app's state store. | 171 // Used to persist registration info into the app's state store. |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 217 | 220 |
| 218 // Used to pass a weak pointer to the IO worker. | 221 // Used to pass a weak pointer to the IO worker. |
| 219 base::WeakPtrFactory<GCMProfileService> weak_ptr_factory_; | 222 base::WeakPtrFactory<GCMProfileService> weak_ptr_factory_; |
| 220 | 223 |
| 221 DISALLOW_COPY_AND_ASSIGN(GCMProfileService); | 224 DISALLOW_COPY_AND_ASSIGN(GCMProfileService); |
| 222 }; | 225 }; |
| 223 | 226 |
| 224 } // namespace gcm | 227 } // namespace gcm |
| 225 | 228 |
| 226 #endif // CHROME_BROWSER_SERVICES_GCM_GCM_PROFILE_SERVICE_H_ | 229 #endif // CHROME_BROWSER_SERVICES_GCM_GCM_PROFILE_SERVICE_H_ |
| OLD | NEW |