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

Side by Side Diff: remoting/test/remote_host_info_fetcher.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
« no previous file with comments | « remoting/protocol/chromium_port_allocator.cc ('k') | rlz/lib/financial_ping.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "remoting/test/remote_host_info_fetcher.h" 5 #include "remoting/test/remote_host_info_fetcher.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/callback_helpers.h" 8 #include "base/callback_helpers.h"
9 #include "base/json/json_reader.h" 9 #include "base/json/json_reader.h"
10 #include "base/json/json_writer.h" 10 #include "base/json/json_writer.h"
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 LOG(ERROR) << "Unrecognized service type: " << service_environment; 62 LOG(ERROR) << "Unrecognized service type: " << service_environment;
63 return false; 63 return false;
64 } 64 }
65 65
66 remote_host_info_callback_ = callback; 66 remote_host_info_callback_ = callback;
67 67
68 request_context_getter_ = new remoting::URLRequestContextGetter( 68 request_context_getter_ = new remoting::URLRequestContextGetter(
69 base::ThreadTaskRunnerHandle::Get(), // network_runner 69 base::ThreadTaskRunnerHandle::Get(), // network_runner
70 base::ThreadTaskRunnerHandle::Get()); // file_runner 70 base::ThreadTaskRunnerHandle::Get()); // file_runner
71 71
72 request_.reset( 72 request_ =
73 net::URLFetcher::Create(GURL(service_url), net::URLFetcher::POST, this)); 73 net::URLFetcher::Create(GURL(service_url), net::URLFetcher::POST, this);
74 request_->SetRequestContext(request_context_getter_.get()); 74 request_->SetRequestContext(request_context_getter_.get());
75 request_->AddExtraRequestHeader("Authorization: OAuth " + access_token); 75 request_->AddExtraRequestHeader("Authorization: OAuth " + access_token);
76 request_->AddExtraRequestHeader(kRequestTestOrigin); 76 request_->AddExtraRequestHeader(kRequestTestOrigin);
77 request_->SetUploadData("application/json; charset=UTF-8", "{}"); 77 request_->SetUploadData("application/json; charset=UTF-8", "{}");
78 request_->Start(); 78 request_->Start();
79 79
80 return true; 80 return true;
81 } 81 }
82 82
83 void RemoteHostInfoFetcher::OnURLFetchComplete(const net::URLFetcher* source) { 83 void RemoteHostInfoFetcher::OnURLFetchComplete(const net::URLFetcher* source) {
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
128 response->GetString("authorizationCode", 128 response->GetString("authorizationCode",
129 &remote_host_info.authorization_code); 129 &remote_host_info.authorization_code);
130 response->GetString("sharedSecret", &remote_host_info.shared_secret); 130 response->GetString("sharedSecret", &remote_host_info.shared_secret);
131 } 131 }
132 132
133 base::ResetAndReturn(&remote_host_info_callback_).Run(remote_host_info); 133 base::ResetAndReturn(&remote_host_info_callback_).Run(remote_host_info);
134 } 134 }
135 135
136 } // namespace test 136 } // namespace test
137 } // namespace remoting 137 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/protocol/chromium_port_allocator.cc ('k') | rlz/lib/financial_ping.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698