blob: 5f9edd648eebdf84438a39dc8e55d7b55e500c3a [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"
Helen Li5f3d96a2018-08-10 20:37:2432#include "services/network/public/mojom/proxy_resolving_socket.mojom.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
Maks Orlovichc70c93c2018-07-12 02:45:4445namespace network {
46class SharedURLLoaderFactory;
47} // namespace network
48
[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
tzik48479d92018-03-20 15:20:4262 virtual base::Clock* GetClock();
dchenga77e28eb2016-04-21 21:34:3763 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,
Helen Li5f3d96a2018-08-10 20:37:2472 base::RepeatingCallback<
73 void(network::mojom::ProxyResolvingSocketFactoryRequest)>
74 get_socket_factory_callback,
[email protected]9df5b932014-04-30 00:39:0675 GCMStatsRecorder* recorder);
[email protected]2bbe0a682014-03-26 00:08:3176};
77
[email protected]b83122a92014-01-22 21:29:2978// Implements the GCM Client. It is used to coordinate MCS Client (communication
79// with MCS) and other pieces of GCM infrastructure like Registration and
80// Checkins. It also allows for registering user delegates that host
81// applications that send and receive messages.
[email protected]cd57f372014-06-09 17:13:0682class GCMClientImpl
[email protected]c31e1b52014-06-12 21:00:4783 : public GCMClient, public GCMStatsRecorder::Delegate,
84 public ConnectionFactory::ConnectionListener {
[email protected]e4097c82013-11-08 00:16:1285 public:
jianlif3e52af42015-01-21 23:18:4786 // State representation of the GCMClient.
87 // Any change made to this enum should have corresponding change in the
88 // GetStateString(...) function.
89 enum State {
90 // Uninitialized.
91 UNINITIALIZED,
92 // Initialized,
93 INITIALIZED,
94 // GCM store loading is in progress.
95 LOADING,
96 // GCM store is loaded.
97 LOADED,
98 // Initial device checkin is in progress.
99 INITIAL_DEVICE_CHECKIN,
100 // Ready to accept requests.
101 READY,
102 };
103
dchenga77e28eb2016-04-21 21:34:37104 explicit GCMClientImpl(
105 std::unique_ptr<GCMInternalsBuilder> internals_builder);
dcheng00ea022b2014-10-21 11:24:56106 ~GCMClientImpl() override;
[email protected]e4097c82013-11-08 00:16:12107
[email protected]c31e1b52014-06-12 21:00:47108 // GCMClient implementation.
dcheng00ea022b2014-10-21 11:24:56109 void Initialize(
[email protected]8ad80512014-05-23 09:40:47110 const ChromeBuildInfo& chrome_build_info,
[email protected]e2a4a8012014-02-07 22:32:52111 const base::FilePath& store_path,
112 const scoped_refptr<base::SequencedTaskRunner>& blocking_task_runner,
Helen Li5f3d96a2018-08-10 20:37:24113 base::RepeatingCallback<
114 void(network::mojom::ProxyResolvingSocketFactoryRequest)>
115 get_socket_factory_callback,
Maks Orlovichc70c93c2018-07-12 02:45:44116 const scoped_refptr<network::SharedURLLoaderFactory>& url_loader_factory,
dchenga77e28eb2016-04-21 21:34:37117 std::unique_ptr<Encryptor> encryptor,
mostynbfe59f482014-10-06 15:04:46118 GCMClient::Delegate* delegate) override;
jianlif3e52af42015-01-21 23:18:47119 void Start(StartMode start_mode) override;
dcheng00ea022b2014-10-21 11:24:56120 void Stop() override;
jianli7a0c9b62015-05-26 23:24:47121 void Register(const linked_ptr<RegistrationInfo>& registration_info) override;
johnme6576ecf2017-04-03 19:26:28122 bool ValidateRegistration(
123 const linked_ptr<RegistrationInfo>& registration_info,
124 const std::string& registration_id) override;
jianli7a0c9b62015-05-26 23:24:47125 void Unregister(
126 const linked_ptr<RegistrationInfo>& registration_info) override;
dcheng00ea022b2014-10-21 11:24:56127 void Send(const std::string& app_id,
128 const std::string& receiver_id,
129 const OutgoingMessage& message) override;
peteree284ba52016-02-01 11:53:28130 void RecordDecryptionFailure(const std::string& app_id,
Peter Beverlooa376e98c2017-06-27 15:55:37131 GCMDecryptionResult result) override;
dcheng00ea022b2014-10-21 11:24:56132 void SetRecording(bool recording) override;
133 void ClearActivityLogs() override;
134 GCMStatistics GetStatistics() const override;
135 void SetAccountTokens(
mostynbfe59f482014-10-06 15:04:46136 const std::vector<AccountTokenInfo>& account_tokens) override;
dcheng00ea022b2014-10-21 11:24:56137 void UpdateAccountMapping(const AccountMapping& account_mapping) override;
138 void RemoveAccountMapping(const std::string& account_id) override;
fgorski5df101702014-10-28 02:09:31139 void SetLastTokenFetchTime(const base::Time& time) override;
tzikb6c66b22018-07-06 12:14:16140 void UpdateHeartbeatTimer(
141 std::unique_ptr<base::RetainingOneShotTimer> timer) override;
jianli10018b2d2015-05-11 21:14:13142 void AddInstanceIDData(const std::string& app_id,
jianli7a0c9b62015-05-26 23:24:47143 const std::string& instance_id,
144 const std::string& extra_data) override;
jianli10018b2d2015-05-11 21:14:13145 void RemoveInstanceIDData(const std::string& app_id) override;
jianli7a0c9b62015-05-26 23:24:47146 void GetInstanceIDData(const std::string& app_id,
147 std::string* instance_id,
148 std::string* extra_data) override;
fgorski22754462015-05-14 00:05:22149 void AddHeartbeatInterval(const std::string& scope, int interval_ms) override;
150 void RemoveHeartbeatInterval(const std::string& scope) override;
[email protected]c31e1b52014-06-12 21:00:47151
152 // GCMStatsRecorder::Delegate implemenation.
dcheng00ea022b2014-10-21 11:24:56153 void OnActivityRecorded() override;
[email protected]e4097c82013-11-08 00:16:12154
[email protected]c31e1b52014-06-12 21:00:47155 // ConnectionFactory::ConnectionListener implementation.
dcheng00ea022b2014-10-21 11:24:56156 void OnConnected(const GURL& current_server,
157 const net::IPEndPoint& ip_endpoint) override;
158 void OnDisconnected() override;
[email protected]c31e1b52014-06-12 21:00:47159
[email protected]e4097c82013-11-08 00:16:12160 private:
[email protected]7df5ef22014-07-17 07:35:58161 // The check-in info for the device.
162 // TODO(fgorski): Convert to a class with explicit getters/setters.
[email protected]cd57f372014-06-09 17:13:06163 struct CheckinInfo {
[email protected]7df5ef22014-07-17 07:35:58164 CheckinInfo();
165 ~CheckinInfo();
[email protected]5799d052014-02-12 20:47:39166 bool IsValid() const { return android_id != 0 && secret != 0; }
[email protected]7df5ef22014-07-17 07:35:58167 void SnapshotCheckinAccounts();
168 void Reset();
[email protected]b83122a92014-01-22 21:29:29169
[email protected]7df5ef22014-07-17 07:35:58170 // Android ID of the device as assigned by the server.
avi26062922015-12-26 00:14:18171 uint64_t android_id;
[email protected]7df5ef22014-07-17 07:35:58172 // Security token of the device as assigned by the server.
avi26062922015-12-26 00:14:18173 uint64_t secret;
[email protected]7df5ef22014-07-17 07:35:58174 // True if accounts were already provided through SetAccountsForCheckin(),
175 // or when |last_checkin_accounts| was loaded as empty.
176 bool accounts_set;
177 // Map of account email addresses and OAuth2 tokens that will be sent to the
178 // checkin server on a next checkin.
179 std::map<std::string, std::string> account_tokens;
180 // As set of accounts last checkin was completed with.
181 std::set<std::string> last_checkin_accounts;
[email protected]848b1b62014-01-30 23:51:04182 };
183
zeae6e404182016-11-04 23:05:45184 // Reasons for resetting the GCM Store.
185 // Note: this enum is recorded into a histogram. Do not change enum value
186 // or order.
187 enum ResetReason {
188 LOAD_FAILURE, // GCM store failed to load, but the store exists.
189 CHECKIN_REJECTED, // Checkin was rejected by server.
190
191 RESET_REASON_COUNT,
192 };
193
jianli7a0c9b62015-05-26 23:24:47194 // Collection of pending registration requests. Keys are RegistrationInfo
195 // instance, while values are pending registration requests to obtain a
196 // registration ID for requesting application.
dchenga77e28eb2016-04-21 21:34:37197 using PendingRegistrationRequests =
198 std::map<linked_ptr<RegistrationInfo>,
199 std::unique_ptr<RegistrationRequest>,
200 RegistrationInfoComparer>;
[email protected]848b1b62014-01-30 23:51:04201
jianli7a0c9b62015-05-26 23:24:47202 // Collection of pending unregistration requests. Keys are RegistrationInfo
203 // instance, while values are pending unregistration requests to disable the
204 // registration ID currently assigned to the application.
limasdf20c5d7a2015-12-01 01:16:19205 using PendingUnregistrationRequests =
206 std::map<linked_ptr<RegistrationInfo>,
dchenga77e28eb2016-04-21 21:34:37207 std::unique_ptr<UnregistrationRequest>,
limasdf20c5d7a2015-12-01 01:16:19208 RegistrationInfoComparer>;
[email protected]e4007042014-02-15 20:34:28209
[email protected]b83122a92014-01-22 21:29:29210 friend class GCMClientImplTest;
jianlic02d25e2015-05-27 22:24:31211 friend class GCMClientInstanceIDTest;
[email protected]b83122a92014-01-22 21:29:29212
[email protected]35601812014-03-07 19:52:43213 // Returns text representation of the enum State.
214 std::string GetStateString() const;
215
[email protected]b83122a92014-01-22 21:29:29216 // Callbacks for the MCSClient.
217 // Receives messages and dispatches them to relevant user delegates.
218 void OnMessageReceivedFromMCS(const gcm::MCSMessage& message);
219 // Receives confirmation of sent messages or information about errors.
avi26062922015-12-26 00:14:18220 void OnMessageSentToMCS(int64_t user_serial_number,
[email protected]b83122a92014-01-22 21:29:29221 const std::string& app_id,
222 const std::string& message_id,
223 MCSClient::MessageSendStatus status);
224 // Receives information about mcs_client_ errors.
225 void OnMCSError();
226
227 // Runs after GCM Store load is done to trigger continuation of the
228 // initialization.
dchenga77e28eb2016-04-21 21:34:37229 void OnLoadCompleted(std::unique_ptr<GCMStore::LoadResult> result);
jianlif3e52af42015-01-21 23:18:47230 // Starts the GCM.
231 void StartGCM();
[email protected]b83122a92014-01-22 21:29:29232 // Initializes mcs_client_, which handles the connection to MCS.
jianlif3e52af42015-01-21 23:18:47233 void InitializeMCSClient();
[email protected]b83122a92014-01-22 21:29:29234 // Complets the first time device checkin.
235 void OnFirstTimeDeviceCheckinCompleted(const CheckinInfo& checkin_info);
236 // Starts a login on mcs_client_.
237 void StartMCSLogin();
jianli00b4600f2015-02-10 23:32:49238 // Resets the GCM store when it is corrupted.
239 void ResetStore();
[email protected]86625df2014-01-31 03:47:58240 // Sets state to ready. This will initiate the MCS login and notify the
241 // delegates.
fgorski5df101702014-10-28 02:09:31242 void OnReady(const std::vector<AccountMapping>& account_mappings,
243 const base::Time& last_token_fetch_time);
[email protected]b83122a92014-01-22 21:29:29244
[email protected]5799d052014-02-12 20:47:39245 // Starts a first time device checkin.
[email protected]25b5f50e2014-04-03 08:27:23246 void StartCheckin();
[email protected]2c4d4cd2014-04-10 21:10:22247 // Completes the device checkin request by parsing the |checkin_response|.
248 // Function also cleans up the pending checkin.
249 void OnCheckinCompleted(
zea76342abf2016-11-01 17:26:04250 net::HttpStatusCode response_code,
[email protected]2c4d4cd2014-04-10 21:10:22251 const checkin_proto::AndroidCheckinResponse& checkin_response);
[email protected]06e45272014-05-06 03:41:34252
253 // Callback passed to GCMStore::SetGServicesSettings.
254 void SetGServicesSettingsCallback(bool success);
255
[email protected]764c0442014-05-01 04:30:55256 // Schedules next periodic device checkin and makes sure there is at most one
257 // pending checkin at a time. This function is meant to be called after a
258 // successful checkin.
259 void SchedulePeriodicCheckin();
260 // Gets the time until next checkin.
261 base::TimeDelta GetTimeToNextCheckin() const;
[email protected]7df5ef22014-07-17 07:35:58262 // Callback for setting last checkin information in the |gcm_store_|.
263 void SetLastCheckinInfoCallback(bool success);
[email protected]b83122a92014-01-22 21:29:29264
265 // Callback for persisting device credentials in the |gcm_store_|.
266 void SetDeviceCredentialsCallback(bool success);
267
[email protected]3a20a4d2014-03-21 22:54:21268 // Callback for persisting registration info in the |gcm_store_|.
269 void UpdateRegistrationCallback(bool success);
270
[email protected]72d4f252014-08-20 22:34:28271 // Callback for all store operations that do not try to recover, if write in
272 // |gcm_store_| fails.
273 void DefaultStoreCallback(bool success);
274
fgorski9a405102014-11-19 01:25:16275 // Callback for store operation where result does not matter.
276 void IgnoreWriteResultCallback(bool success);
277
jianli78b56042015-06-17 01:21:22278 // Callback for destroying the GCM store.
279 void DestroyStoreCallback(bool success);
280
281 // Callback for resetting the GCM store. The store will be reloaded.
jianli00b4600f2015-02-10 23:32:49282 void ResetStoreCallback(bool success);
283
[email protected]848b1b62014-01-30 23:51:04284 // Completes the registration request.
jianli7a0c9b62015-05-26 23:24:47285 void OnRegisterCompleted(
286 const linked_ptr<RegistrationInfo>& registration_info,
287 RegistrationRequest::Status status,
288 const std::string& registration_id);
[email protected]848b1b62014-01-30 23:51:04289
[email protected]e4007042014-02-15 20:34:28290 // Completes the unregistration request.
jianli7a0c9b62015-05-26 23:24:47291 void OnUnregisterCompleted(
292 const linked_ptr<RegistrationInfo>& registration_info,
293 UnregistrationRequest::Status status);
[email protected]e4007042014-02-15 20:34:28294
[email protected]d3a4b2e2014-02-27 13:46:54295 // Completes the GCM store destroy request.
296 void OnGCMStoreDestroyed(bool success);
297
[email protected]c6fe36b2014-03-11 10:58:12298 // Handles incoming data message and dispatches it the delegate of this class.
[email protected]b83122a92014-01-22 21:29:29299 void HandleIncomingMessage(const gcm::MCSMessage& message);
300
[email protected]c6fe36b2014-03-11 10:58:12301 // Fires OnMessageReceived event on the delegate of this class, based on the
302 // details in |data_message_stanza| and |message_data|.
303 void HandleIncomingDataMessage(
johnme627dc8c72016-08-19 21:49:39304 const std::string& app_id,
305 bool was_subtype,
[email protected]c6fe36b2014-03-11 10:58:12306 const mcs_proto::DataMessageStanza& data_message_stanza,
307 MessageData& message_data);
308
johnme409dc532016-12-13 23:43:42309 // Fires OnMessagesDeleted event on the delegate of this class, based on the
310 // details in |data_message_stanza| and |message_data|.
311 void HandleIncomingDeletedMessages(
312 const std::string& app_id,
313 const mcs_proto::DataMessageStanza& data_message_stanza,
314 MessageData& message_data);
315
johnme627dc8c72016-08-19 21:49:39316 // Fires OnMessageSendError event on the delegate of this class, based on the
[email protected]c6fe36b2014-03-11 10:58:12317 // details in |data_message_stanza| and |message_data|.
318 void HandleIncomingSendError(
johnme627dc8c72016-08-19 21:49:39319 const std::string& app_id,
[email protected]c6fe36b2014-03-11 10:58:12320 const mcs_proto::DataMessageStanza& data_message_stanza,
321 MessageData& message_data);
[email protected]848b1b62014-01-30 23:51:04322
jianlif3e52af42015-01-21 23:18:47323 // Is there any standalone app being registered for GCM?
324 bool HasStandaloneRegisteredApp() const;
325
jianli78b56042015-06-17 01:21:22326 // Destroys the store when it is not needed.
327 void DestroyStoreWhenNotNeeded();
328
329 // Reset all cahced values.
330 void ResetCache();
331
[email protected]2bbe0a682014-03-26 00:08:31332 // Builder for the GCM internals (mcs client, etc.).
dchenga77e28eb2016-04-21 21:34:37333 std::unique_ptr<GCMInternalsBuilder> internals_builder_;
[email protected]b83122a92014-01-22 21:29:29334
[email protected]436bcb82014-04-18 00:40:57335 // Recorder that logs GCM activities.
[email protected]025adfa2014-06-03 21:51:12336 GCMStatsRecorderImpl recorder_;
[email protected]436bcb82014-04-18 00:40:57337
[email protected]b83122a92014-01-22 21:29:29338 // State of the GCM Client Implementation.
339 State state_;
340
[email protected]7de78802014-05-10 19:49:40341 GCMClient::Delegate* delegate_;
[email protected]5799d052014-02-12 20:47:39342
jianlif3e52af42015-01-21 23:18:47343 // Flag to indicate if the GCM should be delay started until it is actually
344 // used in either of the following cases:
345 // 1) The GCM store contains the registration records.
346 // 2) GCM functionailities are explicitly called.
347 StartMode start_mode_;
348
[email protected]b83122a92014-01-22 21:29:29349 // Device checkin info (android ID and security token used by device).
350 CheckinInfo device_checkin_info_;
351
tzik48479d92018-03-20 15:20:42352 // Clock used for timing of retry logic. Passed in for testing.
353 base::Clock* clock_;
[email protected]b83122a92014-01-22 21:29:29354
355 // Information about the chrome build.
356 // TODO(fgorski): Check if it can be passed in constructor and made const.
[email protected]8ad80512014-05-23 09:40:47357 ChromeBuildInfo chrome_build_info_;
[email protected]b83122a92014-01-22 21:29:29358
359 // Persistent data store for keeping device credentials, messages and user to
360 // serial number mappings.
dchenga77e28eb2016-04-21 21:34:37361 std::unique_ptr<GCMStore> gcm_store_;
[email protected]b83122a92014-01-22 21:29:29362
jianlif3e52af42015-01-21 23:18:47363 // Data loaded from the GCM store.
dchenga77e28eb2016-04-21 21:34:37364 std::unique_ptr<GCMStore::LoadResult> load_result_;
jianlif3e52af42015-01-21 23:18:47365
jianli00b4600f2015-02-10 23:32:49366 // Tracks if the GCM store has been reset. This is used to prevent from
367 // resetting and loading from the store again and again.
368 bool gcm_store_reset_;
369
dchenga77e28eb2016-04-21 21:34:37370 std::unique_ptr<ConnectionFactory> connection_factory_;
Helen Li5f3d96a2018-08-10 20:37:24371 base::RepeatingCallback<void(
372 network::mojom::ProxyResolvingSocketFactoryRequest)>
373 get_socket_factory_callback_;
374
Maks Orlovichc70c93c2018-07-12 02:45:44375 scoped_refptr<network::SharedURLLoaderFactory> url_loader_factory_;
[email protected]b83122a92014-01-22 21:29:29376
377 // Controls receiving and sending of packets and reliable message queueing.
mmenkee65e7af2015-10-13 17:16:42378 // Must be destroyed before |network_session_|.
dchenga77e28eb2016-04-21 21:34:37379 std::unique_ptr<MCSClient> mcs_client_;
[email protected]b83122a92014-01-22 21:29:29380
dchenga77e28eb2016-04-21 21:34:37381 std::unique_ptr<CheckinRequest> checkin_request_;
[email protected]b83122a92014-01-22 21:29:29382
[email protected]3a20a4d2014-03-21 22:54:21383 // Cached registration info.
384 RegistrationInfoMap registrations_;
[email protected]848b1b62014-01-30 23:51:04385
[email protected]3a20a4d2014-03-21 22:54:21386 // Currently pending registration requests. GCMClientImpl owns the
387 // RegistrationRequests.
388 PendingRegistrationRequests pending_registration_requests_;
[email protected]3a20a4d2014-03-21 22:54:21389
390 // Currently pending unregistration requests. GCMClientImpl owns the
[email protected]e4007042014-02-15 20:34:28391 // UnregistrationRequests.
[email protected]3a20a4d2014-03-21 22:54:21392 PendingUnregistrationRequests pending_unregistration_requests_;
[email protected]e4007042014-02-15 20:34:28393
[email protected]764c0442014-05-01 04:30:55394 // G-services settings that were provided by MCS.
[email protected]06e45272014-05-06 03:41:34395 GServicesSettings gservices_settings_;
[email protected]764c0442014-05-01 04:30:55396
397 // Time of the last successful checkin.
398 base::Time last_checkin_time_;
399
jianli7a0c9b62015-05-26 23:24:47400 // Cached instance ID data, key is app ID and value is pair of instance ID
401 // and extra data.
402 std::map<std::string, std::pair<std::string, std::string>> instance_id_data_;
jianli10018b2d2015-05-11 21:14:13403
[email protected]764c0442014-05-01 04:30:55404 // Factory for creating references when scheduling periodic checkin.
405 base::WeakPtrFactory<GCMClientImpl> periodic_checkin_ptr_factory_;
406
jianli78b56042015-06-17 01:21:22407 // Factory for wiping out GCM store.
408 base::WeakPtrFactory<GCMClientImpl> destroying_gcm_store_ptr_factory_;
409
[email protected]955e0ff2014-01-31 20:42:12410 // Factory for creating references in callbacks.
411 base::WeakPtrFactory<GCMClientImpl> weak_ptr_factory_;
412
[email protected]e4097c82013-11-08 00:16:12413 DISALLOW_COPY_AND_ASSIGN(GCMClientImpl);
414};
415
416} // namespace gcm
417
[email protected]cd57f372014-06-09 17:13:06418#endif // COMPONENTS_GCM_DRIVER_GCM_CLIENT_IMPL_H_