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 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
71 }; | 71 }; |
72 | 72 |
73 // Message being received from the other party. | 73 // Message being received from the other party. |
74 struct GCM_EXPORT IncomingMessage { | 74 struct GCM_EXPORT IncomingMessage { |
75 IncomingMessage(); | 75 IncomingMessage(); |
76 ~IncomingMessage(); | 76 ~IncomingMessage(); |
77 | 77 |
78 MessageData data; | 78 MessageData data; |
79 }; | 79 }; |
80 | 80 |
81 // Internal states and activity statistics of a GCM client. | |
82 struct GCM_EXPORT GCMStatistics { | |
83 public: | |
84 GCMStatistics(); | |
85 ~GCMStatistics(); | |
86 | |
87 bool gcm_client_created; | |
88 std::string gcm_client_state; | |
89 bool connection_client_created; | |
90 std::string connection_state; | |
91 }; | |
92 | |
81 // A delegate interface that allows the GCMClient instance to interact with | 93 // A delegate interface that allows the GCMClient instance to interact with |
82 // its caller, i.e. notifying asynchronous event. | 94 // its caller, i.e. notifying asynchronous event. |
83 class Delegate { | 95 class Delegate { |
84 public: | 96 public: |
85 // Called when the registration completed successfully or an error occurs. | 97 // Called when the registration completed successfully or an error occurs. |
86 // |app_id|: application ID. | 98 // |app_id|: application ID. |
87 // |registration_id|: non-empty if the registration completed successfully. | 99 // |registration_id|: non-empty if the registration completed successfully. |
88 // |result|: the type of the error if an error occured, success otherwise. | 100 // |result|: the type of the error if an error occured, success otherwise. |
89 virtual void OnRegisterFinished(const std::string& app_id, | 101 virtual void OnRegisterFinished(const std::string& app_id, |
90 const std::string& registration_id, | 102 const std::string& registration_id, |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
176 virtual void Unregister(const std::string& app_id) = 0; | 188 virtual void Unregister(const std::string& app_id) = 0; |
177 | 189 |
178 // Sends a message to a given receiver. Delegate::OnSendFinished will be | 190 // Sends a message to a given receiver. Delegate::OnSendFinished will be |
179 // called asynchronously upon completion. | 191 // called asynchronously upon completion. |
180 // |app_id|: application ID. | 192 // |app_id|: application ID. |
181 // |receiver_id|: registration ID of the receiver party. | 193 // |receiver_id|: registration ID of the receiver party. |
182 // |message|: message to be sent. | 194 // |message|: message to be sent. |
183 virtual void Send(const std::string& app_id, | 195 virtual void Send(const std::string& app_id, |
184 const std::string& receiver_id, | 196 const std::string& receiver_id, |
185 const OutgoingMessage& message) = 0; | 197 const OutgoingMessage& message) = 0; |
198 | |
199 // Get internal states and statistics. | |
jianli
2014/03/04 23:47:39
nit: Gets
juyik
2014/03/05 05:08:08
Done.
| |
200 virtual GCMStatistics GetStatistics() const = 0; | |
186 }; | 201 }; |
187 | 202 |
188 } // namespace gcm | 203 } // namespace gcm |
189 | 204 |
190 #endif // GOOGLE_APIS_GCM_GCM_CLIENT_H_ | 205 #endif // GOOGLE_APIS_GCM_GCM_CLIENT_H_ |
OLD | NEW |