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 "base/base64.h" | 5 #include "base/base64.h" |
6 #include "base/i18n/time_formatting.h" | 6 #include "base/i18n/time_formatting.h" |
7 #include "base/location.h" | 7 #include "base/location.h" |
8 #include "base/metrics/histogram_macros.h" | 8 #include "base/metrics/histogram_macros.h" |
9 #include "base/sha1.h" | 9 #include "base/sha1.h" |
10 #include "base/single_thread_task_runner.h" | 10 #include "base/single_thread_task_runner.h" |
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
222 fetcher_->AddExtraRequestHeader(echo_header); | 222 fetcher_->AddExtraRequestHeader(echo_header); |
223 } | 223 } |
224 fetcher_->SetUploadData("application/x-protobuffer", cached_message_); | 224 fetcher_->SetUploadData("application/x-protobuffer", cached_message_); |
225 fetcher_->Start(); | 225 fetcher_->Start(); |
226 // Clear message to prevent accidentally resending it in the future. | 226 // Clear message to prevent accidentally resending it in the future. |
227 cached_message_.clear(); | 227 cached_message_.clear(); |
228 } | 228 } |
229 | 229 |
230 void GCMNetworkChannel::OnURLFetchComplete(const net::URLFetcher* source) { | 230 void GCMNetworkChannel::OnURLFetchComplete(const net::URLFetcher* source) { |
231 DCHECK(CalledOnValidThread()); | 231 DCHECK(CalledOnValidThread()); |
232 DCHECK_EQ(fetcher_, source); | 232 DCHECK_EQ(fetcher_.get(), source); |
233 // Free fetcher at the end of function. | 233 // Free fetcher at the end of function. |
234 scoped_ptr<net::URLFetcher> fetcher = fetcher_.Pass(); | 234 scoped_ptr<net::URLFetcher> fetcher = fetcher_.Pass(); |
235 | 235 |
236 net::URLRequestStatus status = fetcher->GetStatus(); | 236 net::URLRequestStatus status = fetcher->GetStatus(); |
237 diagnostic_info_.last_post_response_code_ = | 237 diagnostic_info_.last_post_response_code_ = |
238 status.is_success() ? source->GetResponseCode() : status.error(); | 238 status.is_success() ? source->GetResponseCode() : status.error(); |
239 | 239 |
240 if (status.is_success() && | 240 if (status.is_success() && |
241 fetcher->GetResponseCode() == net::HTTP_UNAUTHORIZED) { | 241 fetcher->GetResponseCode() == net::HTTP_UNAUTHORIZED) { |
242 DVLOG(1) << "URLFetcher failure: HTTP_UNAUTHORIZED"; | 242 DVLOG(1) << "URLFetcher failure: HTTP_UNAUTHORIZED"; |
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
453 ENUM_CASE(gcm::GCMClient::UNKNOWN_ERROR); | 453 ENUM_CASE(gcm::GCMClient::UNKNOWN_ERROR); |
454 ENUM_CASE(gcm::GCMClient::INVALID_PARAMETER); | 454 ENUM_CASE(gcm::GCMClient::INVALID_PARAMETER); |
455 ENUM_CASE(gcm::GCMClient::ASYNC_OPERATION_PENDING); | 455 ENUM_CASE(gcm::GCMClient::ASYNC_OPERATION_PENDING); |
456 ENUM_CASE(gcm::GCMClient::GCM_DISABLED); | 456 ENUM_CASE(gcm::GCMClient::GCM_DISABLED); |
457 } | 457 } |
458 NOTREACHED(); | 458 NOTREACHED(); |
459 return ""; | 459 return ""; |
460 } | 460 } |
461 | 461 |
462 } // namespace syncer | 462 } // namespace syncer |
OLD | NEW |