[email protected] | cd57f37 | 2014-06-09 17:13:06 | [diff] [blame] | 1 | // Copyright 2014 The Chromium Authors. All rights reserved. |
[email protected] | e4097c8 | 2013-11-08 00:16:12 | [diff] [blame] | 2 | // Use of this source code is governed by a BSD-style license that can be |
| 3 | // found in the LICENSE file. |
| 4 | |
[email protected] | cd57f37 | 2014-06-09 17:13:06 | [diff] [blame] | 5 | #ifndef COMPONENTS_GCM_DRIVER_GCM_CLIENT_H_ |
| 6 | #define COMPONENTS_GCM_DRIVER_GCM_CLIENT_H_ |
[email protected] | e4097c8 | 2013-11-08 00:16:12 | [diff] [blame] | 7 | |
avi | 2606292 | 2015-12-26 00:14:18 | [diff] [blame] | 8 | #include <stdint.h> |
| 9 | |
[email protected] | e4097c8 | 2013-11-08 00:16:12 | [diff] [blame] | 10 | #include <map> |
| 11 | #include <string> |
| 12 | #include <vector> |
| 13 | |
jianli | 7a0c9b6 | 2015-05-26 23:24:47 | [diff] [blame] | 14 | #include "base/memory/linked_ptr.h" |
[email protected] | 5da9380 | 2014-05-24 01:35:01 | [diff] [blame] | 15 | #include "base/memory/scoped_ptr.h" |
mvanouwerkerk | f8633deb | 2015-07-13 11:04:06 | [diff] [blame] | 16 | #include "components/gcm_driver/common/gcm_messages.h" |
peter | ee284ba5 | 2016-02-01 11:53:28 | [diff] [blame] | 17 | #include "components/gcm_driver/crypto/gcm_encryption_provider.h" |
[email protected] | cd57f37 | 2014-06-09 17:13:06 | [diff] [blame] | 18 | #include "components/gcm_driver/gcm_activity.h" |
jianli | 7a0c9b6 | 2015-05-26 23:24:47 | [diff] [blame] | 19 | #include "components/gcm_driver/registration_info.h" |
[email protected] | e4097c8 | 2013-11-08 00:16:12 | [diff] [blame] | 20 | |
[email protected] | e2a4a801 | 2014-02-07 22:32:52 | [diff] [blame] | 21 | template <class T> class scoped_refptr; |
| 22 | |
[email protected] | fc6078a | 2014-06-14 08:28:43 | [diff] [blame] | 23 | class GURL; |
| 24 | |
[email protected] | e2a4a801 | 2014-02-07 22:32:52 | [diff] [blame] | 25 | namespace base { |
| 26 | class FilePath; |
| 27 | class SequencedTaskRunner; |
chirantan | 192a921 | 2014-12-06 03:30:45 | [diff] [blame] | 28 | class Timer; |
[email protected] | e2a4a801 | 2014-02-07 22:32:52 | [diff] [blame] | 29 | } |
| 30 | |
[email protected] | e2a4a801 | 2014-02-07 22:32:52 | [diff] [blame] | 31 | namespace net { |
[email protected] | fc6078a | 2014-06-14 08:28:43 | [diff] [blame] | 32 | class IPEndPoint; |
[email protected] | e2a4a801 | 2014-02-07 22:32:52 | [diff] [blame] | 33 | class URLRequestContextGetter; |
| 34 | } |
| 35 | |
[email protected] | e4097c8 | 2013-11-08 00:16:12 | [diff] [blame] | 36 | namespace gcm { |
| 37 | |
[email protected] | 446f73c2 | 2014-05-14 20:47:18 | [diff] [blame] | 38 | class Encryptor; |
[email protected] | 72d4f25 | 2014-08-20 22:34:28 | [diff] [blame] | 39 | struct AccountMapping; |
[email protected] | 446f73c2 | 2014-05-14 20:47:18 | [diff] [blame] | 40 | |
[email protected] | e4097c8 | 2013-11-08 00:16:12 | [diff] [blame] | 41 | // Interface that encapsulates the network communications with the Google Cloud |
| 42 | // Messaging server. This interface is not supposed to be thread-safe. |
[email protected] | cd57f37 | 2014-06-09 17:13:06 | [diff] [blame] | 43 | class GCMClient { |
[email protected] | e4097c8 | 2013-11-08 00:16:12 | [diff] [blame] | 44 | public: |
jianli | f3e52af4 | 2015-01-21 23:18:47 | [diff] [blame] | 45 | // Controls how GCM is being started. At first, GCMClient will be initialized |
| 46 | // and GCM store will be loaded. Then GCM connection may or may not be |
| 47 | // initiated depending on this enum value. |
| 48 | enum StartMode { |
| 49 | // GCM should be started only when it is being actually used. If no |
| 50 | // registration record is found, GCM will not kick off. |
| 51 | DELAYED_START, |
| 52 | // GCM should be started immediately. |
| 53 | IMMEDIATE_START |
| 54 | }; |
| 55 | |
[email protected] | e4097c8 | 2013-11-08 00:16:12 | [diff] [blame] | 56 | enum Result { |
| 57 | // Successful operation. |
| 58 | SUCCESS, |
[email protected] | b16a7c5 | 2013-11-20 01:18:59 | [diff] [blame] | 59 | // Invalid parameter. |
| 60 | INVALID_PARAMETER, |
[email protected] | 9d7e5c0 | 2014-05-21 03:09:03 | [diff] [blame] | 61 | // GCM is disabled. |
| 62 | GCM_DISABLED, |
[email protected] | b16a7c5 | 2013-11-20 01:18:59 | [diff] [blame] | 63 | // Previous asynchronous operation is still pending to finish. Certain |
| 64 | // operation, like register, is only allowed one at a time. |
| 65 | ASYNC_OPERATION_PENDING, |
[email protected] | e4097c8 | 2013-11-08 00:16:12 | [diff] [blame] | 66 | // Network socket error. |
| 67 | NETWORK_ERROR, |
| 68 | // Problem at the server. |
| 69 | SERVER_ERROR, |
| 70 | // Exceeded the specified TTL during message sending. |
| 71 | TTL_EXCEEDED, |
| 72 | // Other errors. |
| 73 | UNKNOWN_ERROR |
| 74 | }; |
| 75 | |
[email protected] | 8ad8051 | 2014-05-23 09:40:47 | [diff] [blame] | 76 | enum ChromePlatform { |
| 77 | PLATFORM_WIN, |
| 78 | PLATFORM_MAC, |
| 79 | PLATFORM_LINUX, |
| 80 | PLATFORM_CROS, |
| 81 | PLATFORM_IOS, |
| 82 | PLATFORM_ANDROID, |
| 83 | PLATFORM_UNKNOWN |
| 84 | }; |
| 85 | |
| 86 | enum ChromeChannel { |
| 87 | CHANNEL_STABLE, |
| 88 | CHANNEL_BETA, |
| 89 | CHANNEL_DEV, |
| 90 | CHANNEL_CANARY, |
| 91 | CHANNEL_UNKNOWN |
| 92 | }; |
| 93 | |
[email protected] | cd57f37 | 2014-06-09 17:13:06 | [diff] [blame] | 94 | struct ChromeBuildInfo { |
[email protected] | 8ad8051 | 2014-05-23 09:40:47 | [diff] [blame] | 95 | ChromeBuildInfo(); |
| 96 | ~ChromeBuildInfo(); |
| 97 | |
| 98 | ChromePlatform platform; |
| 99 | ChromeChannel channel; |
| 100 | std::string version; |
| 101 | }; |
| 102 | |
[email protected] | c6fe36b | 2014-03-11 10:58:12 | [diff] [blame] | 103 | // Detailed information of the Send Error event. |
[email protected] | cd57f37 | 2014-06-09 17:13:06 | [diff] [blame] | 104 | struct SendErrorDetails { |
[email protected] | c6fe36b | 2014-03-11 10:58:12 | [diff] [blame] | 105 | SendErrorDetails(); |
| 106 | ~SendErrorDetails(); |
| 107 | |
| 108 | std::string message_id; |
| 109 | MessageData additional_data; |
| 110 | Result result; |
| 111 | }; |
| 112 | |
[email protected] | 3560181 | 2014-03-07 19:52:43 | [diff] [blame] | 113 | // Internal states and activity statistics of a GCM client. |
[email protected] | cd57f37 | 2014-06-09 17:13:06 | [diff] [blame] | 114 | struct GCMStatistics { |
[email protected] | 3560181 | 2014-03-07 19:52:43 | [diff] [blame] | 115 | public: |
| 116 | GCMStatistics(); |
| 117 | ~GCMStatistics(); |
| 118 | |
[email protected] | 436bcb8 | 2014-04-18 00:40:57 | [diff] [blame] | 119 | bool is_recording; |
[email protected] | 3560181 | 2014-03-07 19:52:43 | [diff] [blame] | 120 | bool gcm_client_created; |
| 121 | std::string gcm_client_state; |
| 122 | bool connection_client_created; |
| 123 | std::string connection_state; |
avi | 2606292 | 2015-12-26 00:14:18 | [diff] [blame] | 124 | uint64_t android_id; |
[email protected] | 436bcb8 | 2014-04-18 00:40:57 | [diff] [blame] | 125 | std::vector<std::string> registered_app_ids; |
| 126 | int send_queue_size; |
| 127 | int resend_queue_size; |
| 128 | |
[email protected] | 5da9380 | 2014-05-24 01:35:01 | [diff] [blame] | 129 | RecordedActivities recorded_activities; |
[email protected] | 3560181 | 2014-03-07 19:52:43 | [diff] [blame] | 130 | }; |
| 131 | |
fgorski | c104731 | 2014-09-04 16:48:54 | [diff] [blame] | 132 | // Information about account. |
| 133 | struct AccountTokenInfo { |
| 134 | std::string account_id; |
| 135 | std::string email; |
| 136 | std::string access_token; |
| 137 | }; |
| 138 | |
[email protected] | e4097c8 | 2013-11-08 00:16:12 | [diff] [blame] | 139 | // A delegate interface that allows the GCMClient instance to interact with |
| 140 | // its caller, i.e. notifying asynchronous event. |
| 141 | class Delegate { |
| 142 | public: |
[email protected] | e4097c8 | 2013-11-08 00:16:12 | [diff] [blame] | 143 | // Called when the registration completed successfully or an error occurs. |
jianli | 7a0c9b6 | 2015-05-26 23:24:47 | [diff] [blame] | 144 | // |registration_info|: the specific information required for the |
| 145 | // registration. |
[email protected] | e4097c8 | 2013-11-08 00:16:12 | [diff] [blame] | 146 | // |registration_id|: non-empty if the registration completed successfully. |
| 147 | // |result|: the type of the error if an error occured, success otherwise. |
jianli | 7a0c9b6 | 2015-05-26 23:24:47 | [diff] [blame] | 148 | virtual void OnRegisterFinished( |
| 149 | const linked_ptr<RegistrationInfo>& registration_info, |
| 150 | const std::string& registration_id, |
| 151 | Result result) = 0; |
[email protected] | e4097c8 | 2013-11-08 00:16:12 | [diff] [blame] | 152 | |
[email protected] | e400704 | 2014-02-15 20:34:28 | [diff] [blame] | 153 | // Called when the unregistration completed. |
jianli | 7a0c9b6 | 2015-05-26 23:24:47 | [diff] [blame] | 154 | // |registration_info|: the specific information required for the |
| 155 | // registration. |
[email protected] | 0e88e1d1 | 2014-03-19 06:53:08 | [diff] [blame] | 156 | // |result|: result of the unregistration. |
jianli | 7a0c9b6 | 2015-05-26 23:24:47 | [diff] [blame] | 157 | virtual void OnUnregisterFinished( |
| 158 | const linked_ptr<RegistrationInfo>& registration_info, |
| 159 | GCMClient::Result result) = 0; |
[email protected] | e400704 | 2014-02-15 20:34:28 | [diff] [blame] | 160 | |
[email protected] | e4097c8 | 2013-11-08 00:16:12 | [diff] [blame] | 161 | // Called when the message is scheduled to send successfully or an error |
| 162 | // occurs. |
| 163 | // |app_id|: application ID. |
| 164 | // |message_id|: ID of the message being sent. |
| 165 | // |result|: the type of the error if an error occured, success otherwise. |
| 166 | virtual void OnSendFinished(const std::string& app_id, |
| 167 | const std::string& message_id, |
| 168 | Result result) = 0; |
| 169 | |
| 170 | // Called when a message has been received. |
| 171 | // |app_id|: application ID. |
[email protected] | e4097c8 | 2013-11-08 00:16:12 | [diff] [blame] | 172 | // |message|: message received. |
| 173 | virtual void OnMessageReceived(const std::string& app_id, |
[email protected] | e4097c8 | 2013-11-08 00:16:12 | [diff] [blame] | 174 | const IncomingMessage& message) = 0; |
| 175 | |
| 176 | // Called when some messages have been deleted from the server. |
| 177 | // |app_id|: application ID. |
| 178 | virtual void OnMessagesDeleted(const std::string& app_id) = 0; |
| 179 | |
| 180 | // Called when a message failed to send to the server. |
| 181 | // |app_id|: application ID. |
[email protected] | c6fe36b | 2014-03-11 10:58:12 | [diff] [blame] | 182 | // |send_error_detials|: Details of the send error event, like mesasge ID. |
| 183 | virtual void OnMessageSendError( |
| 184 | const std::string& app_id, |
| 185 | const SendErrorDetails& send_error_details) = 0; |
[email protected] | e4097c8 | 2013-11-08 00:16:12 | [diff] [blame] | 186 | |
[email protected] | 292af2b2 | 2014-08-06 19:42:45 | [diff] [blame] | 187 | // Called when a message was acknowledged by the GCM server. |
| 188 | // |app_id|: application ID. |
| 189 | // |message_id|: ID of the acknowledged message. |
| 190 | virtual void OnSendAcknowledged(const std::string& app_id, |
| 191 | const std::string& message_id) = 0; |
| 192 | |
[email protected] | 86625df | 2014-01-31 03:47:58 | [diff] [blame] | 193 | // Called when the GCM becomes ready. To get to this state, GCMClient |
| 194 | // finished loading from the GCM store and retrieved the device check-in |
| 195 | // from the server if it hadn't yet. |
fgorski | d578c18b | 2014-09-24 23:40:17 | [diff] [blame] | 196 | // |account_mappings|: a persisted list of accounts mapped to this GCM |
| 197 | // client. |
fgorski | 5df10170 | 2014-10-28 02:09:31 | [diff] [blame] | 198 | // |last_token_fetch_time|: time of a last successful token fetch. |
| 199 | virtual void OnGCMReady(const std::vector<AccountMapping>& account_mappings, |
| 200 | const base::Time& last_token_fetch_time) = 0; |
[email protected] | 7de7880 | 2014-05-10 19:49:40 | [diff] [blame] | 201 | |
| 202 | // Called when activities are being recorded and a new activity has just |
| 203 | // been recorded. |
| 204 | virtual void OnActivityRecorded() = 0; |
[email protected] | fc6078a | 2014-06-14 08:28:43 | [diff] [blame] | 205 | |
| 206 | // Called when a new connection is established and a successful handshake |
| 207 | // has been performed. |
| 208 | virtual void OnConnected(const net::IPEndPoint& ip_endpoint) = 0; |
| 209 | |
| 210 | // Called when the connection is interrupted. |
| 211 | virtual void OnDisconnected() = 0; |
[email protected] | e4097c8 | 2013-11-08 00:16:12 | [diff] [blame] | 212 | }; |
| 213 | |
[email protected] | 0db11822 | 2014-01-22 01:37:59 | [diff] [blame] | 214 | GCMClient(); |
| 215 | virtual ~GCMClient(); |
[email protected] | 1b1c3cd | 2013-12-17 18:40:04 | [diff] [blame] | 216 | |
[email protected] | d3a4b2e | 2014-02-27 13:46:54 | [diff] [blame] | 217 | // Begins initialization of the GCM Client. This will not trigger a |
| 218 | // connection. |
[email protected] | 8ad8051 | 2014-05-23 09:40:47 | [diff] [blame] | 219 | // |chrome_build_info|: chrome info, i.e., version, channel and etc. |
[email protected] | 5799d05 | 2014-02-12 20:47:39 | [diff] [blame] | 220 | // |store_path|: path to the GCM store. |
| 221 | // |blocking_task_runner|: for running blocking file tasks. |
mmenke | e65e7af | 2015-10-13 17:16:42 | [diff] [blame] | 222 | // |url_request_context_getter|: for url requests. The GCMClient must be |
| 223 | // deleted before the Getter's underlying URLRequestContext. |
[email protected] | 5799d05 | 2014-02-12 20:47:39 | [diff] [blame] | 224 | // |delegate|: the delegate whose methods will be called asynchronously in |
mmenke | e65e7af | 2015-10-13 17:16:42 | [diff] [blame] | 225 | // response to events and messages. |
[email protected] | e2a4a801 | 2014-02-07 22:32:52 | [diff] [blame] | 226 | virtual void Initialize( |
[email protected] | 8ad8051 | 2014-05-23 09:40:47 | [diff] [blame] | 227 | const ChromeBuildInfo& chrome_build_info, |
[email protected] | e2a4a801 | 2014-02-07 22:32:52 | [diff] [blame] | 228 | const base::FilePath& store_path, |
| 229 | const scoped_refptr<base::SequencedTaskRunner>& blocking_task_runner, |
| 230 | const scoped_refptr<net::URLRequestContextGetter>& |
[email protected] | 5799d05 | 2014-02-12 20:47:39 | [diff] [blame] | 231 | url_request_context_getter, |
[email protected] | 446f73c2 | 2014-05-14 20:47:18 | [diff] [blame] | 232 | scoped_ptr<Encryptor> encryptor, |
[email protected] | 5799d05 | 2014-02-12 20:47:39 | [diff] [blame] | 233 | Delegate* delegate) = 0; |
[email protected] | e2a4a801 | 2014-02-07 22:32:52 | [diff] [blame] | 234 | |
jianli | f3e52af4 | 2015-01-21 23:18:47 | [diff] [blame] | 235 | // This will initiate the GCM connection only if |start_mode| means to start |
| 236 | // the GCM immediately or the GCM registration records are found in the store. |
| 237 | // Note that it is OK to call Start multiple times and the implementation |
| 238 | // should handle it gracefully. |
| 239 | virtual void Start(StartMode start_mode) = 0; |
[email protected] | d3a4b2e | 2014-02-27 13:46:54 | [diff] [blame] | 240 | |
[email protected] | 21fee548 | 2014-03-05 00:57:15 | [diff] [blame] | 241 | // Stops using the GCM service. This will not erase the persisted data. |
| 242 | virtual void Stop() = 0; |
| 243 | |
jianli | 7a0c9b6 | 2015-05-26 23:24:47 | [diff] [blame] | 244 | // Registers with the server to access the provided service. |
| 245 | // Delegate::OnRegisterFinished will be called asynchronously upon completion. |
| 246 | // |registration_info|: the specific information required for the |
| 247 | // registration. For GCM, it will contain app id and |
| 248 | // sender IDs. For InstanceID, it will contain app_id, |
| 249 | // authorized entity and scope. |
| 250 | virtual void Register( |
| 251 | const linked_ptr<RegistrationInfo>& registration_info) = 0; |
[email protected] | e4097c8 | 2013-11-08 00:16:12 | [diff] [blame] | 252 | |
jianli | 7a0c9b6 | 2015-05-26 23:24:47 | [diff] [blame] | 253 | // Unregisters from the server to stop accessing the provided service. |
[email protected] | e4097c8 | 2013-11-08 00:16:12 | [diff] [blame] | 254 | // Delegate::OnUnregisterFinished will be called asynchronously upon |
| 255 | // completion. |
jianli | 7a0c9b6 | 2015-05-26 23:24:47 | [diff] [blame] | 256 | // |registration_info|: the specific information required for the |
| 257 | // registration. For GCM, it will contain app id (sender |
| 258 | // IDs can be ingored). For InstanceID, it will contain |
| 259 | // app id, authorized entity and scope. |
| 260 | virtual void Unregister( |
| 261 | const linked_ptr<RegistrationInfo>& registration_info) = 0; |
[email protected] | e4097c8 | 2013-11-08 00:16:12 | [diff] [blame] | 262 | |
| 263 | // Sends a message to a given receiver. Delegate::OnSendFinished will be |
| 264 | // called asynchronously upon completion. |
[email protected] | e4097c8 | 2013-11-08 00:16:12 | [diff] [blame] | 265 | // |app_id|: application ID. |
| 266 | // |receiver_id|: registration ID of the receiver party. |
| 267 | // |message|: message to be sent. |
[email protected] | 5799d05 | 2014-02-12 20:47:39 | [diff] [blame] | 268 | virtual void Send(const std::string& app_id, |
[email protected] | e4097c8 | 2013-11-08 00:16:12 | [diff] [blame] | 269 | const std::string& receiver_id, |
| 270 | const OutgoingMessage& message) = 0; |
[email protected] | 3560181 | 2014-03-07 19:52:43 | [diff] [blame] | 271 | |
peter | 266a2aa4 | 2016-02-19 18:51:39 | [diff] [blame^] | 272 | // Records a decryption failure due to |result| for the |app_id|. |
peter | ee284ba5 | 2016-02-01 11:53:28 | [diff] [blame] | 273 | virtual void RecordDecryptionFailure( |
| 274 | const std::string& app_id, |
peter | 266a2aa4 | 2016-02-19 18:51:39 | [diff] [blame^] | 275 | GCMEncryptionProvider::DecryptionResult result) = 0; |
peter | ee284ba5 | 2016-02-01 11:53:28 | [diff] [blame] | 276 | |
[email protected] | 436bcb8 | 2014-04-18 00:40:57 | [diff] [blame] | 277 | // Enables or disables internal activity recording. |
| 278 | virtual void SetRecording(bool recording) = 0; |
| 279 | |
| 280 | // Clear all recorded GCM activity logs. |
| 281 | virtual void ClearActivityLogs() = 0; |
| 282 | |
[email protected] | 3560181 | 2014-03-07 19:52:43 | [diff] [blame] | 283 | // Gets internal states and statistics. |
| 284 | virtual GCMStatistics GetStatistics() const = 0; |
[email protected] | 7df5ef2 | 2014-07-17 07:35:58 | [diff] [blame] | 285 | |
| 286 | // Sets a list of accounts with OAuth2 tokens for the next checkin. |
fgorski | 58b9dfc | 2014-09-29 16:46:18 | [diff] [blame] | 287 | // |account_tokens|: list of email addresses, account IDs and OAuth2 access |
| 288 | // tokens. |
| 289 | virtual void SetAccountTokens( |
| 290 | const std::vector<AccountTokenInfo>& account_tokens) = 0; |
[email protected] | 72d4f25 | 2014-08-20 22:34:28 | [diff] [blame] | 291 | |
| 292 | // Persists the |account_mapping| in the store. |
| 293 | virtual void UpdateAccountMapping(const AccountMapping& account_mapping) = 0; |
| 294 | |
| 295 | // Removes the account mapping related to |account_id| from the persistent |
| 296 | // store. |
| 297 | virtual void RemoveAccountMapping(const std::string& account_id) = 0; |
fgorski | 5df10170 | 2014-10-28 02:09:31 | [diff] [blame] | 298 | |
| 299 | // Sets last token fetch time in persistent store. |
| 300 | virtual void SetLastTokenFetchTime(const base::Time& time) = 0; |
chirantan | 192a921 | 2014-12-06 03:30:45 | [diff] [blame] | 301 | |
| 302 | // Updates the timer used by the HeartbeatManager for sending heartbeats. |
| 303 | virtual void UpdateHeartbeatTimer(scoped_ptr<base::Timer> timer) = 0; |
jianli | 10018b2d | 2015-05-11 21:14:13 | [diff] [blame] | 304 | |
| 305 | // Adds the Instance ID data for a specific app to the persistent store. |
| 306 | virtual void AddInstanceIDData(const std::string& app_id, |
jianli | 7a0c9b6 | 2015-05-26 23:24:47 | [diff] [blame] | 307 | const std::string& instance_id, |
| 308 | const std::string& extra_data) = 0; |
jianli | 10018b2d | 2015-05-11 21:14:13 | [diff] [blame] | 309 | |
| 310 | // Removes the Instance ID data for a specific app from the persistent store. |
| 311 | virtual void RemoveInstanceIDData(const std::string& app_id) = 0; |
| 312 | |
| 313 | // Retrieves the Instance ID data for a specific app from the persistent |
| 314 | // store. |
jianli | 7a0c9b6 | 2015-05-26 23:24:47 | [diff] [blame] | 315 | virtual void GetInstanceIDData(const std::string& app_id, |
| 316 | std::string* instance_id, |
| 317 | std::string* extra_data) = 0; |
fgorski | 2275446 | 2015-05-14 00:05:22 | [diff] [blame] | 318 | |
| 319 | // Gets and sets custom heartbeat interval for the MCS connection. |
| 320 | // |scope| is used to identify the component that requests a custom interval |
| 321 | // to be set, and allows that component to later revoke the setting. It should |
| 322 | // be unique. |
| 323 | virtual void AddHeartbeatInterval(const std::string& scope, |
| 324 | int interval_ms) = 0; |
| 325 | virtual void RemoveHeartbeatInterval(const std::string& scope) = 0; |
[email protected] | e4097c8 | 2013-11-08 00:16:12 | [diff] [blame] | 326 | }; |
| 327 | |
| 328 | } // namespace gcm |
| 329 | |
[email protected] | cd57f37 | 2014-06-09 17:13:06 | [diff] [blame] | 330 | #endif // COMPONENTS_GCM_DRIVER_GCM_CLIENT_H_ |