| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 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 GOOGLE_APIS_GCM_GCM_CLIENT_H_ | 5 #ifndef GOOGLE_APIS_GCM_GCM_CLIENT_H_ |
| 6 #define GOOGLE_APIS_GCM_GCM_CLIENT_H_ | 6 #define GOOGLE_APIS_GCM_GCM_CLIENT_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 22 matching lines...) Expand all Loading... |
| 33 // Messaging server. This interface is not supposed to be thread-safe. | 33 // Messaging server. This interface is not supposed to be thread-safe. |
| 34 class GCM_EXPORT GCMClient { | 34 class GCM_EXPORT GCMClient { |
| 35 public: | 35 public: |
| 36 enum Result { | 36 enum Result { |
| 37 // Successful operation. | 37 // Successful operation. |
| 38 SUCCESS, | 38 SUCCESS, |
| 39 // Invalid parameter. | 39 // Invalid parameter. |
| 40 INVALID_PARAMETER, | 40 INVALID_PARAMETER, |
| 41 // Profile not signed in. | 41 // Profile not signed in. |
| 42 NOT_SIGNED_IN, | 42 NOT_SIGNED_IN, |
| 43 // Certificate was missing. Certain operation, like register, requires it. | |
| 44 CERTIFICATE_MISSING, | |
| 45 // Previous asynchronous operation is still pending to finish. Certain | 43 // Previous asynchronous operation is still pending to finish. Certain |
| 46 // operation, like register, is only allowed one at a time. | 44 // operation, like register, is only allowed one at a time. |
| 47 ASYNC_OPERATION_PENDING, | 45 ASYNC_OPERATION_PENDING, |
| 48 // Network socket error. | 46 // Network socket error. |
| 49 NETWORK_ERROR, | 47 NETWORK_ERROR, |
| 50 // Problem at the server. | 48 // Problem at the server. |
| 51 SERVER_ERROR, | 49 SERVER_ERROR, |
| 52 // Exceeded the specified TTL during message sending. | 50 // Exceeded the specified TTL during message sending. |
| 53 TTL_EXCEEDED, | 51 TTL_EXCEEDED, |
| 54 // Other errors. | 52 // Other errors. |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 154 // the check-in if the check-in info is not found in the store. | 152 // the check-in if the check-in info is not found in the store. |
| 155 virtual void Load() = 0; | 153 virtual void Load() = 0; |
| 156 | 154 |
| 157 // Checks out of the GCM service. This will erase all the cached and persisted | 155 // Checks out of the GCM service. This will erase all the cached and persisted |
| 158 // data. | 156 // data. |
| 159 virtual void CheckOut() = 0; | 157 virtual void CheckOut() = 0; |
| 160 | 158 |
| 161 // Registers the application for GCM. Delegate::OnRegisterFinished will be | 159 // Registers the application for GCM. Delegate::OnRegisterFinished will be |
| 162 // called asynchronously upon completion. | 160 // called asynchronously upon completion. |
| 163 // |app_id|: application ID. | 161 // |app_id|: application ID. |
| 164 // |cert|: SHA-1 of public key of the application, in base16 format. | |
| 165 // |sender_ids|: list of IDs of the servers that are allowed to send the | 162 // |sender_ids|: list of IDs of the servers that are allowed to send the |
| 166 // messages to the application. These IDs are assigned by the | 163 // messages to the application. These IDs are assigned by the |
| 167 // Google API Console. | 164 // Google API Console. |
| 168 virtual void Register(const std::string& app_id, | 165 virtual void Register(const std::string& app_id, |
| 169 const std::string& cert, | |
| 170 const std::vector<std::string>& sender_ids) = 0; | 166 const std::vector<std::string>& sender_ids) = 0; |
| 171 | 167 |
| 172 // Unregisters the application from GCM when it is uninstalled. | 168 // Unregisters the application from GCM when it is uninstalled. |
| 173 // Delegate::OnUnregisterFinished will be called asynchronously upon | 169 // Delegate::OnUnregisterFinished will be called asynchronously upon |
| 174 // completion. | 170 // completion. |
| 175 // |app_id|: application ID. | 171 // |app_id|: application ID. |
| 176 virtual void Unregister(const std::string& app_id) = 0; | 172 virtual void Unregister(const std::string& app_id) = 0; |
| 177 | 173 |
| 178 // Sends a message to a given receiver. Delegate::OnSendFinished will be | 174 // Sends a message to a given receiver. Delegate::OnSendFinished will be |
| 179 // called asynchronously upon completion. | 175 // called asynchronously upon completion. |
| 180 // |app_id|: application ID. | 176 // |app_id|: application ID. |
| 181 // |receiver_id|: registration ID of the receiver party. | 177 // |receiver_id|: registration ID of the receiver party. |
| 182 // |message|: message to be sent. | 178 // |message|: message to be sent. |
| 183 virtual void Send(const std::string& app_id, | 179 virtual void Send(const std::string& app_id, |
| 184 const std::string& receiver_id, | 180 const std::string& receiver_id, |
| 185 const OutgoingMessage& message) = 0; | 181 const OutgoingMessage& message) = 0; |
| 186 }; | 182 }; |
| 187 | 183 |
| 188 } // namespace gcm | 184 } // namespace gcm |
| 189 | 185 |
| 190 #endif // GOOGLE_APIS_GCM_GCM_CLIENT_H_ | 186 #endif // GOOGLE_APIS_GCM_GCM_CLIENT_H_ |
| OLD | NEW |