| 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 #include "google_apis/gcm/gcm_client_impl.h" | 5 #include "google_apis/gcm/gcm_client_impl.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/files/file_path.h" | 8 #include "base/files/file_path.h" |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| (...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 291 mcs_client_.reset(); | 291 mcs_client_.reset(); |
| 292 gcm_store_->Destroy(base::Bind(&GCMClientImpl::OnGCMStoreDestroyed, | 292 gcm_store_->Destroy(base::Bind(&GCMClientImpl::OnGCMStoreDestroyed, |
| 293 weak_ptr_factory_.GetWeakPtr())); | 293 weak_ptr_factory_.GetWeakPtr())); |
| 294 checkin_request_.reset(); | 294 checkin_request_.reset(); |
| 295 pending_registrations_.clear(); | 295 pending_registrations_.clear(); |
| 296 state_ = INITIALIZED; | 296 state_ = INITIALIZED; |
| 297 } | 297 } |
| 298 | 298 |
| 299 void GCMClientImpl::Register(const std::string& app_id, | 299 void GCMClientImpl::Register(const std::string& app_id, |
| 300 const std::string& cert, | 300 const std::string& cert, |
| 301 const std::vector<std::string>& sender_ids) { | 301 const std::string& sender_id) { |
| 302 DCHECK_EQ(state_, READY); | 302 DCHECK_EQ(state_, READY); |
| 303 RegistrationRequest::RequestInfo request_info( | 303 RegistrationRequest::RequestInfo request_info( |
| 304 device_checkin_info_.android_id, | 304 device_checkin_info_.android_id, |
| 305 device_checkin_info_.secret, | 305 device_checkin_info_.secret, |
| 306 app_id, | 306 app_id, |
| 307 cert, | 307 cert, |
| 308 sender_ids); | 308 sender_id); |
| 309 DCHECK_EQ(0u, pending_registrations_.count(app_id)); | 309 DCHECK_EQ(0u, pending_registrations_.count(app_id)); |
| 310 | 310 |
| 311 RegistrationRequest* registration_request = | 311 RegistrationRequest* registration_request = |
| 312 new RegistrationRequest(request_info, | 312 new RegistrationRequest(request_info, |
| 313 kDefaultBackoffPolicy, | 313 kDefaultBackoffPolicy, |
| 314 base::Bind(&GCMClientImpl::OnRegisterCompleted, | 314 base::Bind(&GCMClientImpl::OnRegisterCompleted, |
| 315 weak_ptr_factory_.GetWeakPtr(), | 315 weak_ptr_factory_.GetWeakPtr(), |
| 316 app_id), | 316 app_id), |
| 317 kMaxRegistrationRetries, | 317 kMaxRegistrationRetries, |
| 318 url_request_context_getter_); | 318 url_request_context_getter_); |
| (...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 505 if (iter != incoming_message.data.end()) | 505 if (iter != incoming_message.data.end()) |
| 506 message_id = iter->second; | 506 message_id = iter->second; |
| 507 delegate->OnMessageSendError(app_id, message_id, SERVER_ERROR); | 507 delegate->OnMessageSendError(app_id, message_id, SERVER_ERROR); |
| 508 } | 508 } |
| 509 | 509 |
| 510 void GCMClientImpl::SetMCSClientForTesting(scoped_ptr<MCSClient> mcs_client) { | 510 void GCMClientImpl::SetMCSClientForTesting(scoped_ptr<MCSClient> mcs_client) { |
| 511 mcs_client_ = mcs_client.Pass(); | 511 mcs_client_ = mcs_client.Pass(); |
| 512 } | 512 } |
| 513 | 513 |
| 514 } // namespace gcm | 514 } // namespace gcm |
| OLD | NEW |