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