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

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

Issue 1876983002: Use Chromium BUILD to approximate Blimp protocol version, and check it. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix Android to use GetVersionNumber() Created 4 years, 6 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/files/file_util.h"
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after
236 url_fetcher_ = 236 url_fetcher_ =
237 net::URLFetcher::Create(assigner_endpoint_, net::URLFetcher::POST, this); 237 net::URLFetcher::Create(assigner_endpoint_, net::URLFetcher::POST, this);
238 url_fetcher_->SetRequestContext(url_request_context_.get()); 238 url_fetcher_->SetRequestContext(url_request_context_.get());
239 url_fetcher_->SetLoadFlags(net::LOAD_DO_NOT_SAVE_COOKIES | 239 url_fetcher_->SetLoadFlags(net::LOAD_DO_NOT_SAVE_COOKIES |
240 net::LOAD_DO_NOT_SEND_COOKIES); 240 net::LOAD_DO_NOT_SEND_COOKIES);
241 url_fetcher_->AddExtraRequestHeader("Authorization: Bearer " + 241 url_fetcher_->AddExtraRequestHeader("Authorization: Bearer " +
242 client_auth_token); 242 client_auth_token);
243 243
244 // Write the JSON for the request data. 244 // Write the JSON for the request data.
245 base::DictionaryValue dictionary; 245 base::DictionaryValue dictionary;
246 dictionary.SetString(kProtocolVersionKey, blimp::kEngineVersion); 246 dictionary.SetString(kProtocolVersionKey,
247 base::IntToString(kProtocolVersion));
247 std::string json; 248 std::string json;
248 base::JSONWriter::Write(dictionary, &json); 249 base::JSONWriter::Write(dictionary, &json);
249 url_fetcher_->SetUploadData("application/json", json); 250 url_fetcher_->SetUploadData("application/json", json);
250 url_fetcher_->Start(); 251 url_fetcher_->Start();
251 } 252 }
252 253
253 void AssignmentSource::OnURLFetchComplete(const net::URLFetcher* source) { 254 void AssignmentSource::OnURLFetchComplete(const net::URLFetcher* source) {
254 DCHECK(!callback_.is_null()); 255 DCHECK(!callback_.is_null());
255 DCHECK_EQ(url_fetcher_.get(), source); 256 DCHECK_EQ(url_fetcher_.get(), source);
256 257
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
371 } 372 }
372 373
373 void AssignmentSource::OnJsonParseError(const std::string& error) { 374 void AssignmentSource::OnJsonParseError(const std::string& error) {
374 DLOG(ERROR) << "Error while parsing assigner JSON: " << error; 375 DLOG(ERROR) << "Error while parsing assigner JSON: " << error;
375 base::ResetAndReturn(&callback_) 376 base::ResetAndReturn(&callback_)
376 .Run(AssignmentSource::Result::RESULT_BAD_RESPONSE, Assignment()); 377 .Run(AssignmentSource::Result::RESULT_BAD_RESPONSE, Assignment());
377 } 378 }
378 379
379 } // namespace client 380 } // namespace client
380 } // namespace blimp 381 } // namespace blimp
OLDNEW
« no previous file with comments | « blimp/client/app/android/blimp_client_session_android.cc ('k') | blimp/client/session/assignment_source_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698