OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 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 | 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 GOOGLE_APIS_GCM_GCM_CLIENT_IMPL_H_ | 5 #ifndef GOOGLE_APIS_GCM_GCM_CLIENT_IMPL_H_ |
6 #define GOOGLE_APIS_GCM_GCM_CLIENT_IMPL_H_ | 6 #define GOOGLE_APIS_GCM_GCM_CLIENT_IMPL_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
11 | 11 |
12 #include "base/compiler_specific.h" | 12 #include "base/compiler_specific.h" |
13 #include "base/memory/ref_counted.h" | 13 #include "base/memory/ref_counted.h" |
14 #include "base/memory/weak_ptr.h" | 14 #include "base/memory/weak_ptr.h" |
15 #include "base/stl_util.h" | 15 #include "base/stl_util.h" |
16 #include "google_apis/gcm/base/mcs_message.h" | 16 #include "google_apis/gcm/base/mcs_message.h" |
17 #include "google_apis/gcm/engine/gcm_store.h" | 17 #include "google_apis/gcm/engine/gcm_store.h" |
18 #include "google_apis/gcm/engine/mcs_client.h" | 18 #include "google_apis/gcm/engine/mcs_client.h" |
19 #include "google_apis/gcm/engine/registration_request.h" | 19 #include "google_apis/gcm/engine/registration_request.h" |
20 #include "google_apis/gcm/engine/unregistration_request.h" | 20 #include "google_apis/gcm/engine/unregistration_request.h" |
21 #include "google_apis/gcm/gcm_client.h" | 21 #include "google_apis/gcm/gcm_client.h" |
22 #include "google_apis/gcm/protocol/android_checkin.pb.h" | 22 #include "google_apis/gcm/protocol/checkin.pb.h" |
23 #include "net/base/net_log.h" | 23 #include "net/base/net_log.h" |
24 #include "net/url_request/url_request_context_getter.h" | 24 #include "net/url_request/url_request_context_getter.h" |
25 | 25 |
26 class GURL; | 26 class GURL; |
27 | 27 |
28 namespace base { | 28 namespace base { |
29 class Clock; | 29 class Clock; |
30 } // namespace base | 30 } // namespace base |
31 | 31 |
32 namespace net { | 32 namespace net { |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
156 // Starts a login on mcs_client_. | 156 // Starts a login on mcs_client_. |
157 void StartMCSLogin(); | 157 void StartMCSLogin(); |
158 // Resets state to before initialization. | 158 // Resets state to before initialization. |
159 void ResetState(); | 159 void ResetState(); |
160 // Sets state to ready. This will initiate the MCS login and notify the | 160 // Sets state to ready. This will initiate the MCS login and notify the |
161 // delegates. | 161 // delegates. |
162 void OnReady(); | 162 void OnReady(); |
163 | 163 |
164 // Starts a first time device checkin. | 164 // Starts a first time device checkin. |
165 void StartCheckin(); | 165 void StartCheckin(); |
166 // Completes the device checkin request. | 166 // Completes the device checkin request by parsing the |checkin_response|. |
167 // |android_id| and |security_token| are expected to be non-zero or an error | 167 // Function also cleans up the pending checkin. |
168 // is triggered. Function also cleans up the pending checkin. | 168 void OnCheckinCompleted( |
169 void OnCheckinCompleted(uint64 android_id, | 169 const checkin_proto::AndroidCheckinResponse& checkin_response); |
170 uint64 security_token); | 170 // Schedules next device checkin, based on |last_checkin_time| and |
171 // Schedules next device checkin, based on |last_checkin_time| and default | 171 // checkin_interval specified in GServices settings. |
172 // checkin interval. | |
173 void SchedulePeriodicCheckin(const base::Time& last_checkin_time); | 172 void SchedulePeriodicCheckin(const base::Time& last_checkin_time); |
174 // Callback for setting last checkin time in the |gcm_store_|. | 173 // Callback for setting last checkin time in the |gcm_store_|. |
175 void SetLastCheckinTimeCallback(bool success); | 174 void SetLastCheckinTimeCallback(bool success); |
176 | 175 |
177 // Callback for persisting device credentials in the |gcm_store_|. | 176 // Callback for persisting device credentials in the |gcm_store_|. |
178 void SetDeviceCredentialsCallback(bool success); | 177 void SetDeviceCredentialsCallback(bool success); |
179 | 178 |
180 // Callback for persisting registration info in the |gcm_store_|. | 179 // Callback for persisting registration info in the |gcm_store_|. |
181 void UpdateRegistrationCallback(bool success); | 180 void UpdateRegistrationCallback(bool success); |
182 | 181 |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
259 | 258 |
260 // Factory for creating references in callbacks. | 259 // Factory for creating references in callbacks. |
261 base::WeakPtrFactory<GCMClientImpl> weak_ptr_factory_; | 260 base::WeakPtrFactory<GCMClientImpl> weak_ptr_factory_; |
262 | 261 |
263 DISALLOW_COPY_AND_ASSIGN(GCMClientImpl); | 262 DISALLOW_COPY_AND_ASSIGN(GCMClientImpl); |
264 }; | 263 }; |
265 | 264 |
266 } // namespace gcm | 265 } // namespace gcm |
267 | 266 |
268 #endif // GOOGLE_APIS_GCM_GCM_CLIENT_IMPL_H_ | 267 #endif // GOOGLE_APIS_GCM_GCM_CLIENT_IMPL_H_ |
OLD | NEW |