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 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 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
174 // called asynchronously upon completion. | 186 // called asynchronously upon completion. |
175 // |app_id|: application ID. | 187 // |app_id|: application ID. |
176 // |receiver_id|: registration ID of the receiver party. | 188 // |receiver_id|: registration ID of the receiver party. |
177 // |message|: message to be sent. | 189 // |message|: message to be sent. |
178 virtual void Send(const std::string& app_id, | 190 virtual void Send(const std::string& app_id, |
179 const std::string& receiver_id, | 191 const std::string& receiver_id, |
180 const OutgoingMessage& message) = 0; | 192 const OutgoingMessage& message) = 0; |
181 | 193 |
182 // Returns true if GCM becomes ready. | 194 // Returns true if GCM becomes ready. |
183 virtual bool IsReady() const = 0; | 195 virtual bool IsReady() const = 0; |
196 | |
197 // Get internal states and statistics. | |
198 virtual void GetStatistics(GCMStatistics* stats) const = 0; | |
fgorski
2014/02/28 19:52:47
did you consider returning the stats?
e.g.
virtual
juyik
2014/03/01 00:21:57
Done. It introduces additional copy operations, bu
| |
184 }; | 199 }; |
185 | 200 |
186 } // namespace gcm | 201 } // namespace gcm |
187 | 202 |
188 #endif // GOOGLE_APIS_GCM_GCM_CLIENT_H_ | 203 #endif // GOOGLE_APIS_GCM_GCM_CLIENT_H_ |
OLD | NEW |