Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(801)

Side by Side Diff: components/gcm_driver/gcm_client.h

Issue 2578583002: Provide a mechanism for the GCM driver to send message receipts to GCM.
Patch Set: Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 COMPONENTS_GCM_DRIVER_GCM_CLIENT_H_ 5 #ifndef COMPONENTS_GCM_DRIVER_GCM_CLIENT_H_
6 #define COMPONENTS_GCM_DRIVER_GCM_CLIENT_H_ 6 #define COMPONENTS_GCM_DRIVER_GCM_CLIENT_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <map> 10 #include <map>
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 // Network socket error. 64 // Network socket error.
65 NETWORK_ERROR, 65 NETWORK_ERROR,
66 // Problem at the server. 66 // Problem at the server.
67 SERVER_ERROR, 67 SERVER_ERROR,
68 // Exceeded the specified TTL during message sending. 68 // Exceeded the specified TTL during message sending.
69 TTL_EXCEEDED, 69 TTL_EXCEEDED,
70 // Other errors. 70 // Other errors.
71 UNKNOWN_ERROR 71 UNKNOWN_ERROR
72 }; 72 };
73 73
74 // Enumeration to be used for describing the final status of a GCM message.
75 enum GCMMessageStatus {
Peter Beverloo 2016/12/15 19:24:24 Let's move this to its own file. It's not clear to
harkness 2016/12/21 17:23:37 currently still in the GCMClient, but I'm planning
76 // 0 reserved for success.
77 GCM_SUCCESS = 0,
78
79 // 1 - 99 reserved for GCMClient and GCMDriver error status.
Peter Beverloo 2016/12/15 19:24:24 nit: Let's make sure that we pull this separate fr
harkness 2016/12/21 17:23:37 Done.
80 GCM_INVALID_SUBTYPE = 1,
81 GCM_ENCRYPTION_FAILURE = 2,
82 GCM_UNKNOWN_MESSAGE_TYPE = 3,
83 GCM_NO_APP_HANDLER = 4,
84 GCM_INVALID_MESSAGE_TAG = 5,
85 };
86
74 enum ChromePlatform { 87 enum ChromePlatform {
75 PLATFORM_WIN, 88 PLATFORM_WIN,
76 PLATFORM_MAC, 89 PLATFORM_MAC,
77 PLATFORM_LINUX, 90 PLATFORM_LINUX,
78 PLATFORM_CROS, 91 PLATFORM_CROS,
79 PLATFORM_IOS, 92 PLATFORM_IOS,
80 PLATFORM_ANDROID, 93 PLATFORM_ANDROID,
81 PLATFORM_UNKNOWN 94 PLATFORM_UNKNOWN
82 }; 95 };
83 96
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
169 virtual void OnSendFinished(const std::string& app_id, 182 virtual void OnSendFinished(const std::string& app_id,
170 const std::string& message_id, 183 const std::string& message_id,
171 Result result) = 0; 184 Result result) = 0;
172 185
173 // Called when a message has been received. 186 // Called when a message has been received.
174 // |app_id|: application ID. 187 // |app_id|: application ID.
175 // |message|: message received. 188 // |message|: message received.
176 virtual void OnMessageReceived(const std::string& app_id, 189 virtual void OnMessageReceived(const std::string& app_id,
177 const IncomingMessage& message) = 0; 190 const IncomingMessage& message) = 0;
178 191
192 // Called when there is an error processing a received message.
193 // |app_id|: application ID.
194 // |message_id|: id of the message received.
195 // |status|: error type.
196 virtual void OnMessageReceivedError(const std::string& app_id,
197 const std::string& message_id,
198 int status) = 0;
199
179 // Called when some messages have been deleted from the server. 200 // Called when some messages have been deleted from the server.
180 // |app_id|: application ID. 201 // |app_id|: application ID.
181 virtual void OnMessagesDeleted(const std::string& app_id) = 0; 202 virtual void OnMessagesDeleted(const std::string& app_id) = 0;
182 203
183 // Called when a message failed to send to the server. 204 // Called when a message failed to send to the server.
184 // |app_id|: application ID. 205 // |app_id|: application ID.
185 // |send_error_detials|: Details of the send error event, like mesasge ID. 206 // |send_error_detials|: Details of the send error event, like mesasge ID.
186 virtual void OnMessageSendError( 207 virtual void OnMessageSendError(
187 const std::string& app_id, 208 const std::string& app_id,
188 const SendErrorDetails& send_error_details) = 0; 209 const SendErrorDetails& send_error_details) = 0;
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
328 // to be set, and allows that component to later revoke the setting. It should 349 // to be set, and allows that component to later revoke the setting. It should
329 // be unique. 350 // be unique.
330 virtual void AddHeartbeatInterval(const std::string& scope, 351 virtual void AddHeartbeatInterval(const std::string& scope,
331 int interval_ms) = 0; 352 int interval_ms) = 0;
332 virtual void RemoveHeartbeatInterval(const std::string& scope) = 0; 353 virtual void RemoveHeartbeatInterval(const std::string& scope) = 0;
333 }; 354 };
334 355
335 } // namespace gcm 356 } // namespace gcm
336 357
337 #endif // COMPONENTS_GCM_DRIVER_GCM_CLIENT_H_ 358 #endif // COMPONENTS_GCM_DRIVER_GCM_CLIENT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698