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

Side by Side Diff: blimp/client/session/assignment_source.cc

Issue 1696563002: Blimp: add support for SSL connections. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rsleevi feedback #40 Created 4 years, 9 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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 "blimp/client/session/assignment_source.h" 5 #include "blimp/client/session/assignment_source.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/command_line.h" 9 #include "base/command_line.h"
10 #include "base/files/file_util.h"
10 #include "base/json/json_reader.h" 11 #include "base/json/json_reader.h"
11 #include "base/json/json_writer.h" 12 #include "base/json/json_writer.h"
12 #include "base/location.h" 13 #include "base/location.h"
14 #include "base/memory/ref_counted.h"
13 #include "base/numerics/safe_conversions.h" 15 #include "base/numerics/safe_conversions.h"
14 #include "base/strings/string_number_conversions.h" 16 #include "base/strings/string_number_conversions.h"
17 #include "base/task_runner_util.h"
15 #include "base/values.h" 18 #include "base/values.h"
16 #include "blimp/client/app/blimp_client_switches.h" 19 #include "blimp/client/app/blimp_client_switches.h"
17 #include "blimp/common/protocol_version.h" 20 #include "blimp/common/protocol_version.h"
21 #include "components/safe_json/safe_json_parser.h"
18 #include "net/base/ip_address.h" 22 #include "net/base/ip_address.h"
19 #include "net/base/ip_endpoint.h" 23 #include "net/base/ip_endpoint.h"
20 #include "net/base/load_flags.h" 24 #include "net/base/load_flags.h"
21 #include "net/base/net_errors.h" 25 #include "net/base/net_errors.h"
22 #include "net/base/url_util.h" 26 #include "net/base/url_util.h"
23 #include "net/http/http_status_code.h" 27 #include "net/http/http_status_code.h"
24 #include "net/proxy/proxy_config_service.h" 28 #include "net/proxy/proxy_config_service.h"
25 #include "net/proxy/proxy_service.h" 29 #include "net/proxy/proxy_service.h"
26 #include "net/url_request/url_fetcher.h" 30 #include "net/url_request/url_fetcher.h"
27 #include "net/url_request/url_request_context.h" 31 #include "net/url_request/url_request_context.h"
28 #include "net/url_request/url_request_context_builder.h" 32 #include "net/url_request/url_request_context_builder.h"
29 #include "net/url_request/url_request_context_getter.h" 33 #include "net/url_request/url_request_context_getter.h"
30 34
31 namespace blimp { 35 namespace blimp {
32 namespace client { 36 namespace client {
33 37
34 namespace { 38 namespace {
35 39
36 // Assignment request JSON keys. 40 // Assignment request JSON keys.
37 const char kProtocolVersionKey[] = "protocol_version"; 41 const char kProtocolVersionKey[] = "protocol_version";
38 42
39 // Assignment response JSON keys. 43 // Assignment response JSON keys.
40 const char kClientTokenKey[] = "clientToken"; 44 const char kClientTokenKey[] = "clientToken";
41 const char kHostKey[] = "host"; 45 const char kHostKey[] = "host";
42 const char kPortKey[] = "port"; 46 const char kPortKey[] = "port";
43 const char kCertificateFingerprintKey[] = "certificateFingerprint";
44 const char kCertificateKey[] = "certificate"; 47 const char kCertificateKey[] = "certificate";
45 48
46 // URL scheme constants for custom assignments. See the '--blimplet-endpoint' 49 // URL scheme constants for custom assignments. See the '--blimplet-endpoint'
47 // documentation in blimp_client_switches.cc for details. 50 // documentation in blimp_client_switches.cc for details.
48 const char kCustomSSLScheme[] = "ssl"; 51 const char kSSLTransport[] = "ssl";
49 const char kCustomTCPScheme[] = "tcp"; 52 const char kTCPTransport[] = "tcp";
50 const char kCustomQUICScheme[] = "quic"; 53 const char kQUICTransport[] = "quic";
51
52 Assignment GetCustomBlimpletAssignment() {
53 GURL url(base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII(
54 switches::kBlimpletEndpoint));
55
56 std::string host;
57 int port;
58 if (url.is_empty() || !url.is_valid() || !url.has_scheme() ||
59 !net::ParseHostAndPort(url.path(), &host, &port)) {
60 return Assignment();
61 }
62
63 net::IPAddress ip_address;
64 if (!ip_address.AssignFromIPLiteral(host)) {
65 CHECK(false) << "Invalid BlimpletAssignment host " << host;
66 }
67
68 if (!base::IsValueInRangeForNumericType<uint16_t>(port)) {
69 CHECK(false) << "Invalid BlimpletAssignment port " << port;
70 }
71
72 Assignment::TransportProtocol protocol =
73 Assignment::TransportProtocol::UNKNOWN;
74 if (url.has_scheme()) {
75 if (url.SchemeIs(kCustomSSLScheme)) {
76 protocol = Assignment::TransportProtocol::SSL;
77 } else if (url.SchemeIs(kCustomTCPScheme)) {
78 protocol = Assignment::TransportProtocol::TCP;
79 } else if (url.SchemeIs(kCustomQUICScheme)) {
80 protocol = Assignment::TransportProtocol::QUIC;
81 } else {
82 CHECK(false) << "Invalid BlimpletAssignment scheme " << url.scheme();
83 }
84 }
85
86 Assignment assignment;
87 assignment.transport_protocol = protocol;
88 assignment.ip_endpoint = net::IPEndPoint(ip_address, port);
89 assignment.client_token = kDummyClientToken;
90 return assignment;
91 }
92 54
93 GURL GetBlimpAssignerURL() { 55 GURL GetBlimpAssignerURL() {
94 // TODO(dtrainor): Add a way to specify another assigner. 56 // TODO(dtrainor): Add a way to specify another assigner.
95 return GURL(kDefaultAssignerURL); 57 return GURL(kDefaultAssignerURL);
96 } 58 }
97 59
98 class SimpleURLRequestContextGetter : public net::URLRequestContextGetter { 60 class SimpleURLRequestContextGetter : public net::URLRequestContextGetter {
99 public: 61 public:
100 SimpleURLRequestContextGetter( 62 SimpleURLRequestContextGetter(
101 const scoped_refptr<base::SingleThreadTaskRunner>& io_loop_task_runner) 63 scoped_refptr<base::SingleThreadTaskRunner> io_loop_task_runner)
102 : io_loop_task_runner_(io_loop_task_runner), 64 : io_loop_task_runner_(std::move(io_loop_task_runner)),
103 proxy_config_service_(net::ProxyService::CreateSystemProxyConfigService( 65 proxy_config_service_(net::ProxyService::CreateSystemProxyConfigService(
104 io_loop_task_runner_, 66 io_loop_task_runner_,
105 io_loop_task_runner_)) {} 67 io_loop_task_runner_)) {}
106 68
107 // net::URLRequestContextGetter implementation. 69 // net::URLRequestContextGetter implementation.
108 net::URLRequestContext* GetURLRequestContext() override { 70 net::URLRequestContext* GetURLRequestContext() override {
109 if (!url_request_context_) { 71 if (!url_request_context_) {
110 net::URLRequestContextBuilder builder; 72 net::URLRequestContextBuilder builder;
111 builder.set_proxy_config_service(std::move(proxy_config_service_)); 73 builder.set_proxy_config_service(std::move(proxy_config_service_));
112 builder.DisableHttpCache(); 74 builder.DisableHttpCache();
(...skipping 16 matching lines...) Expand all
129 91
130 // Temporary storage for the ProxyConfigService, which needs to be created on 92 // Temporary storage for the ProxyConfigService, which needs to be created on
131 // the main thread but cleared on the IO thread. This will be built in the 93 // the main thread but cleared on the IO thread. This will be built in the
132 // constructor and cleared on the IO thread. Due to the usage of this class 94 // constructor and cleared on the IO thread. Due to the usage of this class
133 // this is safe. 95 // this is safe.
134 scoped_ptr<net::ProxyConfigService> proxy_config_service_; 96 scoped_ptr<net::ProxyConfigService> proxy_config_service_;
135 97
136 DISALLOW_COPY_AND_ASSIGN(SimpleURLRequestContextGetter); 98 DISALLOW_COPY_AND_ASSIGN(SimpleURLRequestContextGetter);
137 }; 99 };
138 100
101 // Populates an Assignment using command-line parameters, if provided.
102 // Returns a null Assignment if no parameters were set.
103 // Must be called on the IO thread.
104
105 Assignment GetCustomAssignment() {
106 std::string ip_str =
107 base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII(
108 switches::kEngineIP);
109 std::string port_str =
110 base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII(
111 switches::kEnginePort);
112 std::string transport_str =
113 base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII(
114 switches::kEngineTransport);
115
116 if (ip_str.empty() && port_str.empty() && transport_str.empty()) {
117 return Assignment();
118 }
119
120 CHECK(ip_str.empty() == port_str.empty() &&
Bernhard Bauer 2016/02/26 16:26:30 You mention in the review that failing with an err
Kevin M 2016/02/26 19:57:23 Good point about the reporting noise. I'll switch
121 ip_str.empty() == transport_str.empty())
122 << "--engine-ip, --engine-port, and --engine-transport must be set "
123 "together.";
124
125 unsigned port_parsed;
126 uint16_t port;
127 CHECK(base::StringToUint(port_str, &port_parsed) && port_parsed > 0 &&
128 port_parsed <= 65535)
129 << "--engine-port must be a value between 0 and 65535.";
130 port = base::checked_cast<uint16_t>(port_parsed);
131
132 net::IPAddress ip_address;
133 CHECK(ip_address.AssignFromIPLiteral(ip_str)) << "Invalid engine IP "
134 << ip_str;
135
136 Assignment::TransportProtocol transport =
137 Assignment::TransportProtocol::UNKNOWN;
138 if (transport_str == kSSLTransport) {
139 transport = Assignment::TransportProtocol::SSL;
140 } else if (transport_str == kTCPTransport) {
141 transport = Assignment::TransportProtocol::TCP;
142 } else if (transport_str == kQUICTransport) {
143 transport = Assignment::TransportProtocol::QUIC;
144 } else {
145 LOG(FATAL) << "Invalid engine transport " << transport;
146 }
147
148 scoped_refptr<net::X509Certificate> cert;
149 if (transport == Assignment::TransportProtocol::SSL ||
150 transport == Assignment::TransportProtocol::QUIC) {
151 base::FilePath cert_path =
152 base::CommandLine::ForCurrentProcess()->GetSwitchValuePath(
153 switches::kEngineCertPath);
154 CHECK(!cert_path.empty()) << "Missing required parameter --"
155 << switches::kEngineCertPath << ".";
156 std::string cert_str;
157 CHECK(base::ReadFileToString(cert_path, &cert_str))
158 << "Couldn't read from file: " << cert_path.LossyDisplayName();
159 net::CertificateList cert_list =
160 net::X509Certificate::CreateCertificateListFromBytes(
161 cert_str.data(), cert_str.size(),
162 net::X509Certificate::FORMAT_PEM_CERT_SEQUENCE);
163 CHECK_EQ(1u, cert_list.size())
164 << "Only one cert is allowed in PEM cert list.";
165 cert = std::move(cert_list[0]);
166 }
167
168 Assignment assignment;
169 assignment.transport_protocol = transport;
170 assignment.ip_endpoint =
171 net::IPEndPoint(ip_address, base::checked_cast<uint16_t>(port));
172 assignment.client_token = kDummyClientToken;
173 assignment.cert = std::move(cert);
174 return assignment;
175 }
176
139 } // namespace 177 } // namespace
140 178
141 Assignment::Assignment() : transport_protocol(TransportProtocol::UNKNOWN) {} 179 Assignment::Assignment() : transport_protocol(TransportProtocol::UNKNOWN) {}
142 180
143 Assignment::~Assignment() {} 181 Assignment::~Assignment() {}
144 182
145 bool Assignment::is_null() const { 183 bool Assignment::IsValid() const {
146 return ip_endpoint.address().empty() || ip_endpoint.port() == 0 || 184 return !ip_endpoint.address().empty() && ip_endpoint.port() != 0 &&
147 transport_protocol == TransportProtocol::UNKNOWN; 185 transport_protocol != TransportProtocol::UNKNOWN;
148 } 186 }
149 187
150 AssignmentSource::AssignmentSource( 188 AssignmentSource::AssignmentSource(
151 const scoped_refptr<base::SingleThreadTaskRunner>& main_task_runner, 189 scoped_refptr<base::SingleThreadTaskRunner> io_task_runner)
152 const scoped_refptr<base::SingleThreadTaskRunner>& io_task_runner) 190 : io_task_runner_(std::move(io_task_runner)),
153 : main_task_runner_(main_task_runner), 191 url_request_context_(new SimpleURLRequestContextGetter(io_task_runner_)),
Bernhard Bauer 2016/02/26 16:26:30 Actually, I'm still confused. You use this thread
Kevin M 2016/02/26 19:57:23 I added a separate task runner for file access. Th
154 url_request_context_(new SimpleURLRequestContextGetter(io_task_runner)) {} 192 weak_factory_(this) {}
155 193
156 AssignmentSource::~AssignmentSource() {} 194 AssignmentSource::~AssignmentSource() {}
157 195
158 void AssignmentSource::GetAssignment(const std::string& client_auth_token, 196 void AssignmentSource::GetAssignment(const std::string& client_auth_token,
159 const AssignmentCallback& callback) { 197 const AssignmentCallback& callback) {
160 DCHECK(main_task_runner_->BelongsToCurrentThread());
161
162 // Cancel any outstanding callback. 198 // Cancel any outstanding callback.
163 if (!callback_.is_null()) { 199 if (!callback_.is_null()) {
164 base::ResetAndReturn(&callback_) 200 base::ResetAndReturn(&callback_)
165 .Run(AssignmentSource::Result::RESULT_SERVER_INTERRUPTED, Assignment()); 201 .Run(AssignmentSource::Result::RESULT_SERVER_INTERRUPTED, Assignment());
166 } 202 }
167 callback_ = AssignmentCallback(callback); 203 callback_ = AssignmentCallback(callback);
168 204
169 Assignment assignment = GetCustomBlimpletAssignment(); 205 // Try to get a custom assignment on the IO thread first.
170 if (!assignment.is_null()) { 206 PostTaskAndReplyWithResult(
171 // Post the result so that the behavior of this function is consistent. 207 io_task_runner_.get(), FROM_HERE, base::Bind(&GetCustomAssignment),
172 main_task_runner_->PostTask( 208 base::Bind(&AssignmentSource::OnGetCustomAssignmentDone,
173 FROM_HERE, base::Bind(base::ResetAndReturn(&callback_), 209 weak_factory_.GetWeakPtr(), client_auth_token));
174 AssignmentSource::Result::RESULT_OK, assignment)); 210 }
211
212 void AssignmentSource::OnGetCustomAssignmentDone(
213 const std::string& client_auth_token,
214 Assignment custom_assignment) {
215 // If GetCustomAssignment succeeded, then return the custom assignment
216 // directly.
217 if (custom_assignment.IsValid()) {
218 base::ResetAndReturn(&callback_)
219 .Run(AssignmentSource::RESULT_OK, custom_assignment);
175 return; 220 return;
176 } 221 }
177 222
178 // Call out to the network for a real assignment. Build the network request 223 // Call out to the network for a real assignment. Build the network request
179 // to hit the assigner. 224 // to hit the assigner.
180 url_fetcher_ = net::URLFetcher::Create(GetBlimpAssignerURL(), 225 url_fetcher_ = net::URLFetcher::Create(GetBlimpAssignerURL(),
181 net::URLFetcher::POST, this); 226 net::URLFetcher::POST, this);
182 url_fetcher_->SetRequestContext(url_request_context_.get()); 227 url_fetcher_->SetRequestContext(url_request_context_.get());
183 url_fetcher_->SetLoadFlags(net::LOAD_DO_NOT_SAVE_COOKIES | 228 url_fetcher_->SetLoadFlags(net::LOAD_DO_NOT_SAVE_COOKIES |
184 net::LOAD_DO_NOT_SEND_COOKIES); 229 net::LOAD_DO_NOT_SEND_COOKIES);
185 url_fetcher_->AddExtraRequestHeader("Authorization: Bearer " + 230 url_fetcher_->AddExtraRequestHeader("Authorization: Bearer " +
186 client_auth_token); 231 client_auth_token);
187 232
188 // Write the JSON for the request data. 233 // Write the JSON for the request data.
189 base::DictionaryValue dictionary; 234 base::DictionaryValue dictionary;
190 dictionary.SetString(kProtocolVersionKey, blimp::kEngineVersion); 235 dictionary.SetString(kProtocolVersionKey, blimp::kEngineVersion);
191 std::string json; 236 std::string json;
192 base::JSONWriter::Write(dictionary, &json); 237 base::JSONWriter::Write(dictionary, &json);
193 url_fetcher_->SetUploadData("application/json", json); 238 url_fetcher_->SetUploadData("application/json", json);
194
195 url_fetcher_->Start(); 239 url_fetcher_->Start();
196 } 240 }
197 241
198 void AssignmentSource::OnURLFetchComplete(const net::URLFetcher* source) { 242 void AssignmentSource::OnURLFetchComplete(const net::URLFetcher* source) {
199 DCHECK(main_task_runner_->BelongsToCurrentThread());
200 DCHECK(!callback_.is_null()); 243 DCHECK(!callback_.is_null());
201 DCHECK_EQ(url_fetcher_.get(), source); 244 DCHECK_EQ(url_fetcher_.get(), source);
202 245
203 if (!source->GetStatus().is_success()) { 246 if (!source->GetStatus().is_success()) {
204 DVLOG(1) << "Assignment request failed due to network error: " 247 DVLOG(1) << "Assignment request failed due to network error: "
205 << net::ErrorToString(source->GetStatus().error()); 248 << net::ErrorToString(source->GetStatus().error());
206 base::ResetAndReturn(&callback_) 249 base::ResetAndReturn(&callback_)
207 .Run(AssignmentSource::Result::RESULT_NETWORK_FAILURE, Assignment()); 250 .Run(AssignmentSource::Result::RESULT_NETWORK_FAILURE, Assignment());
208 return; 251 return;
209 } 252 }
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
246 DCHECK_EQ(net::HTTP_OK, url_fetcher_->GetResponseCode()); 289 DCHECK_EQ(net::HTTP_OK, url_fetcher_->GetResponseCode());
247 290
248 // Grab the response from the assigner request. 291 // Grab the response from the assigner request.
249 std::string response; 292 std::string response;
250 if (!url_fetcher_->GetResponseAsString(&response)) { 293 if (!url_fetcher_->GetResponseAsString(&response)) {
251 base::ResetAndReturn(&callback_) 294 base::ResetAndReturn(&callback_)
252 .Run(AssignmentSource::Result::RESULT_BAD_RESPONSE, Assignment()); 295 .Run(AssignmentSource::Result::RESULT_BAD_RESPONSE, Assignment());
253 return; 296 return;
254 } 297 }
255 298
256 // Attempt to interpret the response as JSON and treat it as a dictionary. 299 safe_json::SafeJsonParser::Parse(
257 scoped_ptr<base::Value> json = base::JSONReader::Read(response); 300 response, base::Bind(&AssignmentSource::AssignerJSONParseOK,
258 if (!json) { 301 weak_factory_.GetWeakPtr()),
259 base::ResetAndReturn(&callback_) 302 base::Bind(&AssignmentSource::AssignerJSONParseError,
260 .Run(AssignmentSource::Result::RESULT_BAD_RESPONSE, Assignment()); 303 weak_factory_.GetWeakPtr()));
261 return; 304 }
262 }
263 305
306 void AssignmentSource::AssignerJSONParseOK(scoped_ptr<base::Value> json) {
264 const base::DictionaryValue* dict; 307 const base::DictionaryValue* dict;
265 if (!json->GetAsDictionary(&dict)) { 308 if (!json->GetAsDictionary(&dict)) {
266 base::ResetAndReturn(&callback_) 309 base::ResetAndReturn(&callback_)
267 .Run(AssignmentSource::Result::RESULT_BAD_RESPONSE, Assignment()); 310 .Run(AssignmentSource::Result::RESULT_BAD_RESPONSE, Assignment());
268 return; 311 return;
269 } 312 }
270 313
271 // Validate that all the expected fields are present. 314 // Validate that all the expected fields are present.
272 std::string client_token; 315 std::string client_token;
273 std::string host; 316 std::string host;
274 int port; 317 int port;
275 std::string cert_fingerprint; 318 std::string cert_str;
276 std::string cert;
277 if (!(dict->GetString(kClientTokenKey, &client_token) && 319 if (!(dict->GetString(kClientTokenKey, &client_token) &&
278 dict->GetString(kHostKey, &host) && dict->GetInteger(kPortKey, &port) && 320 dict->GetString(kHostKey, &host) && dict->GetInteger(kPortKey, &port) &&
279 dict->GetString(kCertificateFingerprintKey, &cert_fingerprint) && 321 dict->GetString(kCertificateKey, &cert_str))) {
280 dict->GetString(kCertificateKey, &cert))) {
281 base::ResetAndReturn(&callback_) 322 base::ResetAndReturn(&callback_)
282 .Run(AssignmentSource::Result::RESULT_BAD_RESPONSE, Assignment()); 323 .Run(AssignmentSource::Result::RESULT_BAD_RESPONSE, Assignment());
283 return; 324 return;
284 } 325 }
285 326
286 net::IPAddress ip_address; 327 net::IPAddress ip_address;
287 if (!ip_address.AssignFromIPLiteral(host)) { 328 if (!ip_address.AssignFromIPLiteral(host)) {
288 base::ResetAndReturn(&callback_) 329 base::ResetAndReturn(&callback_)
289 .Run(AssignmentSource::Result::RESULT_BAD_RESPONSE, Assignment()); 330 .Run(AssignmentSource::Result::RESULT_BAD_RESPONSE, Assignment());
290 return; 331 return;
291 } 332 }
292 333
293 if (!base::IsValueInRangeForNumericType<uint16_t>(port)) { 334 if (!base::IsValueInRangeForNumericType<uint16_t>(port)) {
294 base::ResetAndReturn(&callback_) 335 base::ResetAndReturn(&callback_)
295 .Run(AssignmentSource::Result::RESULT_BAD_RESPONSE, Assignment()); 336 .Run(AssignmentSource::Result::RESULT_BAD_RESPONSE, Assignment());
296 return; 337 return;
297 } 338 }
298 339
299 Assignment assignment; 340 net::CertificateList cert_list =
341 net::X509Certificate::CreateCertificateListFromBytes(
342 cert_str.data(), cert_str.size(),
343 net::X509Certificate::FORMAT_PEM_CERT_SEQUENCE);
344 if (cert_list.size() != 1) {
345 base::ResetAndReturn(&callback_)
346 .Run(AssignmentSource::Result::RESULT_INVALID_CERT, Assignment());
347 return;
348 }
349
300 // The assigner assumes SSL-only and all engines it assigns only communicate 350 // The assigner assumes SSL-only and all engines it assigns only communicate
301 // over SSL. 351 // over SSL.
352 Assignment assignment;
302 assignment.transport_protocol = Assignment::TransportProtocol::SSL; 353 assignment.transport_protocol = Assignment::TransportProtocol::SSL;
303 assignment.ip_endpoint = net::IPEndPoint(ip_address, port); 354 assignment.ip_endpoint = net::IPEndPoint(ip_address, port);
304 assignment.client_token = client_token; 355 assignment.client_token = client_token;
305 assignment.certificate = cert; 356 assignment.cert = std::move(cert_list[0]);
306 assignment.certificate_fingerprint = cert_fingerprint;
307 357
308 base::ResetAndReturn(&callback_) 358 base::ResetAndReturn(&callback_)
309 .Run(AssignmentSource::Result::RESULT_OK, assignment); 359 .Run(AssignmentSource::Result::RESULT_OK, assignment);
310 } 360 }
311 361
362 void AssignmentSource::AssignerJSONParseError(const std::string& error) {
363 DLOG(ERROR) << "Error while parsing assigner JSON: " << error;
364 base::ResetAndReturn(&callback_)
365 .Run(AssignmentSource::Result::RESULT_BAD_RESPONSE, Assignment());
366 }
367
312 } // namespace client 368 } // namespace client
313 } // namespace blimp 369 } // namespace blimp
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698