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/metrics/histogram.h" | 7 #include "base/metrics/histogram.h" |
8 #include "base/profiler/scoped_profile.h" | 8 #include "base/profiler/scoped_tracker.h" |
9 #include "base/sha1.h" | 9 #include "base/sha1.h" |
10 #include "base/strings/string_number_conversions.h" | 10 #include "base/strings/string_number_conversions.h" |
11 #include "base/strings/string_util.h" | 11 #include "base/strings/string_util.h" |
12 #if !defined(OS_ANDROID) | 12 #if !defined(OS_ANDROID) |
13 // channel_common.proto defines ANDROID constant that conflicts with Android | 13 // channel_common.proto defines ANDROID constant that conflicts with Android |
14 // build. At the same time TiclInvalidationService is not used on Android so it | 14 // build. At the same time TiclInvalidationService is not used on Android so it |
15 // is safe to exclude these protos from Android build. | 15 // is safe to exclude these protos from Android build. |
16 #include "google/cacheinvalidation/android_channel.pb.h" | 16 #include "google/cacheinvalidation/android_channel.pb.h" |
17 #include "google/cacheinvalidation/channel_common.pb.h" | 17 #include "google/cacheinvalidation/channel_common.pb.h" |
18 #include "google/cacheinvalidation/types.pb.h" | 18 #include "google/cacheinvalidation/types.pb.h" |
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
217 const std::string echo_header("echo-token: " + echo_token_); | 217 const std::string echo_header("echo-token: " + echo_token_); |
218 fetcher_->AddExtraRequestHeader(echo_header); | 218 fetcher_->AddExtraRequestHeader(echo_header); |
219 } | 219 } |
220 fetcher_->SetUploadData("application/x-protobuffer", cached_message_); | 220 fetcher_->SetUploadData("application/x-protobuffer", cached_message_); |
221 fetcher_->Start(); | 221 fetcher_->Start(); |
222 // Clear message to prevent accidentally resending it in the future. | 222 // Clear message to prevent accidentally resending it in the future. |
223 cached_message_.clear(); | 223 cached_message_.clear(); |
224 } | 224 } |
225 | 225 |
226 void GCMNetworkChannel::OnURLFetchComplete(const net::URLFetcher* source) { | 226 void GCMNetworkChannel::OnURLFetchComplete(const net::URLFetcher* source) { |
227 // TODO(vadimt): Remove ScopedProfile below once crbug.com/422577 is fixed. | 227 // TODO(vadimt): Remove ScopedTracker below once crbug.com/422577 is fixed. |
228 tracked_objects::ScopedProfile tracking_profile( | 228 tracked_objects::ScopedTracker tracking_profile( |
229 FROM_HERE_WITH_EXPLICIT_FUNCTION( | 229 FROM_HERE_WITH_EXPLICIT_FUNCTION( |
230 "422577 GCMNetworkChannel::OnURLFetchComplete")); | 230 "422577 GCMNetworkChannel::OnURLFetchComplete")); |
231 | 231 |
232 DCHECK(CalledOnValidThread()); | 232 DCHECK(CalledOnValidThread()); |
233 DCHECK_EQ(fetcher_, source); | 233 DCHECK_EQ(fetcher_, source); |
234 // Free fetcher at the end of function. | 234 // Free fetcher at the end of function. |
235 scoped_ptr<net::URLFetcher> fetcher = fetcher_.Pass(); | 235 scoped_ptr<net::URLFetcher> fetcher = fetcher_.Pass(); |
236 | 236 |
237 net::URLRequestStatus status = fetcher->GetStatus(); | 237 net::URLRequestStatus status = fetcher->GetStatus(); |
238 diagnostic_info_.last_post_response_code_ = | 238 diagnostic_info_.last_post_response_code_ = |
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
455 ENUM_CASE(gcm::GCMClient::NOT_SIGNED_IN); | 455 ENUM_CASE(gcm::GCMClient::NOT_SIGNED_IN); |
456 ENUM_CASE(gcm::GCMClient::INVALID_PARAMETER); | 456 ENUM_CASE(gcm::GCMClient::INVALID_PARAMETER); |
457 ENUM_CASE(gcm::GCMClient::ASYNC_OPERATION_PENDING); | 457 ENUM_CASE(gcm::GCMClient::ASYNC_OPERATION_PENDING); |
458 ENUM_CASE(gcm::GCMClient::GCM_DISABLED); | 458 ENUM_CASE(gcm::GCMClient::GCM_DISABLED); |
459 } | 459 } |
460 NOTREACHED(); | 460 NOTREACHED(); |
461 return ""; | 461 return ""; |
462 } | 462 } |
463 | 463 |
464 } // namespace syncer | 464 } // namespace syncer |
OLD | NEW |