| 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/invalidation/impl/gcm_network_channel.h" | 5 #include "components/invalidation/impl/gcm_network_channel.h" |
| 6 | 6 |
| 7 #include "base/base64url.h" | 7 #include "base/base64url.h" |
| 8 #include "base/i18n/time_formatting.h" | 8 #include "base/i18n/time_formatting.h" |
| 9 #include "base/location.h" | 9 #include "base/location.h" |
| 10 #include "base/metrics/histogram_macros.h" | 10 #include "base/metrics/histogram_macros.h" |
| (...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 224 fetcher_->AddExtraRequestHeader(echo_header); | 224 fetcher_->AddExtraRequestHeader(echo_header); |
| 225 } | 225 } |
| 226 fetcher_->SetUploadData("application/x-protobuffer", cached_message_); | 226 fetcher_->SetUploadData("application/x-protobuffer", cached_message_); |
| 227 fetcher_->Start(); | 227 fetcher_->Start(); |
| 228 // Clear message to prevent accidentally resending it in the future. | 228 // Clear message to prevent accidentally resending it in the future. |
| 229 cached_message_.clear(); | 229 cached_message_.clear(); |
| 230 } | 230 } |
| 231 | 231 |
| 232 void GCMNetworkChannel::OnURLFetchComplete(const net::URLFetcher* source) { | 232 void GCMNetworkChannel::OnURLFetchComplete(const net::URLFetcher* source) { |
| 233 DCHECK(CalledOnValidThread()); | 233 DCHECK(CalledOnValidThread()); |
| 234 DCHECK_EQ(fetcher_, source); | 234 DCHECK_EQ(fetcher_.get(), source); |
| 235 // Free fetcher at the end of function. | 235 // Free fetcher at the end of function. |
| 236 scoped_ptr<net::URLFetcher> fetcher = fetcher_.Pass(); | 236 scoped_ptr<net::URLFetcher> fetcher = fetcher_.Pass(); |
| 237 | 237 |
| 238 net::URLRequestStatus status = fetcher->GetStatus(); | 238 net::URLRequestStatus status = fetcher->GetStatus(); |
| 239 diagnostic_info_.last_post_response_code_ = | 239 diagnostic_info_.last_post_response_code_ = |
| 240 status.is_success() ? source->GetResponseCode() : status.error(); | 240 status.is_success() ? source->GetResponseCode() : status.error(); |
| 241 | 241 |
| 242 if (status.is_success() && | 242 if (status.is_success() && |
| 243 fetcher->GetResponseCode() == net::HTTP_UNAUTHORIZED) { | 243 fetcher->GetResponseCode() == net::HTTP_UNAUTHORIZED) { |
| 244 DVLOG(1) << "URLFetcher failure: HTTP_UNAUTHORIZED"; | 244 DVLOG(1) << "URLFetcher failure: HTTP_UNAUTHORIZED"; |
| (...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 433 ENUM_CASE(gcm::GCMClient::UNKNOWN_ERROR); | 433 ENUM_CASE(gcm::GCMClient::UNKNOWN_ERROR); |
| 434 ENUM_CASE(gcm::GCMClient::INVALID_PARAMETER); | 434 ENUM_CASE(gcm::GCMClient::INVALID_PARAMETER); |
| 435 ENUM_CASE(gcm::GCMClient::ASYNC_OPERATION_PENDING); | 435 ENUM_CASE(gcm::GCMClient::ASYNC_OPERATION_PENDING); |
| 436 ENUM_CASE(gcm::GCMClient::GCM_DISABLED); | 436 ENUM_CASE(gcm::GCMClient::GCM_DISABLED); |
| 437 } | 437 } |
| 438 NOTREACHED(); | 438 NOTREACHED(); |
| 439 return ""; | 439 return ""; |
| 440 } | 440 } |
| 441 | 441 |
| 442 } // namespace syncer | 442 } // namespace syncer |
| OLD | NEW |