| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "components/gcm_driver/gcm_client_impl.h" | 5 #include "components/gcm_driver/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 598 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 609 delegate_->OnDisconnected(); | 609 delegate_->OnDisconnected(); |
| 610 mcs_client_.reset(); | 610 mcs_client_.reset(); |
| 611 checkin_request_.reset(); | 611 checkin_request_.reset(); |
| 612 // Delete all of the pending registration and unregistration requests. | 612 // Delete all of the pending registration and unregistration requests. |
| 613 STLDeleteValues(&pending_registration_requests_); | 613 STLDeleteValues(&pending_registration_requests_); |
| 614 STLDeleteValues(&pending_unregistration_requests_); | 614 STLDeleteValues(&pending_unregistration_requests_); |
| 615 state_ = INITIALIZED; | 615 state_ = INITIALIZED; |
| 616 gcm_store_->Close(); | 616 gcm_store_->Close(); |
| 617 } | 617 } |
| 618 | 618 |
| 619 void GCMClientImpl::CheckOut() { | |
| 620 Stop(); | |
| 621 gcm_store_->Destroy(base::Bind(&GCMClientImpl::OnGCMStoreDestroyed, | |
| 622 weak_ptr_factory_.GetWeakPtr())); | |
| 623 } | |
| 624 | |
| 625 void GCMClientImpl::Register(const std::string& app_id, | 619 void GCMClientImpl::Register(const std::string& app_id, |
| 626 const std::vector<std::string>& sender_ids) { | 620 const std::vector<std::string>& sender_ids) { |
| 627 DCHECK_EQ(state_, READY); | 621 DCHECK_EQ(state_, READY); |
| 628 | 622 |
| 629 // If the same sender ids is provided, return the cached registration ID | 623 // If the same sender ids is provided, return the cached registration ID |
| 630 // directly. | 624 // directly. |
| 631 RegistrationInfoMap::const_iterator registrations_iter = | 625 RegistrationInfoMap::const_iterator registrations_iter = |
| 632 registrations_.find(app_id); | 626 registrations_.find(app_id); |
| 633 if (registrations_iter != registrations_.end() && | 627 if (registrations_iter != registrations_.end() && |
| 634 registrations_iter->second->sender_ids == sender_ids) { | 628 registrations_iter->second->sender_ids == sender_ids) { |
| (...skipping 351 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 986 | 980 |
| 987 recorder_.RecordIncomingSendError( | 981 recorder_.RecordIncomingSendError( |
| 988 data_message_stanza.category(), | 982 data_message_stanza.category(), |
| 989 data_message_stanza.to(), | 983 data_message_stanza.to(), |
| 990 data_message_stanza.id()); | 984 data_message_stanza.id()); |
| 991 delegate_->OnMessageSendError(data_message_stanza.category(), | 985 delegate_->OnMessageSendError(data_message_stanza.category(), |
| 992 send_error_details); | 986 send_error_details); |
| 993 } | 987 } |
| 994 | 988 |
| 995 } // namespace gcm | 989 } // namespace gcm |
| OLD | NEW |