Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(130)

Side by Side Diff: components/invalidation/gcm_network_channel.cc

Issue 1117703002: Adjust URLFetcher::Create API so that object is returned as scoped_ptr. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove unneeded Pass() calls Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/sha1.h" 8 #include "base/sha1.h"
9 #include "base/strings/string_number_conversions.h" 9 #include "base/strings/string_number_conversions.h"
10 #include "base/strings/string_util.h" 10 #include "base/strings/string_util.h"
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after
200 // Message won't get sent. Notify that http channel doesn't work. 200 // Message won't get sent. Notify that http channel doesn't work.
201 UpdateHttpChannelState(false); 201 UpdateHttpChannelState(false);
202 cached_message_.clear(); 202 cached_message_.clear();
203 return; 203 return;
204 } 204 }
205 DCHECK(!token.empty()); 205 DCHECK(!token.empty());
206 // Save access token in case POST fails and we need to invalidate it. 206 // Save access token in case POST fails and we need to invalidate it.
207 access_token_ = token; 207 access_token_ = token;
208 208
209 DVLOG(2) << "Got access token, sending message"; 209 DVLOG(2) << "Got access token, sending message";
210 fetcher_.reset(net::URLFetcher::Create( 210 fetcher_ = net::URLFetcher::Create(BuildUrl(registration_id_),
211 BuildUrl(registration_id_), net::URLFetcher::POST, this)); 211 net::URLFetcher::POST, this);
212 fetcher_->SetRequestContext(request_context_getter_.get()); 212 fetcher_->SetRequestContext(request_context_getter_.get());
213 const std::string auth_header("Authorization: Bearer " + access_token_); 213 const std::string auth_header("Authorization: Bearer " + access_token_);
214 fetcher_->AddExtraRequestHeader(auth_header); 214 fetcher_->AddExtraRequestHeader(auth_header);
215 if (!echo_token_.empty()) { 215 if (!echo_token_.empty()) {
216 const std::string echo_header("echo-token: " + echo_token_); 216 const std::string echo_header("echo-token: " + echo_token_);
217 fetcher_->AddExtraRequestHeader(echo_header); 217 fetcher_->AddExtraRequestHeader(echo_header);
218 } 218 }
219 fetcher_->SetUploadData("application/x-protobuffer", cached_message_); 219 fetcher_->SetUploadData("application/x-protobuffer", cached_message_);
220 fetcher_->Start(); 220 fetcher_->Start();
221 // Clear message to prevent accidentally resending it in the future. 221 // Clear message to prevent accidentally resending it in the future.
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after
448 ENUM_CASE(gcm::GCMClient::UNKNOWN_ERROR); 448 ENUM_CASE(gcm::GCMClient::UNKNOWN_ERROR);
449 ENUM_CASE(gcm::GCMClient::INVALID_PARAMETER); 449 ENUM_CASE(gcm::GCMClient::INVALID_PARAMETER);
450 ENUM_CASE(gcm::GCMClient::ASYNC_OPERATION_PENDING); 450 ENUM_CASE(gcm::GCMClient::ASYNC_OPERATION_PENDING);
451 ENUM_CASE(gcm::GCMClient::GCM_DISABLED); 451 ENUM_CASE(gcm::GCMClient::GCM_DISABLED);
452 } 452 }
453 NOTREACHED(); 453 NOTREACHED();
454 return ""; 454 return "";
455 } 455 }
456 456
457 } // namespace syncer 457 } // namespace syncer
OLDNEW
« no previous file with comments | « components/history/core/browser/web_history_service.cc ('k') | components/metrics/net/net_metrics_log_uploader.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698