Index: google_apis/gcm/public/gcm_types.h |
diff --git a/google_apis/gcm/public/gcm_types.h b/google_apis/gcm/public/gcm_types.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..211393d851802d8118cfe507bc3df2fcfb77034b |
--- /dev/null |
+++ b/google_apis/gcm/public/gcm_types.h |
@@ -0,0 +1,72 @@ |
+// Copyright 2014 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#ifndef GOOGLE_APIS_GCM_PUBLIC_GCM_TYPES_H_ |
+#define GOOGLE_APIS_GCM_PUBLIC_GCM_TYPES_H_ |
+ |
+#include <map> |
+#include <string> |
+ |
+#include "google_apis/gcm/base/gcm_export.h" |
+ |
+namespace gcm { |
+ |
+enum Result { |
+ // Successful operation. |
+ RESULT_SUCCESS, |
+ // Invalid parameter. |
+ RESULT_INVALID_PARAMETER, |
+ // Profile not signed in. |
+ RESULT_NOT_SIGNED_IN, |
+ // Previous asynchronous operation is still pending to finish. Certain |
+ // operation, like register, is only allowed one at a time. |
+ RESULT_ASYNC_OPERATION_PENDING, |
+ // Network socket error. |
+ RESULT_NETWORK_ERROR, |
+ // Problem at the server. |
+ RESULT_SERVER_ERROR, |
+ // Exceeded the specified TTL during message sending. |
+ RESULT_TTL_EXCEEDED, |
+ // Other errors. |
+ RESULT_UNKNOWN_ERROR |
+}; |
+ |
+// Message data consisting of key-value pairs. |
+typedef std::map<std::string, std::string> MessageData; |
+ |
+// Message to be delivered to the other party. |
+struct GCM_EXPORT OutgoingMessage { |
+ OutgoingMessage(); |
+ ~OutgoingMessage(); |
+ |
+ // Message ID. |
+ std::string id; |
+ // In seconds. |
+ int time_to_live; |
+ MessageData data; |
+}; |
+ |
+// Message being received from the other party. |
+struct GCM_EXPORT IncomingMessage { |
+ IncomingMessage(); |
+ ~IncomingMessage(); |
+ |
+ MessageData data; |
+ std::string collapse_key; |
+ std::string sender_id; |
+}; |
+ |
+// Detailed information of the Send Error event. |
+struct GCM_EXPORT SendErrorDetails { |
+ SendErrorDetails(); |
+ ~SendErrorDetails(); |
+ |
+ std::string message_id; |
+ MessageData additional_data; |
+ Result result; |
+}; |
+ |
+} // namespace gcm |
+ |
+#endif // GOOGLE_APIS_GCM_PUBLIC_GCM_TYPES_H_ |