blob: 9e102154b86b20e1cbe8c7ac5d81432a36087b1f [file] [log] [blame]
[email protected]cd57f372014-06-09 17:13:061// Copyright 2014 The Chromium Authors. All rights reserved.
[email protected]e4097c82013-11-08 00:16:122// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
[email protected]cd57f372014-06-09 17:13:065#ifndef COMPONENTS_GCM_DRIVER_GCM_CLIENT_IMPL_H_
6#define COMPONENTS_GCM_DRIVER_GCM_CLIENT_IMPL_H_
[email protected]e4097c82013-11-08 00:16:127
avi26062922015-12-26 00:14:188#include <stdint.h>
9
[email protected]b83122a92014-01-22 21:29:2910#include <map>
dchenga77e28eb2016-04-21 21:34:3711#include <memory>
[email protected]7df5ef22014-07-17 07:35:5812#include <set>
[email protected]b83122a92014-01-22 21:29:2913#include <string>
jianli7a0c9b62015-05-26 23:24:4714#include <utility>
[email protected]848b1b62014-01-30 23:51:0415#include <vector>
[email protected]b83122a92014-01-22 21:29:2916
[email protected]e4097c82013-11-08 00:16:1217#include "base/compiler_specific.h"
avi26062922015-12-26 00:14:1818#include "base/macros.h"
[email protected]79994f42014-01-16 16:05:3619#include "base/memory/ref_counted.h"
[email protected]955e0ff2014-01-31 20:42:1220#include "base/memory/weak_ptr.h"
[email protected]cd57f372014-06-09 17:13:0621#include "components/gcm_driver/gcm_client.h"
22#include "components/gcm_driver/gcm_stats_recorder_impl.h"
[email protected]b83122a92014-01-22 21:29:2923#include "google_apis/gcm/base/mcs_message.h"
24#include "google_apis/gcm/engine/gcm_store.h"
[email protected]06e45272014-05-06 03:41:3425#include "google_apis/gcm/engine/gservices_settings.h"
[email protected]b83122a92014-01-22 21:29:2926#include "google_apis/gcm/engine/mcs_client.h"
[email protected]b4dd0232014-02-08 02:37:3127#include "google_apis/gcm/engine/registration_request.h"
[email protected]0e88e1d12014-03-19 06:53:0828#include "google_apis/gcm/engine/unregistration_request.h"
[email protected]436bcb82014-04-18 00:40:5729#include "google_apis/gcm/protocol/android_checkin.pb.h"
[email protected]2c4d4cd2014-04-10 21:10:2230#include "google_apis/gcm/protocol/checkin.pb.h"
zea76342abf2016-11-01 17:26:0431#include "net/http/http_status_code.h"
[email protected]b83122a92014-01-22 21:29:2932#include "net/url_request/url_request_context_getter.h"
[email protected]e4097c82013-11-08 00:16:1233
[email protected]2bbe0a682014-03-26 00:08:3134class GURL;
35
[email protected]79994f42014-01-16 16:05:3636namespace base {
[email protected]955e0ff2014-01-31 20:42:1237class Clock;
[email protected]764c0442014-05-01 04:30:5538class Time;
[email protected]79994f42014-01-16 16:05:3639} // namespace base
40
[email protected]436bcb82014-04-18 00:40:5741namespace mcs_proto {
42class DataMessageStanza;
43} // namespace mcs_proto
44
[email protected]b83122a92014-01-22 21:29:2945namespace net {
46class HttpNetworkSession;
[email protected]955e0ff2014-01-31 20:42:1247} // namespace net
[email protected]b83122a92014-01-22 21:29:2948
[email protected]e4097c82013-11-08 00:16:1249namespace gcm {
50
[email protected]b83122a92014-01-22 21:29:2951class CheckinRequest;
52class ConnectionFactory;
53class GCMClientImplTest;
[email protected]79994f42014-01-16 16:05:3654
[email protected]2bbe0a682014-03-26 00:08:3155// Helper class for building GCM internals. Allows tests to inject fake versions
56// as necessary.
[email protected]cd57f372014-06-09 17:13:0657class GCMInternalsBuilder {
[email protected]2bbe0a682014-03-26 00:08:3158 public:
59 GCMInternalsBuilder();
60 virtual ~GCMInternalsBuilder();
61
dchenga77e28eb2016-04-21 21:34:3762 virtual std::unique_ptr<base::Clock> BuildClock();
63 virtual std::unique_ptr<MCSClient> BuildMCSClient(
[email protected]2bbe0a682014-03-26 00:08:3164 const std::string& version,
65 base::Clock* clock,
66 ConnectionFactory* connection_factory,
[email protected]436bcb82014-04-18 00:40:5767 GCMStore* gcm_store,
68 GCMStatsRecorder* recorder);
dchenga77e28eb2016-04-21 21:34:3769 virtual std::unique_ptr<ConnectionFactory> BuildConnectionFactory(
[email protected]2bbe0a682014-03-26 00:08:3170 const std::vector<GURL>& endpoints,
71 const net::BackoffEntry::Policy& backoff_policy,
mmenkee65e7af2015-10-13 17:16:4272 net::HttpNetworkSession* gcm_network_session,
73 net::HttpNetworkSession* http_network_session,
[email protected]9df5b932014-04-30 00:39:0674 GCMStatsRecorder* recorder);
[email protected]2bbe0a682014-03-26 00:08:3175};
76
[email protected]b83122a92014-01-22 21:29:2977// Implements the GCM Client. It is used to coordinate MCS Client (communication
78// with MCS) and other pieces of GCM infrastructure like Registration and
79// Checkins. It also allows for registering user delegates that host
80// applications that send and receive messages.
[email protected]cd57f372014-06-09 17:13:0681class GCMClientImpl
[email protected]c31e1b52014-06-12 21:00:4782 : public GCMClient, public GCMStatsRecorder::Delegate,
83 public ConnectionFactory::ConnectionListener {
[email protected]e4097c82013-11-08 00:16:1284 public:
jianlif3e52af42015-01-21 23:18:4785 // State representation of the GCMClient.
86 // Any change made to this enum should have corresponding change in the
87 // GetStateString(...) function.
88 enum State {
89 // Uninitialized.
90 UNINITIALIZED,
91 // Initialized,
92 INITIALIZED,
93 // GCM store loading is in progress.
94 LOADING,
95 // GCM store is loaded.
96 LOADED,
97 // Initial device checkin is in progress.
98 INITIAL_DEVICE_CHECKIN,
99 // Ready to accept requests.
100 READY,
101 };
102
dchenga77e28eb2016-04-21 21:34:37103 explicit GCMClientImpl(
104 std::unique_ptr<GCMInternalsBuilder> internals_builder);
dcheng00ea022b2014-10-21 11:24:56105 ~GCMClientImpl() override;
[email protected]e4097c82013-11-08 00:16:12106
[email protected]c31e1b52014-06-12 21:00:47107 // GCMClient implementation.
dcheng00ea022b2014-10-21 11:24:56108 void Initialize(
[email protected]8ad80512014-05-23 09:40:47109 const ChromeBuildInfo& chrome_build_info,
[email protected]e2a4a8012014-02-07 22:32:52110 const base::FilePath& store_path,
111 const scoped_refptr<base::SequencedTaskRunner>& blocking_task_runner,
112 const scoped_refptr<net::URLRequestContextGetter>&
[email protected]5799d052014-02-12 20:47:39113 url_request_context_getter,
dchenga77e28eb2016-04-21 21:34:37114 std::unique_ptr<Encryptor> encryptor,
mostynbfe59f482014-10-06 15:04:46115 GCMClient::Delegate* delegate) override;
jianlif3e52af42015-01-21 23:18:47116 void Start(StartMode start_mode) override;
dcheng00ea022b2014-10-21 11:24:56117 void Stop() override;
jianli7a0c9b62015-05-26 23:24:47118 void Register(const linked_ptr<RegistrationInfo>& registration_info) override;
119 void Unregister(
120 const linked_ptr<RegistrationInfo>& registration_info) override;
dcheng00ea022b2014-10-21 11:24:56121 void Send(const std::string& app_id,
122 const std::string& receiver_id,
123 const OutgoingMessage& message) override;
peteree284ba52016-02-01 11:53:28124 void RecordDecryptionFailure(const std::string& app_id,
peter266a2aa42016-02-19 18:51:39125 GCMEncryptionProvider::DecryptionResult result)
peteree284ba52016-02-01 11:53:28126 override;
dcheng00ea022b2014-10-21 11:24:56127 void SetRecording(bool recording) override;
128 void ClearActivityLogs() override;
129 GCMStatistics GetStatistics() const override;
130 void SetAccountTokens(
mostynbfe59f482014-10-06 15:04:46131 const std::vector<AccountTokenInfo>& account_tokens) override;
dcheng00ea022b2014-10-21 11:24:56132 void UpdateAccountMapping(const AccountMapping& account_mapping) override;
133 void RemoveAccountMapping(const std::string& account_id) override;
fgorski5df101702014-10-28 02:09:31134 void SetLastTokenFetchTime(const base::Time& time) override;
dchenga77e28eb2016-04-21 21:34:37135 void UpdateHeartbeatTimer(std::unique_ptr<base::Timer> timer) override;
jianli10018b2d2015-05-11 21:14:13136 void AddInstanceIDData(const std::string& app_id,
jianli7a0c9b62015-05-26 23:24:47137 const std::string& instance_id,
138 const std::string& extra_data) override;
jianli10018b2d2015-05-11 21:14:13139 void RemoveInstanceIDData(const std::string& app_id) override;
jianli7a0c9b62015-05-26 23:24:47140 void GetInstanceIDData(const std::string& app_id,
141 std::string* instance_id,
142 std::string* extra_data) override;
fgorski22754462015-05-14 00:05:22143 void AddHeartbeatInterval(const std::string& scope, int interval_ms) override;
144 void RemoveHeartbeatInterval(const std::string& scope) override;
[email protected]c31e1b52014-06-12 21:00:47145
146 // GCMStatsRecorder::Delegate implemenation.
dcheng00ea022b2014-10-21 11:24:56147 void OnActivityRecorded() override;
[email protected]e4097c82013-11-08 00:16:12148
[email protected]c31e1b52014-06-12 21:00:47149 // ConnectionFactory::ConnectionListener implementation.
dcheng00ea022b2014-10-21 11:24:56150 void OnConnected(const GURL& current_server,
151 const net::IPEndPoint& ip_endpoint) override;
152 void OnDisconnected() override;
[email protected]c31e1b52014-06-12 21:00:47153
[email protected]e4097c82013-11-08 00:16:12154 private:
[email protected]7df5ef22014-07-17 07:35:58155 // The check-in info for the device.
156 // TODO(fgorski): Convert to a class with explicit getters/setters.
[email protected]cd57f372014-06-09 17:13:06157 struct CheckinInfo {
[email protected]7df5ef22014-07-17 07:35:58158 CheckinInfo();
159 ~CheckinInfo();
[email protected]5799d052014-02-12 20:47:39160 bool IsValid() const { return android_id != 0 && secret != 0; }
[email protected]7df5ef22014-07-17 07:35:58161 void SnapshotCheckinAccounts();
162 void Reset();
[email protected]b83122a92014-01-22 21:29:29163
[email protected]7df5ef22014-07-17 07:35:58164 // Android ID of the device as assigned by the server.
avi26062922015-12-26 00:14:18165 uint64_t android_id;
[email protected]7df5ef22014-07-17 07:35:58166 // Security token of the device as assigned by the server.
avi26062922015-12-26 00:14:18167 uint64_t secret;
[email protected]7df5ef22014-07-17 07:35:58168 // True if accounts were already provided through SetAccountsForCheckin(),
169 // or when |last_checkin_accounts| was loaded as empty.
170 bool accounts_set;
171 // Map of account email addresses and OAuth2 tokens that will be sent to the
172 // checkin server on a next checkin.
173 std::map<std::string, std::string> account_tokens;
174 // As set of accounts last checkin was completed with.
175 std::set<std::string> last_checkin_accounts;
[email protected]848b1b62014-01-30 23:51:04176 };
177
zeae6e404182016-11-04 23:05:45178 // Reasons for resetting the GCM Store.
179 // Note: this enum is recorded into a histogram. Do not change enum value
180 // or order.
181 enum ResetReason {
182 LOAD_FAILURE, // GCM store failed to load, but the store exists.
183 CHECKIN_REJECTED, // Checkin was rejected by server.
184
185 RESET_REASON_COUNT,
186 };
187
jianli7a0c9b62015-05-26 23:24:47188 // Collection of pending registration requests. Keys are RegistrationInfo
189 // instance, while values are pending registration requests to obtain a
190 // registration ID for requesting application.
dchenga77e28eb2016-04-21 21:34:37191 using PendingRegistrationRequests =
192 std::map<linked_ptr<RegistrationInfo>,
193 std::unique_ptr<RegistrationRequest>,
194 RegistrationInfoComparer>;
[email protected]848b1b62014-01-30 23:51:04195
jianli7a0c9b62015-05-26 23:24:47196 // Collection of pending unregistration requests. Keys are RegistrationInfo
197 // instance, while values are pending unregistration requests to disable the
198 // registration ID currently assigned to the application.
limasdf20c5d7a2015-12-01 01:16:19199 using PendingUnregistrationRequests =
200 std::map<linked_ptr<RegistrationInfo>,
dchenga77e28eb2016-04-21 21:34:37201 std::unique_ptr<UnregistrationRequest>,
limasdf20c5d7a2015-12-01 01:16:19202 RegistrationInfoComparer>;
[email protected]e4007042014-02-15 20:34:28203
[email protected]b83122a92014-01-22 21:29:29204 friend class GCMClientImplTest;
jianlic02d25e2015-05-27 22:24:31205 friend class GCMClientInstanceIDTest;
[email protected]b83122a92014-01-22 21:29:29206
[email protected]35601812014-03-07 19:52:43207 // Returns text representation of the enum State.
208 std::string GetStateString() const;
209
[email protected]b83122a92014-01-22 21:29:29210 // Callbacks for the MCSClient.
211 // Receives messages and dispatches them to relevant user delegates.
212 void OnMessageReceivedFromMCS(const gcm::MCSMessage& message);
213 // Receives confirmation of sent messages or information about errors.
avi26062922015-12-26 00:14:18214 void OnMessageSentToMCS(int64_t user_serial_number,
[email protected]b83122a92014-01-22 21:29:29215 const std::string& app_id,
216 const std::string& message_id,
217 MCSClient::MessageSendStatus status);
218 // Receives information about mcs_client_ errors.
219 void OnMCSError();
220
221 // Runs after GCM Store load is done to trigger continuation of the
222 // initialization.
dchenga77e28eb2016-04-21 21:34:37223 void OnLoadCompleted(std::unique_ptr<GCMStore::LoadResult> result);
jianlif3e52af42015-01-21 23:18:47224 // Starts the GCM.
225 void StartGCM();
[email protected]b83122a92014-01-22 21:29:29226 // Initializes mcs_client_, which handles the connection to MCS.
jianlif3e52af42015-01-21 23:18:47227 void InitializeMCSClient();
[email protected]b83122a92014-01-22 21:29:29228 // Complets the first time device checkin.
229 void OnFirstTimeDeviceCheckinCompleted(const CheckinInfo& checkin_info);
230 // Starts a login on mcs_client_.
231 void StartMCSLogin();
jianli00b4600f2015-02-10 23:32:49232 // Resets the GCM store when it is corrupted.
233 void ResetStore();
[email protected]86625df2014-01-31 03:47:58234 // Sets state to ready. This will initiate the MCS login and notify the
235 // delegates.
fgorski5df101702014-10-28 02:09:31236 void OnReady(const std::vector<AccountMapping>& account_mappings,
237 const base::Time& last_token_fetch_time);
[email protected]b83122a92014-01-22 21:29:29238
[email protected]5799d052014-02-12 20:47:39239 // Starts a first time device checkin.
[email protected]25b5f50e2014-04-03 08:27:23240 void StartCheckin();
[email protected]2c4d4cd2014-04-10 21:10:22241 // Completes the device checkin request by parsing the |checkin_response|.
242 // Function also cleans up the pending checkin.
243 void OnCheckinCompleted(
zea76342abf2016-11-01 17:26:04244 net::HttpStatusCode response_code,
[email protected]2c4d4cd2014-04-10 21:10:22245 const checkin_proto::AndroidCheckinResponse& checkin_response);
[email protected]06e45272014-05-06 03:41:34246
247 // Callback passed to GCMStore::SetGServicesSettings.
248 void SetGServicesSettingsCallback(bool success);
249
[email protected]764c0442014-05-01 04:30:55250 // Schedules next periodic device checkin and makes sure there is at most one
251 // pending checkin at a time. This function is meant to be called after a
252 // successful checkin.
253 void SchedulePeriodicCheckin();
254 // Gets the time until next checkin.
255 base::TimeDelta GetTimeToNextCheckin() const;
[email protected]7df5ef22014-07-17 07:35:58256 // Callback for setting last checkin information in the |gcm_store_|.
257 void SetLastCheckinInfoCallback(bool success);
[email protected]b83122a92014-01-22 21:29:29258
259 // Callback for persisting device credentials in the |gcm_store_|.
260 void SetDeviceCredentialsCallback(bool success);
261
[email protected]3a20a4d2014-03-21 22:54:21262 // Callback for persisting registration info in the |gcm_store_|.
263 void UpdateRegistrationCallback(bool success);
264
[email protected]72d4f252014-08-20 22:34:28265 // Callback for all store operations that do not try to recover, if write in
266 // |gcm_store_| fails.
267 void DefaultStoreCallback(bool success);
268
fgorski9a405102014-11-19 01:25:16269 // Callback for store operation where result does not matter.
270 void IgnoreWriteResultCallback(bool success);
271
jianli78b56042015-06-17 01:21:22272 // Callback for destroying the GCM store.
273 void DestroyStoreCallback(bool success);
274
275 // Callback for resetting the GCM store. The store will be reloaded.
jianli00b4600f2015-02-10 23:32:49276 void ResetStoreCallback(bool success);
277
[email protected]848b1b62014-01-30 23:51:04278 // Completes the registration request.
jianli7a0c9b62015-05-26 23:24:47279 void OnRegisterCompleted(
280 const linked_ptr<RegistrationInfo>& registration_info,
281 RegistrationRequest::Status status,
282 const std::string& registration_id);
[email protected]848b1b62014-01-30 23:51:04283
[email protected]e4007042014-02-15 20:34:28284 // Completes the unregistration request.
jianli7a0c9b62015-05-26 23:24:47285 void OnUnregisterCompleted(
286 const linked_ptr<RegistrationInfo>& registration_info,
287 UnregistrationRequest::Status status);
[email protected]e4007042014-02-15 20:34:28288
[email protected]d3a4b2e2014-02-27 13:46:54289 // Completes the GCM store destroy request.
290 void OnGCMStoreDestroyed(bool success);
291
[email protected]c6fe36b2014-03-11 10:58:12292 // Handles incoming data message and dispatches it the delegate of this class.
[email protected]b83122a92014-01-22 21:29:29293 void HandleIncomingMessage(const gcm::MCSMessage& message);
294
[email protected]c6fe36b2014-03-11 10:58:12295 // Fires OnMessageReceived event on the delegate of this class, based on the
296 // details in |data_message_stanza| and |message_data|.
297 void HandleIncomingDataMessage(
johnme627dc8c72016-08-19 21:49:39298 const std::string& app_id,
299 bool was_subtype,
[email protected]c6fe36b2014-03-11 10:58:12300 const mcs_proto::DataMessageStanza& data_message_stanza,
301 MessageData& message_data);
302
johnme409dc532016-12-13 23:43:42303 // Fires OnMessagesDeleted event on the delegate of this class, based on the
304 // details in |data_message_stanza| and |message_data|.
305 void HandleIncomingDeletedMessages(
306 const std::string& app_id,
307 const mcs_proto::DataMessageStanza& data_message_stanza,
308 MessageData& message_data);
309
johnme627dc8c72016-08-19 21:49:39310 // Fires OnMessageSendError event on the delegate of this class, based on the
[email protected]c6fe36b2014-03-11 10:58:12311 // details in |data_message_stanza| and |message_data|.
312 void HandleIncomingSendError(
johnme627dc8c72016-08-19 21:49:39313 const std::string& app_id,
[email protected]c6fe36b2014-03-11 10:58:12314 const mcs_proto::DataMessageStanza& data_message_stanza,
315 MessageData& message_data);
[email protected]848b1b62014-01-30 23:51:04316
jianlif3e52af42015-01-21 23:18:47317 // Is there any standalone app being registered for GCM?
318 bool HasStandaloneRegisteredApp() const;
319
jianli78b56042015-06-17 01:21:22320 // Destroys the store when it is not needed.
321 void DestroyStoreWhenNotNeeded();
322
323 // Reset all cahced values.
324 void ResetCache();
325
[email protected]2bbe0a682014-03-26 00:08:31326 // Builder for the GCM internals (mcs client, etc.).
dchenga77e28eb2016-04-21 21:34:37327 std::unique_ptr<GCMInternalsBuilder> internals_builder_;
[email protected]b83122a92014-01-22 21:29:29328
[email protected]436bcb82014-04-18 00:40:57329 // Recorder that logs GCM activities.
[email protected]025adfa2014-06-03 21:51:12330 GCMStatsRecorderImpl recorder_;
[email protected]436bcb82014-04-18 00:40:57331
[email protected]b83122a92014-01-22 21:29:29332 // State of the GCM Client Implementation.
333 State state_;
334
[email protected]7de78802014-05-10 19:49:40335 GCMClient::Delegate* delegate_;
[email protected]5799d052014-02-12 20:47:39336
jianlif3e52af42015-01-21 23:18:47337 // Flag to indicate if the GCM should be delay started until it is actually
338 // used in either of the following cases:
339 // 1) The GCM store contains the registration records.
340 // 2) GCM functionailities are explicitly called.
341 StartMode start_mode_;
342
[email protected]b83122a92014-01-22 21:29:29343 // Device checkin info (android ID and security token used by device).
344 CheckinInfo device_checkin_info_;
345
[email protected]848b1b62014-01-30 23:51:04346 // Clock used for timing of retry logic. Passed in for testing. Owned by
347 // GCMClientImpl.
dchenga77e28eb2016-04-21 21:34:37348 std::unique_ptr<base::Clock> clock_;
[email protected]b83122a92014-01-22 21:29:29349
350 // Information about the chrome build.
351 // TODO(fgorski): Check if it can be passed in constructor and made const.
[email protected]8ad80512014-05-23 09:40:47352 ChromeBuildInfo chrome_build_info_;
[email protected]b83122a92014-01-22 21:29:29353
354 // Persistent data store for keeping device credentials, messages and user to
355 // serial number mappings.
dchenga77e28eb2016-04-21 21:34:37356 std::unique_ptr<GCMStore> gcm_store_;
[email protected]b83122a92014-01-22 21:29:29357
jianlif3e52af42015-01-21 23:18:47358 // Data loaded from the GCM store.
dchenga77e28eb2016-04-21 21:34:37359 std::unique_ptr<GCMStore::LoadResult> load_result_;
jianlif3e52af42015-01-21 23:18:47360
jianli00b4600f2015-02-10 23:32:49361 // Tracks if the GCM store has been reset. This is used to prevent from
362 // resetting and loading from the store again and again.
363 bool gcm_store_reset_;
364
dchenga77e28eb2016-04-21 21:34:37365 std::unique_ptr<net::HttpNetworkSession> network_session_;
366 std::unique_ptr<ConnectionFactory> connection_factory_;
[email protected]b83122a92014-01-22 21:29:29367 scoped_refptr<net::URLRequestContextGetter> url_request_context_getter_;
368
369 // Controls receiving and sending of packets and reliable message queueing.
mmenkee65e7af2015-10-13 17:16:42370 // Must be destroyed before |network_session_|.
dchenga77e28eb2016-04-21 21:34:37371 std::unique_ptr<MCSClient> mcs_client_;
[email protected]b83122a92014-01-22 21:29:29372
dchenga77e28eb2016-04-21 21:34:37373 std::unique_ptr<CheckinRequest> checkin_request_;
[email protected]b83122a92014-01-22 21:29:29374
[email protected]3a20a4d2014-03-21 22:54:21375 // Cached registration info.
376 RegistrationInfoMap registrations_;
[email protected]848b1b62014-01-30 23:51:04377
[email protected]3a20a4d2014-03-21 22:54:21378 // Currently pending registration requests. GCMClientImpl owns the
379 // RegistrationRequests.
380 PendingRegistrationRequests pending_registration_requests_;
[email protected]3a20a4d2014-03-21 22:54:21381
382 // Currently pending unregistration requests. GCMClientImpl owns the
[email protected]e4007042014-02-15 20:34:28383 // UnregistrationRequests.
[email protected]3a20a4d2014-03-21 22:54:21384 PendingUnregistrationRequests pending_unregistration_requests_;
[email protected]e4007042014-02-15 20:34:28385
[email protected]764c0442014-05-01 04:30:55386 // G-services settings that were provided by MCS.
[email protected]06e45272014-05-06 03:41:34387 GServicesSettings gservices_settings_;
[email protected]764c0442014-05-01 04:30:55388
389 // Time of the last successful checkin.
390 base::Time last_checkin_time_;
391
jianli7a0c9b62015-05-26 23:24:47392 // Cached instance ID data, key is app ID and value is pair of instance ID
393 // and extra data.
394 std::map<std::string, std::pair<std::string, std::string>> instance_id_data_;
jianli10018b2d2015-05-11 21:14:13395
[email protected]764c0442014-05-01 04:30:55396 // Factory for creating references when scheduling periodic checkin.
397 base::WeakPtrFactory<GCMClientImpl> periodic_checkin_ptr_factory_;
398
jianli78b56042015-06-17 01:21:22399 // Factory for wiping out GCM store.
400 base::WeakPtrFactory<GCMClientImpl> destroying_gcm_store_ptr_factory_;
401
[email protected]955e0ff2014-01-31 20:42:12402 // Factory for creating references in callbacks.
403 base::WeakPtrFactory<GCMClientImpl> weak_ptr_factory_;
404
[email protected]e4097c82013-11-08 00:16:12405 DISALLOW_COPY_AND_ASSIGN(GCMClientImpl);
406};
407
408} // namespace gcm
409
[email protected]cd57f372014-06-09 17:13:06410#endif // COMPONENTS_GCM_DRIVER_GCM_CLIENT_IMPL_H_