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> |
11 | 11 |
12 #include "base/basictypes.h" | 12 #include "base/basictypes.h" |
13 #include "google_apis/gcm/base/gcm_export.h" | 13 #include "google_apis/gcm/base/gcm_export.h" |
14 #include "google_apis/gcm/monitoring/gcm_stats_recorder.h" | |
15 | 14 |
16 template <class T> class scoped_refptr; | 15 template <class T> class scoped_refptr; |
17 | 16 |
18 namespace base { | 17 namespace base { |
19 class FilePath; | 18 class FilePath; |
20 class SequencedTaskRunner; | 19 class SequencedTaskRunner; |
21 } | 20 } |
22 | 21 |
23 namespace checkin_proto { | 22 namespace checkin_proto { |
24 class ChromeBuildProto; | 23 class ChromeBuildProto; |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
88 MessageData additional_data; | 87 MessageData additional_data; |
89 Result result; | 88 Result result; |
90 }; | 89 }; |
91 | 90 |
92 // Internal states and activity statistics of a GCM client. | 91 // Internal states and activity statistics of a GCM client. |
93 struct GCM_EXPORT GCMStatistics { | 92 struct GCM_EXPORT GCMStatistics { |
94 public: | 93 public: |
95 GCMStatistics(); | 94 GCMStatistics(); |
96 ~GCMStatistics(); | 95 ~GCMStatistics(); |
97 | 96 |
98 bool is_recording; | |
99 bool gcm_client_created; | 97 bool gcm_client_created; |
100 std::string gcm_client_state; | 98 std::string gcm_client_state; |
101 bool connection_client_created; | 99 bool connection_client_created; |
102 std::string connection_state; | 100 std::string connection_state; |
103 uint64 android_id; | 101 uint64 android_id; |
104 std::vector<std::string> registered_app_ids; | |
105 int send_queue_size; | |
106 int resend_queue_size; | |
107 | |
108 std::vector<GCMStatsRecorder::SendingActivity> sending_activities; | |
109 }; | 102 }; |
110 | 103 |
111 // A delegate interface that allows the GCMClient instance to interact with | 104 // A delegate interface that allows the GCMClient instance to interact with |
112 // its caller, i.e. notifying asynchronous event. | 105 // its caller, i.e. notifying asynchronous event. |
113 class Delegate { | 106 class Delegate { |
114 public: | 107 public: |
115 // Called when the registration completed successfully or an error occurs. | 108 // Called when the registration completed successfully or an error occurs. |
116 // |app_id|: application ID. | 109 // |app_id|: application ID. |
117 // |registration_id|: non-empty if the registration completed successfully. | 110 // |registration_id|: non-empty if the registration completed successfully. |
118 // |result|: the type of the error if an error occured, success otherwise. | 111 // |result|: the type of the error if an error occured, success otherwise. |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
208 | 201 |
209 // Sends a message to a given receiver. Delegate::OnSendFinished will be | 202 // Sends a message to a given receiver. Delegate::OnSendFinished will be |
210 // called asynchronously upon completion. | 203 // called asynchronously upon completion. |
211 // |app_id|: application ID. | 204 // |app_id|: application ID. |
212 // |receiver_id|: registration ID of the receiver party. | 205 // |receiver_id|: registration ID of the receiver party. |
213 // |message|: message to be sent. | 206 // |message|: message to be sent. |
214 virtual void Send(const std::string& app_id, | 207 virtual void Send(const std::string& app_id, |
215 const std::string& receiver_id, | 208 const std::string& receiver_id, |
216 const OutgoingMessage& message) = 0; | 209 const OutgoingMessage& message) = 0; |
217 | 210 |
218 // Enables or disables internal activity recording. | |
219 virtual void SetRecording(bool recording) = 0; | |
220 | |
221 // Clear all recorded GCM activity logs. | |
222 virtual void ClearActivityLogs() = 0; | |
223 | |
224 // Gets internal states and statistics. | 211 // Gets internal states and statistics. |
225 virtual GCMStatistics GetStatistics() const = 0; | 212 virtual GCMStatistics GetStatistics() const = 0; |
226 }; | 213 }; |
227 | 214 |
228 } // namespace gcm | 215 } // namespace gcm |
229 | 216 |
230 #endif // GOOGLE_APIS_GCM_GCM_CLIENT_H_ | 217 #endif // GOOGLE_APIS_GCM_GCM_CLIENT_H_ |
OLD | NEW |