[email protected] | e4097c8 | 2013-11-08 00:16:12 | [diff] [blame] | 1 | // Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 | // Use of this source code is governed by a BSD-style license that can be |
| 3 | // found in the LICENSE file. |
| 4 | |
| 5 | #ifndef GOOGLE_APIS_GCM_GCM_CLIENT_IMPL_H_ |
| 6 | #define GOOGLE_APIS_GCM_GCM_CLIENT_IMPL_H_ |
| 7 | |
[email protected] | b83122a9 | 2014-01-22 21:29:29 | [diff] [blame] | 8 | #include <map> |
| 9 | #include <string> |
[email protected] | 848b1b6 | 2014-01-30 23:51:04 | [diff] [blame] | 10 | #include <vector> |
[email protected] | b83122a9 | 2014-01-22 21:29:29 | [diff] [blame] | 11 | |
[email protected] | e4097c8 | 2013-11-08 00:16:12 | [diff] [blame] | 12 | #include "base/compiler_specific.h" |
[email protected] | 79994f4 | 2014-01-16 16:05:36 | [diff] [blame] | 13 | #include "base/memory/ref_counted.h" |
[email protected] | 955e0ff | 2014-01-31 20:42:12 | [diff] [blame] | 14 | #include "base/memory/weak_ptr.h" |
[email protected] | b83122a9 | 2014-01-22 21:29:29 | [diff] [blame] | 15 | #include "base/stl_util.h" |
[email protected] | b83122a9 | 2014-01-22 21:29:29 | [diff] [blame] | 16 | #include "google_apis/gcm/base/mcs_message.h" |
| 17 | #include "google_apis/gcm/engine/gcm_store.h" |
[email protected] | 06e4527 | 2014-05-06 03:41:34 | [diff] [blame] | 18 | #include "google_apis/gcm/engine/gservices_settings.h" |
[email protected] | b83122a9 | 2014-01-22 21:29:29 | [diff] [blame] | 19 | #include "google_apis/gcm/engine/mcs_client.h" |
[email protected] | b4dd023 | 2014-02-08 02:37:31 | [diff] [blame] | 20 | #include "google_apis/gcm/engine/registration_request.h" |
[email protected] | 0e88e1d1 | 2014-03-19 06:53:08 | [diff] [blame] | 21 | #include "google_apis/gcm/engine/unregistration_request.h" |
[email protected] | e4097c8 | 2013-11-08 00:16:12 | [diff] [blame] | 22 | #include "google_apis/gcm/gcm_client.h" |
[email protected] | 436bcb8 | 2014-04-18 00:40:57 | [diff] [blame] | 23 | #include "google_apis/gcm/monitoring/gcm_stats_recorder.h" |
| 24 | #include "google_apis/gcm/protocol/android_checkin.pb.h" |
[email protected] | 2c4d4cd | 2014-04-10 21:10:22 | [diff] [blame] | 25 | #include "google_apis/gcm/protocol/checkin.pb.h" |
[email protected] | b83122a9 | 2014-01-22 21:29:29 | [diff] [blame] | 26 | #include "net/base/net_log.h" |
| 27 | #include "net/url_request/url_request_context_getter.h" |
[email protected] | e4097c8 | 2013-11-08 00:16:12 | [diff] [blame] | 28 | |
[email protected] | 2bbe0a68 | 2014-03-26 00:08:31 | [diff] [blame] | 29 | class GURL; |
| 30 | |
[email protected] | 79994f4 | 2014-01-16 16:05:36 | [diff] [blame] | 31 | namespace base { |
[email protected] | 955e0ff | 2014-01-31 20:42:12 | [diff] [blame] | 32 | class Clock; |
[email protected] | 764c044 | 2014-05-01 04:30:55 | [diff] [blame] | 33 | class Time; |
[email protected] | 79994f4 | 2014-01-16 16:05:36 | [diff] [blame] | 34 | } // namespace base |
| 35 | |
[email protected] | 436bcb8 | 2014-04-18 00:40:57 | [diff] [blame] | 36 | namespace mcs_proto { |
| 37 | class DataMessageStanza; |
| 38 | } // namespace mcs_proto |
| 39 | |
[email protected] | b83122a9 | 2014-01-22 21:29:29 | [diff] [blame] | 40 | namespace net { |
| 41 | class HttpNetworkSession; |
[email protected] | 955e0ff | 2014-01-31 20:42:12 | [diff] [blame] | 42 | } // namespace net |
[email protected] | b83122a9 | 2014-01-22 21:29:29 | [diff] [blame] | 43 | |
[email protected] | e4097c8 | 2013-11-08 00:16:12 | [diff] [blame] | 44 | namespace gcm { |
| 45 | |
[email protected] | b83122a9 | 2014-01-22 21:29:29 | [diff] [blame] | 46 | class CheckinRequest; |
| 47 | class ConnectionFactory; |
| 48 | class GCMClientImplTest; |
[email protected] | 79994f4 | 2014-01-16 16:05:36 | [diff] [blame] | 49 | |
[email protected] | 2bbe0a68 | 2014-03-26 00:08:31 | [diff] [blame] | 50 | // Helper class for building GCM internals. Allows tests to inject fake versions |
| 51 | // as necessary. |
| 52 | class GCM_EXPORT GCMInternalsBuilder { |
| 53 | public: |
| 54 | GCMInternalsBuilder(); |
| 55 | virtual ~GCMInternalsBuilder(); |
| 56 | |
| 57 | virtual scoped_ptr<base::Clock> BuildClock(); |
| 58 | virtual scoped_ptr<MCSClient> BuildMCSClient( |
| 59 | const std::string& version, |
| 60 | base::Clock* clock, |
| 61 | ConnectionFactory* connection_factory, |
[email protected] | 436bcb8 | 2014-04-18 00:40:57 | [diff] [blame] | 62 | GCMStore* gcm_store, |
| 63 | GCMStatsRecorder* recorder); |
[email protected] | 2bbe0a68 | 2014-03-26 00:08:31 | [diff] [blame] | 64 | virtual scoped_ptr<ConnectionFactory> BuildConnectionFactory( |
| 65 | const std::vector<GURL>& endpoints, |
| 66 | const net::BackoffEntry::Policy& backoff_policy, |
| 67 | scoped_refptr<net::HttpNetworkSession> network_session, |
[email protected] | 9df5b93 | 2014-04-30 00:39:06 | [diff] [blame] | 68 | net::NetLog* net_log, |
| 69 | GCMStatsRecorder* recorder); |
[email protected] | 2bbe0a68 | 2014-03-26 00:08:31 | [diff] [blame] | 70 | }; |
| 71 | |
[email protected] | b83122a9 | 2014-01-22 21:29:29 | [diff] [blame] | 72 | // Implements the GCM Client. It is used to coordinate MCS Client (communication |
| 73 | // with MCS) and other pieces of GCM infrastructure like Registration and |
| 74 | // Checkins. It also allows for registering user delegates that host |
| 75 | // applications that send and receive messages. |
[email protected] | 7de7880 | 2014-05-10 19:49:40 | [diff] [blame] | 76 | class GCM_EXPORT GCMClientImpl |
| 77 | : public GCMClient, public GCMStatsRecorder::Delegate { |
[email protected] | e4097c8 | 2013-11-08 00:16:12 | [diff] [blame] | 78 | public: |
[email protected] | 2bbe0a68 | 2014-03-26 00:08:31 | [diff] [blame] | 79 | explicit GCMClientImpl(scoped_ptr<GCMInternalsBuilder> internals_builder); |
[email protected] | e4097c8 | 2013-11-08 00:16:12 | [diff] [blame] | 80 | virtual ~GCMClientImpl(); |
| 81 | |
| 82 | // Overridden from GCMClient: |
[email protected] | e2a4a801 | 2014-02-07 22:32:52 | [diff] [blame] | 83 | virtual void Initialize( |
[email protected] | 8ad8051 | 2014-05-23 09:40:47 | [diff] [blame^] | 84 | const ChromeBuildInfo& chrome_build_info, |
[email protected] | e2a4a801 | 2014-02-07 22:32:52 | [diff] [blame] | 85 | const base::FilePath& store_path, |
[email protected] | 495a7db9 | 2014-02-22 07:49:59 | [diff] [blame] | 86 | const std::vector<std::string>& account_ids, |
[email protected] | e2a4a801 | 2014-02-07 22:32:52 | [diff] [blame] | 87 | const scoped_refptr<base::SequencedTaskRunner>& blocking_task_runner, |
| 88 | const scoped_refptr<net::URLRequestContextGetter>& |
[email protected] | 5799d05 | 2014-02-12 20:47:39 | [diff] [blame] | 89 | url_request_context_getter, |
[email protected] | 446f73c2 | 2014-05-14 20:47:18 | [diff] [blame] | 90 | scoped_ptr<Encryptor> encryptor, |
[email protected] | 7de7880 | 2014-05-10 19:49:40 | [diff] [blame] | 91 | GCMClient::Delegate* delegate) OVERRIDE; |
[email protected] | fc767e4 | 2014-05-13 05:02:14 | [diff] [blame] | 92 | virtual void Start() OVERRIDE; |
[email protected] | 21fee548 | 2014-03-05 00:57:15 | [diff] [blame] | 93 | virtual void Stop() OVERRIDE; |
[email protected] | 5799d05 | 2014-02-12 20:47:39 | [diff] [blame] | 94 | virtual void CheckOut() OVERRIDE; |
| 95 | virtual void Register(const std::string& app_id, |
[email protected] | e4097c8 | 2013-11-08 00:16:12 | [diff] [blame] | 96 | const std::vector<std::string>& sender_ids) OVERRIDE; |
[email protected] | 5799d05 | 2014-02-12 20:47:39 | [diff] [blame] | 97 | virtual void Unregister(const std::string& app_id) OVERRIDE; |
| 98 | virtual void Send(const std::string& app_id, |
[email protected] | e4097c8 | 2013-11-08 00:16:12 | [diff] [blame] | 99 | const std::string& receiver_id, |
| 100 | const OutgoingMessage& message) OVERRIDE; |
[email protected] | 436bcb8 | 2014-04-18 00:40:57 | [diff] [blame] | 101 | virtual void SetRecording(bool recording) OVERRIDE; |
| 102 | virtual void ClearActivityLogs() OVERRIDE; |
[email protected] | 3560181 | 2014-03-07 19:52:43 | [diff] [blame] | 103 | virtual GCMStatistics GetStatistics() const OVERRIDE; |
[email protected] | 7de7880 | 2014-05-10 19:49:40 | [diff] [blame] | 104 | virtual void OnActivityRecorded() OVERRIDE; |
[email protected] | e4097c8 | 2013-11-08 00:16:12 | [diff] [blame] | 105 | |
| 106 | private: |
[email protected] | b83122a9 | 2014-01-22 21:29:29 | [diff] [blame] | 107 | // State representation of the GCMClient. |
[email protected] | 3560181 | 2014-03-07 19:52:43 | [diff] [blame] | 108 | // Any change made to this enum should have corresponding change in the |
| 109 | // GetStateString(...) function. |
[email protected] | b83122a9 | 2014-01-22 21:29:29 | [diff] [blame] | 110 | enum State { |
| 111 | // Uninitialized. |
| 112 | UNINITIALIZED, |
[email protected] | d3a4b2e | 2014-02-27 13:46:54 | [diff] [blame] | 113 | // Initialized, |
| 114 | INITIALIZED, |
[email protected] | b83122a9 | 2014-01-22 21:29:29 | [diff] [blame] | 115 | // GCM store loading is in progress. |
| 116 | LOADING, |
| 117 | // Initial device checkin is in progress. |
| 118 | INITIAL_DEVICE_CHECKIN, |
| 119 | // Ready to accept requests. |
| 120 | READY, |
| 121 | }; |
| 122 | |
[email protected] | 5799d05 | 2014-02-12 20:47:39 | [diff] [blame] | 123 | // The check-in info for the user. Returned by the server. |
| 124 | struct GCM_EXPORT CheckinInfo { |
| 125 | CheckinInfo() : android_id(0), secret(0) {} |
| 126 | bool IsValid() const { return android_id != 0 && secret != 0; } |
| 127 | void Reset() { |
| 128 | android_id = 0; |
| 129 | secret = 0; |
| 130 | } |
[email protected] | b83122a9 | 2014-01-22 21:29:29 | [diff] [blame] | 131 | |
[email protected] | 5799d05 | 2014-02-12 20:47:39 | [diff] [blame] | 132 | uint64 android_id; |
| 133 | uint64 secret; |
[email protected] | 848b1b6 | 2014-01-30 23:51:04 | [diff] [blame] | 134 | }; |
| 135 | |
[email protected] | e400704 | 2014-02-15 20:34:28 | [diff] [blame] | 136 | // Collection of pending registration requests. Keys are app IDs, while values |
[email protected] | 5799d05 | 2014-02-12 20:47:39 | [diff] [blame] | 137 | // are pending registration requests to obtain a registration ID for |
| 138 | // requesting application. |
| 139 | typedef std::map<std::string, RegistrationRequest*> |
[email protected] | 3a20a4d | 2014-03-21 22:54:21 | [diff] [blame] | 140 | PendingRegistrationRequests; |
[email protected] | 848b1b6 | 2014-01-30 23:51:04 | [diff] [blame] | 141 | |
[email protected] | e400704 | 2014-02-15 20:34:28 | [diff] [blame] | 142 | // Collection of pending unregistration requests. Keys are app IDs, while |
| 143 | // values are pending unregistration requests to disable the registration ID |
| 144 | // currently assigned to the application. |
| 145 | typedef std::map<std::string, UnregistrationRequest*> |
[email protected] | 3a20a4d | 2014-03-21 22:54:21 | [diff] [blame] | 146 | PendingUnregistrationRequests; |
[email protected] | e400704 | 2014-02-15 20:34:28 | [diff] [blame] | 147 | |
[email protected] | b83122a9 | 2014-01-22 21:29:29 | [diff] [blame] | 148 | friend class GCMClientImplTest; |
| 149 | |
[email protected] | 3560181 | 2014-03-07 19:52:43 | [diff] [blame] | 150 | // Returns text representation of the enum State. |
| 151 | std::string GetStateString() const; |
| 152 | |
[email protected] | b83122a9 | 2014-01-22 21:29:29 | [diff] [blame] | 153 | // Callbacks for the MCSClient. |
| 154 | // Receives messages and dispatches them to relevant user delegates. |
| 155 | void OnMessageReceivedFromMCS(const gcm::MCSMessage& message); |
| 156 | // Receives confirmation of sent messages or information about errors. |
| 157 | void OnMessageSentToMCS(int64 user_serial_number, |
| 158 | const std::string& app_id, |
| 159 | const std::string& message_id, |
| 160 | MCSClient::MessageSendStatus status); |
| 161 | // Receives information about mcs_client_ errors. |
| 162 | void OnMCSError(); |
| 163 | |
| 164 | // Runs after GCM Store load is done to trigger continuation of the |
| 165 | // initialization. |
[email protected] | 2809af7 | 2014-01-25 09:23:57 | [diff] [blame] | 166 | void OnLoadCompleted(scoped_ptr<GCMStore::LoadResult> result); |
[email protected] | b83122a9 | 2014-01-22 21:29:29 | [diff] [blame] | 167 | // Initializes mcs_client_, which handles the connection to MCS. |
[email protected] | 2809af7 | 2014-01-25 09:23:57 | [diff] [blame] | 168 | void InitializeMCSClient(scoped_ptr<GCMStore::LoadResult> result); |
[email protected] | b83122a9 | 2014-01-22 21:29:29 | [diff] [blame] | 169 | // Complets the first time device checkin. |
| 170 | void OnFirstTimeDeviceCheckinCompleted(const CheckinInfo& checkin_info); |
| 171 | // Starts a login on mcs_client_. |
| 172 | void StartMCSLogin(); |
| 173 | // Resets state to before initialization. |
| 174 | void ResetState(); |
[email protected] | 86625df | 2014-01-31 03:47:58 | [diff] [blame] | 175 | // Sets state to ready. This will initiate the MCS login and notify the |
| 176 | // delegates. |
| 177 | void OnReady(); |
[email protected] | b83122a9 | 2014-01-22 21:29:29 | [diff] [blame] | 178 | |
[email protected] | 5799d05 | 2014-02-12 20:47:39 | [diff] [blame] | 179 | // Starts a first time device checkin. |
[email protected] | 25b5f50e | 2014-04-03 08:27:23 | [diff] [blame] | 180 | void StartCheckin(); |
[email protected] | 2c4d4cd | 2014-04-10 21:10:22 | [diff] [blame] | 181 | // Completes the device checkin request by parsing the |checkin_response|. |
| 182 | // Function also cleans up the pending checkin. |
| 183 | void OnCheckinCompleted( |
| 184 | const checkin_proto::AndroidCheckinResponse& checkin_response); |
[email protected] | 06e4527 | 2014-05-06 03:41:34 | [diff] [blame] | 185 | |
| 186 | // Callback passed to GCMStore::SetGServicesSettings. |
| 187 | void SetGServicesSettingsCallback(bool success); |
| 188 | |
[email protected] | 764c044 | 2014-05-01 04:30:55 | [diff] [blame] | 189 | // Schedules next periodic device checkin and makes sure there is at most one |
| 190 | // pending checkin at a time. This function is meant to be called after a |
| 191 | // successful checkin. |
| 192 | void SchedulePeriodicCheckin(); |
| 193 | // Gets the time until next checkin. |
| 194 | base::TimeDelta GetTimeToNextCheckin() const; |
[email protected] | 25b5f50e | 2014-04-03 08:27:23 | [diff] [blame] | 195 | // Callback for setting last checkin time in the |gcm_store_|. |
| 196 | void SetLastCheckinTimeCallback(bool success); |
[email protected] | b83122a9 | 2014-01-22 21:29:29 | [diff] [blame] | 197 | |
| 198 | // Callback for persisting device credentials in the |gcm_store_|. |
| 199 | void SetDeviceCredentialsCallback(bool success); |
| 200 | |
[email protected] | 3a20a4d | 2014-03-21 22:54:21 | [diff] [blame] | 201 | // Callback for persisting registration info in the |gcm_store_|. |
| 202 | void UpdateRegistrationCallback(bool success); |
| 203 | |
[email protected] | 848b1b6 | 2014-01-30 23:51:04 | [diff] [blame] | 204 | // Completes the registration request. |
[email protected] | 5799d05 | 2014-02-12 20:47:39 | [diff] [blame] | 205 | void OnRegisterCompleted(const std::string& app_id, |
[email protected] | 3a20a4d | 2014-03-21 22:54:21 | [diff] [blame] | 206 | const std::vector<std::string>& sender_ids, |
[email protected] | b4dd023 | 2014-02-08 02:37:31 | [diff] [blame] | 207 | RegistrationRequest::Status status, |
[email protected] | 848b1b6 | 2014-01-30 23:51:04 | [diff] [blame] | 208 | const std::string& registration_id); |
| 209 | |
[email protected] | e400704 | 2014-02-15 20:34:28 | [diff] [blame] | 210 | // Completes the unregistration request. |
[email protected] | 0e88e1d1 | 2014-03-19 06:53:08 | [diff] [blame] | 211 | void OnUnregisterCompleted(const std::string& app_id, |
| 212 | UnregistrationRequest::Status status); |
[email protected] | e400704 | 2014-02-15 20:34:28 | [diff] [blame] | 213 | |
[email protected] | d3a4b2e | 2014-02-27 13:46:54 | [diff] [blame] | 214 | // Completes the GCM store destroy request. |
| 215 | void OnGCMStoreDestroyed(bool success); |
| 216 | |
[email protected] | c6fe36b | 2014-03-11 10:58:12 | [diff] [blame] | 217 | // Handles incoming data message and dispatches it the delegate of this class. |
[email protected] | b83122a9 | 2014-01-22 21:29:29 | [diff] [blame] | 218 | void HandleIncomingMessage(const gcm::MCSMessage& message); |
| 219 | |
[email protected] | c6fe36b | 2014-03-11 10:58:12 | [diff] [blame] | 220 | // Fires OnMessageReceived event on the delegate of this class, based on the |
| 221 | // details in |data_message_stanza| and |message_data|. |
| 222 | void HandleIncomingDataMessage( |
| 223 | const mcs_proto::DataMessageStanza& data_message_stanza, |
| 224 | MessageData& message_data); |
| 225 | |
| 226 | // Fires OnMessageSendError event on the delegate of this calss, based on the |
| 227 | // details in |data_message_stanza| and |message_data|. |
| 228 | void HandleIncomingSendError( |
| 229 | const mcs_proto::DataMessageStanza& data_message_stanza, |
| 230 | MessageData& message_data); |
[email protected] | 848b1b6 | 2014-01-30 23:51:04 | [diff] [blame] | 231 | |
[email protected] | 2bbe0a68 | 2014-03-26 00:08:31 | [diff] [blame] | 232 | // Builder for the GCM internals (mcs client, etc.). |
| 233 | scoped_ptr<GCMInternalsBuilder> internals_builder_; |
[email protected] | b83122a9 | 2014-01-22 21:29:29 | [diff] [blame] | 234 | |
[email protected] | 436bcb8 | 2014-04-18 00:40:57 | [diff] [blame] | 235 | // Recorder that logs GCM activities. |
| 236 | GCMStatsRecorder recorder_; |
| 237 | |
[email protected] | b83122a9 | 2014-01-22 21:29:29 | [diff] [blame] | 238 | // State of the GCM Client Implementation. |
| 239 | State state_; |
| 240 | |
[email protected] | 7de7880 | 2014-05-10 19:49:40 | [diff] [blame] | 241 | GCMClient::Delegate* delegate_; |
[email protected] | 5799d05 | 2014-02-12 20:47:39 | [diff] [blame] | 242 | |
[email protected] | b83122a9 | 2014-01-22 21:29:29 | [diff] [blame] | 243 | // Device checkin info (android ID and security token used by device). |
| 244 | CheckinInfo device_checkin_info_; |
| 245 | |
[email protected] | 848b1b6 | 2014-01-30 23:51:04 | [diff] [blame] | 246 | // Clock used for timing of retry logic. Passed in for testing. Owned by |
| 247 | // GCMClientImpl. |
| 248 | scoped_ptr<base::Clock> clock_; |
[email protected] | b83122a9 | 2014-01-22 21:29:29 | [diff] [blame] | 249 | |
| 250 | // Information about the chrome build. |
| 251 | // TODO(fgorski): Check if it can be passed in constructor and made const. |
[email protected] | 8ad8051 | 2014-05-23 09:40:47 | [diff] [blame^] | 252 | ChromeBuildInfo chrome_build_info_; |
[email protected] | b83122a9 | 2014-01-22 21:29:29 | [diff] [blame] | 253 | |
| 254 | // Persistent data store for keeping device credentials, messages and user to |
| 255 | // serial number mappings. |
[email protected] | 79994f4 | 2014-01-16 16:05:36 | [diff] [blame] | 256 | scoped_ptr<GCMStore> gcm_store_; |
[email protected] | b83122a9 | 2014-01-22 21:29:29 | [diff] [blame] | 257 | |
[email protected] | b83122a9 | 2014-01-22 21:29:29 | [diff] [blame] | 258 | scoped_refptr<net::HttpNetworkSession> network_session_; |
| 259 | net::BoundNetLog net_log_; |
| 260 | scoped_ptr<ConnectionFactory> connection_factory_; |
| 261 | scoped_refptr<net::URLRequestContextGetter> url_request_context_getter_; |
| 262 | |
| 263 | // Controls receiving and sending of packets and reliable message queueing. |
| 264 | scoped_ptr<MCSClient> mcs_client_; |
| 265 | |
[email protected] | 5799d05 | 2014-02-12 20:47:39 | [diff] [blame] | 266 | scoped_ptr<CheckinRequest> checkin_request_; |
[email protected] | 495a7db9 | 2014-02-22 07:49:59 | [diff] [blame] | 267 | std::vector<std::string> account_ids_; |
[email protected] | b83122a9 | 2014-01-22 21:29:29 | [diff] [blame] | 268 | |
[email protected] | 3a20a4d | 2014-03-21 22:54:21 | [diff] [blame] | 269 | // Cached registration info. |
| 270 | RegistrationInfoMap registrations_; |
[email protected] | 848b1b6 | 2014-01-30 23:51:04 | [diff] [blame] | 271 | |
[email protected] | 3a20a4d | 2014-03-21 22:54:21 | [diff] [blame] | 272 | // Currently pending registration requests. GCMClientImpl owns the |
| 273 | // RegistrationRequests. |
| 274 | PendingRegistrationRequests pending_registration_requests_; |
| 275 | STLValueDeleter<PendingRegistrationRequests> |
| 276 | pending_registration_requests_deleter_; |
| 277 | |
| 278 | // Currently pending unregistration requests. GCMClientImpl owns the |
[email protected] | e400704 | 2014-02-15 20:34:28 | [diff] [blame] | 279 | // UnregistrationRequests. |
[email protected] | 3a20a4d | 2014-03-21 22:54:21 | [diff] [blame] | 280 | PendingUnregistrationRequests pending_unregistration_requests_; |
| 281 | STLValueDeleter<PendingUnregistrationRequests> |
| 282 | pending_unregistration_requests_deleter_; |
[email protected] | e400704 | 2014-02-15 20:34:28 | [diff] [blame] | 283 | |
[email protected] | 764c044 | 2014-05-01 04:30:55 | [diff] [blame] | 284 | // G-services settings that were provided by MCS. |
[email protected] | 06e4527 | 2014-05-06 03:41:34 | [diff] [blame] | 285 | GServicesSettings gservices_settings_; |
[email protected] | 764c044 | 2014-05-01 04:30:55 | [diff] [blame] | 286 | |
| 287 | // Time of the last successful checkin. |
| 288 | base::Time last_checkin_time_; |
| 289 | |
| 290 | // Factory for creating references when scheduling periodic checkin. |
| 291 | base::WeakPtrFactory<GCMClientImpl> periodic_checkin_ptr_factory_; |
| 292 | |
[email protected] | 955e0ff | 2014-01-31 20:42:12 | [diff] [blame] | 293 | // Factory for creating references in callbacks. |
| 294 | base::WeakPtrFactory<GCMClientImpl> weak_ptr_factory_; |
| 295 | |
[email protected] | e4097c8 | 2013-11-08 00:16:12 | [diff] [blame] | 296 | DISALLOW_COPY_AND_ASSIGN(GCMClientImpl); |
| 297 | }; |
| 298 | |
| 299 | } // namespace gcm |
| 300 | |
| 301 | #endif // GOOGLE_APIS_GCM_GCM_CLIENT_IMPL_H_ |