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 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
290 device_checkin_info_.Reset(); | 290 device_checkin_info_.Reset(); |
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, | |
301 const std::vector<std::string>& sender_ids) { | 300 const std::vector<std::string>& sender_ids) { |
302 DCHECK_EQ(state_, READY); | 301 DCHECK_EQ(state_, READY); |
303 RegistrationRequest::RequestInfo request_info( | 302 RegistrationRequest::RequestInfo request_info( |
304 device_checkin_info_.android_id, | 303 device_checkin_info_.android_id, |
305 device_checkin_info_.secret, | 304 device_checkin_info_.secret, |
306 app_id, | 305 app_id, |
307 cert, | |
308 sender_ids); | 306 sender_ids); |
309 DCHECK_EQ(0u, pending_registrations_.count(app_id)); | 307 DCHECK_EQ(0u, pending_registrations_.count(app_id)); |
310 | 308 |
311 RegistrationRequest* registration_request = | 309 RegistrationRequest* registration_request = |
312 new RegistrationRequest(request_info, | 310 new RegistrationRequest(request_info, |
313 kDefaultBackoffPolicy, | 311 kDefaultBackoffPolicy, |
314 base::Bind(&GCMClientImpl::OnRegisterCompleted, | 312 base::Bind(&GCMClientImpl::OnRegisterCompleted, |
315 weak_ptr_factory_.GetWeakPtr(), | 313 weak_ptr_factory_.GetWeakPtr(), |
316 app_id), | 314 app_id), |
317 kMaxRegistrationRetries, | 315 kMaxRegistrationRetries, |
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
502 if (iter != incoming_message.data.end()) | 500 if (iter != incoming_message.data.end()) |
503 message_id = iter->second; | 501 message_id = iter->second; |
504 delegate->OnMessageSendError(app_id, message_id, SERVER_ERROR); | 502 delegate->OnMessageSendError(app_id, message_id, SERVER_ERROR); |
505 } | 503 } |
506 | 504 |
507 void GCMClientImpl::SetMCSClientForTesting(scoped_ptr<MCSClient> mcs_client) { | 505 void GCMClientImpl::SetMCSClientForTesting(scoped_ptr<MCSClient> mcs_client) { |
508 mcs_client_ = mcs_client.Pass(); | 506 mcs_client_ = mcs_client.Pass(); |
509 } | 507 } |
510 | 508 |
511 } // namespace gcm | 509 } // namespace gcm |
OLD | NEW |