| 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 class FilePath; | 30 class FilePath; |
| 31 } // namespace base | 31 } // namespace base |
| 32 | 32 |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 160 // Starts a login on mcs_client_. | 160 // Starts a login on mcs_client_. |
| 161 void StartMCSLogin(); | 161 void StartMCSLogin(); |
| 162 // Resets state to before initialization. | 162 // Resets state to before initialization. |
| 163 void ResetState(); | 163 void ResetState(); |
| 164 // Sets state to ready. This will initiate the MCS login and notify the | 164 // Sets state to ready. This will initiate the MCS login and notify the |
| 165 // delegates. | 165 // delegates. |
| 166 void OnReady(); | 166 void OnReady(); |
| 167 | 167 |
| 168 // Starts a first time device checkin. | 168 // Starts a first time device checkin. |
| 169 void StartCheckin(); | 169 void StartCheckin(); |
| 170 // Completes the device checkin request. | 170 // Completes the device checkin request by parsing the |checkin_response|. |
| 171 // |android_id| and |security_token| are expected to be non-zero or an error | 171 // Function also cleans up the pending checkin. |
| 172 // is triggered. Function also cleans up the pending checkin. | 172 void OnCheckinCompleted( |
| 173 void OnCheckinCompleted(uint64 android_id, | 173 const checkin_proto::AndroidCheckinResponse& checkin_response); |
| 174 uint64 security_token); | 174 // Schedules next device checkin, based on |last_checkin_time| and |
| 175 // Schedules next device checkin, based on |last_checkin_time| and default | 175 // checkin_interval specified in GServices settings. |
| 176 // checkin interval. | |
| 177 void SchedulePeriodicCheckin(const base::Time& last_checkin_time); | 176 void SchedulePeriodicCheckin(const base::Time& last_checkin_time); |
| 178 // Callback for setting last checkin time in the |gcm_store_|. | 177 // Callback for setting last checkin time in the |gcm_store_|. |
| 179 void SetLastCheckinTimeCallback(bool success); | 178 void SetLastCheckinTimeCallback(bool success); |
| 180 | 179 |
| 181 // Callback for persisting device credentials in the |gcm_store_|. | 180 // Callback for persisting device credentials in the |gcm_store_|. |
| 182 void SetDeviceCredentialsCallback(bool success); | 181 void SetDeviceCredentialsCallback(bool success); |
| 183 | 182 |
| 184 // Callback for persisting registration info in the |gcm_store_|. | 183 // Callback for persisting registration info in the |gcm_store_|. |
| 185 void UpdateRegistrationCallback(bool success); | 184 void UpdateRegistrationCallback(bool success); |
| 186 | 185 |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 263 | 262 |
| 264 // Factory for creating references in callbacks. | 263 // Factory for creating references in callbacks. |
| 265 base::WeakPtrFactory<GCMClientImpl> weak_ptr_factory_; | 264 base::WeakPtrFactory<GCMClientImpl> weak_ptr_factory_; |
| 266 | 265 |
| 267 DISALLOW_COPY_AND_ASSIGN(GCMClientImpl); | 266 DISALLOW_COPY_AND_ASSIGN(GCMClientImpl); |
| 268 }; | 267 }; |
| 269 | 268 |
| 270 } // namespace gcm | 269 } // namespace gcm |
| 271 | 270 |
| 272 #endif // GOOGLE_APIS_GCM_GCM_CLIENT_IMPL_H_ | 271 #endif // GOOGLE_APIS_GCM_GCM_CLIENT_IMPL_H_ |
| OLD | NEW |