| 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 839 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 850 MCSClient::MessageSendStatus status) { | 850 MCSClient::MessageSendStatus status) { |
| 851 DCHECK_EQ(user_serial_number, kDefaultUserSerialNumber); | 851 DCHECK_EQ(user_serial_number, kDefaultUserSerialNumber); |
| 852 DCHECK(delegate_); | 852 DCHECK(delegate_); |
| 853 | 853 |
| 854 // TTL_EXCEEDED is singled out here, because it can happen long time after the | 854 // TTL_EXCEEDED is singled out here, because it can happen long time after the |
| 855 // message was sent. That is why it comes as |OnMessageSendError| event rather | 855 // message was sent. That is why it comes as |OnMessageSendError| event rather |
| 856 // than |OnSendFinished|. SendErrorDetails.additional_data is left empty. | 856 // than |OnSendFinished|. SendErrorDetails.additional_data is left empty. |
| 857 // All other errors will be raised immediately, through asynchronous callback. | 857 // All other errors will be raised immediately, through asynchronous callback. |
| 858 // It is expected that TTL_EXCEEDED will be issued for a message that was | 858 // It is expected that TTL_EXCEEDED will be issued for a message that was |
| 859 // previously issued |OnSendFinished| with status SUCCESS. | 859 // previously issued |OnSendFinished| with status SUCCESS. |
| 860 // For now, we do not report that the message has been sent and acked | |
| 861 // successfully. | |
| 862 // TODO(jianli): Consider adding UMA for this status. | 860 // TODO(jianli): Consider adding UMA for this status. |
| 863 if (status == MCSClient::TTL_EXCEEDED) { | 861 if (status == MCSClient::TTL_EXCEEDED) { |
| 864 SendErrorDetails send_error_details; | 862 SendErrorDetails send_error_details; |
| 865 send_error_details.message_id = message_id; | 863 send_error_details.message_id = message_id; |
| 866 send_error_details.result = GCMClient::TTL_EXCEEDED; | 864 send_error_details.result = GCMClient::TTL_EXCEEDED; |
| 867 delegate_->OnMessageSendError(app_id, send_error_details); | 865 delegate_->OnMessageSendError(app_id, send_error_details); |
| 868 } else if (status != MCSClient::SENT) { | 866 } else if (status == MCSClient::SENT) { |
| 867 delegate_->OnSendAcknowledged(app_id, message_id); |
| 868 } else { |
| 869 delegate_->OnSendFinished(app_id, message_id, ToGCMClientResult(status)); | 869 delegate_->OnSendFinished(app_id, message_id, ToGCMClientResult(status)); |
| 870 } | 870 } |
| 871 } | 871 } |
| 872 | 872 |
| 873 void GCMClientImpl::OnMCSError() { | 873 void GCMClientImpl::OnMCSError() { |
| 874 // TODO(fgorski): For now it replaces the initialization method. Long term it | 874 // TODO(fgorski): For now it replaces the initialization method. Long term it |
| 875 // should have an error or status passed in. | 875 // should have an error or status passed in. |
| 876 } | 876 } |
| 877 | 877 |
| 878 void GCMClientImpl::HandleIncomingMessage(const gcm::MCSMessage& message) { | 878 void GCMClientImpl::HandleIncomingMessage(const gcm::MCSMessage& message) { |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 966 | 966 |
| 967 recorder_.RecordIncomingSendError( | 967 recorder_.RecordIncomingSendError( |
| 968 data_message_stanza.category(), | 968 data_message_stanza.category(), |
| 969 data_message_stanza.to(), | 969 data_message_stanza.to(), |
| 970 data_message_stanza.id()); | 970 data_message_stanza.id()); |
| 971 delegate_->OnMessageSendError(data_message_stanza.category(), | 971 delegate_->OnMessageSendError(data_message_stanza.category(), |
| 972 send_error_details); | 972 send_error_details); |
| 973 } | 973 } |
| 974 | 974 |
| 975 } // namespace gcm | 975 } // namespace gcm |
| OLD | NEW |