Index: google_apis/gcm/gcm_client_impl.cc |
diff --git a/google_apis/gcm/gcm_client_impl.cc b/google_apis/gcm/gcm_client_impl.cc |
index a0a2142f2167aca1d681e7a320605bdba02f7e11..4cf72a9bf1e87ed27fa51c055f909f9b86bf982f 100644 |
--- a/google_apis/gcm/gcm_client_impl.cc |
+++ b/google_apis/gcm/gcm_client_impl.cc |
@@ -85,26 +85,26 @@ const char kSendErrorMessageIdKey[] = "google.message_id"; |
const char kSendMessageFromValue[] = "gcm@chrome.com"; |
const int64 kDefaultUserSerialNumber = 0LL; |
-GCMClient::Result ToGCMClientResult(MCSClient::MessageSendStatus status) { |
+Result ToGCMClientResult(MCSClient::MessageSendStatus status) { |
switch (status) { |
case MCSClient::QUEUED: |
- return GCMClient::SUCCESS; |
+ return RESULT_SUCCESS; |
case MCSClient::QUEUE_SIZE_LIMIT_REACHED: |
- return GCMClient::NETWORK_ERROR; |
+ return RESULT_NETWORK_ERROR; |
case MCSClient::APP_QUEUE_SIZE_LIMIT_REACHED: |
- return GCMClient::NETWORK_ERROR; |
+ return RESULT_NETWORK_ERROR; |
case MCSClient::MESSAGE_TOO_LARGE: |
- return GCMClient::INVALID_PARAMETER; |
+ return RESULT_INVALID_PARAMETER; |
case MCSClient::NO_CONNECTION_ON_ZERO_TTL: |
- return GCMClient::NETWORK_ERROR; |
+ return RESULT_NETWORK_ERROR; |
case MCSClient::TTL_EXCEEDED: |
- return GCMClient::NETWORK_ERROR; |
+ return RESULT_NETWORK_ERROR; |
case MCSClient::SENT: |
default: |
NOTREACHED(); |
break; |
} |
- return GCMClientImpl::UNKNOWN_ERROR; |
+ return RESULT_UNKNOWN_ERROR; |
} |
MessageType DecodeMessageType(const std::string& value) { |
@@ -429,7 +429,7 @@ void GCMClientImpl::Register(const std::string& app_id, |
if (registrations_iter != registrations_.end() && |
registrations_iter->second->sender_ids == sender_ids) { |
delegate_->OnRegisterFinished( |
- app_id, registrations_iter->second->registration_id, SUCCESS); |
+ app_id, registrations_iter->second->registration_id, RESULT_SUCCESS); |
return; |
} |
@@ -466,15 +466,15 @@ void GCMClientImpl::OnRegisterCompleted( |
PendingRegistrationRequests::iterator iter = |
pending_registration_requests_.find(app_id); |
if (iter == pending_registration_requests_.end()) |
- result = UNKNOWN_ERROR; |
+ result = RESULT_UNKNOWN_ERROR; |
else if (status == RegistrationRequest::INVALID_SENDER) |
- result = INVALID_PARAMETER; |
+ result = RESULT_INVALID_PARAMETER; |
else if (registration_id.empty()) |
- result = SERVER_ERROR; |
+ result = RESULT_SERVER_ERROR; |
else |
- result = SUCCESS; |
+ result = RESULT_SUCCESS; |
- if (result == SUCCESS) { |
+ if (result == RESULT_SUCCESS) { |
// Cache it. |
linked_ptr<RegistrationInfo> registration(new RegistrationInfo); |
registration->sender_ids = sender_ids; |
@@ -490,7 +490,9 @@ void GCMClientImpl::OnRegisterCompleted( |
} |
delegate_->OnRegisterFinished( |
- app_id, result == SUCCESS ? registration_id : std::string(), result); |
+ app_id, |
+ result == RESULT_SUCCESS ? registration_id : std::string(), |
+ result); |
if (iter != pending_registration_requests_.end()) { |
delete iter->second; |
@@ -536,7 +538,8 @@ void GCMClientImpl::OnUnregisterCompleted( |
<< " with " << (status ? "success." : "failure."); |
delegate_->OnUnregisterFinished( |
app_id, |
- status == UnregistrationRequest::SUCCESS ? SUCCESS : SERVER_ERROR); |
+ status == UnregistrationRequest::SUCCESS ? RESULT_SUCCESS |
+ : RESULT_SERVER_ERROR); |
PendingUnregistrationRequests::iterator iter = |
pending_unregistration_requests_.find(app_id); |
@@ -661,7 +664,7 @@ void GCMClientImpl::OnMessageSentToMCS(int64 user_serial_number, |
if (status == MCSClient::TTL_EXCEEDED) { |
SendErrorDetails send_error_details; |
send_error_details.message_id = message_id; |
- send_error_details.result = GCMClient::TTL_EXCEEDED; |
+ send_error_details.result = RESULT_TTL_EXCEEDED; |
delegate_->OnMessageSendError(app_id, send_error_details); |
} else if (status != MCSClient::SENT) { |
delegate_->OnSendFinished(app_id, message_id, ToGCMClientResult(status)); |
@@ -753,7 +756,7 @@ void GCMClientImpl::HandleIncomingSendError( |
MessageData& message_data) { |
SendErrorDetails send_error_details; |
send_error_details.additional_data = message_data; |
- send_error_details.result = SERVER_ERROR; |
+ send_error_details.result = RESULT_SERVER_ERROR; |
MessageData::iterator iter = |
send_error_details.additional_data.find(kSendErrorMessageIdKey); |