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

Side by Side Diff: google_apis/gcm/tools/mcs_probe.cc

Issue 1547233002: Convert Pass()→std::move() in //google_apis (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 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 | « google_apis/gcm/engine/unregistration_request_unittest.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 // A standalone tool for testing MCS connections and the MCS client on their 5 // A standalone tool for testing MCS connections and the MCS client on their
6 // own. 6 // own.
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9
10 #include <cstddef> 9 #include <cstddef>
11 #include <cstdio> 10 #include <cstdio>
12 #include <string> 11 #include <string>
12 #include <utility>
13 #include <vector> 13 #include <vector>
14 14
15 #include "base/at_exit.h" 15 #include "base/at_exit.h"
16 #include "base/command_line.h" 16 #include "base/command_line.h"
17 #include "base/compiler_specific.h" 17 #include "base/compiler_specific.h"
18 #include "base/files/scoped_file.h" 18 #include "base/files/scoped_file.h"
19 #include "base/logging.h" 19 #include "base/logging.h"
20 #include "base/memory/ref_counted.h" 20 #include "base/memory/ref_counted.h"
21 #include "base/memory/scoped_ptr.h" 21 #include "base/memory/scoped_ptr.h"
22 #include "base/message_loop/message_loop.h" 22 #include "base/message_loop/message_loop.h"
(...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after
349 secret_, 349 secret_,
350 base::Bind(&MCSProbe::UpdateCallback, 350 base::Bind(&MCSProbe::UpdateCallback,
351 base::Unretained(this))); 351 base::Unretained(this)));
352 } else { 352 } else {
353 android_id_ = load_result->device_android_id; 353 android_id_ = load_result->device_android_id;
354 secret_ = load_result->device_security_token; 354 secret_ = load_result->device_security_token;
355 DVLOG(1) << "Loaded MCS id " << android_id_; 355 DVLOG(1) << "Loaded MCS id " << android_id_;
356 } 356 }
357 mcs_client_->Initialize( 357 mcs_client_->Initialize(
358 base::Bind(&MCSProbe::ErrorCallback, base::Unretained(this)), 358 base::Bind(&MCSProbe::ErrorCallback, base::Unretained(this)),
359 base::Bind(&MessageReceivedCallback), 359 base::Bind(&MessageReceivedCallback), base::Bind(&MessageSentCallback),
360 base::Bind(&MessageSentCallback), 360 std::move(load_result));
361 load_result.Pass());
362 361
363 if (!android_id_ || !secret_) { 362 if (!android_id_ || !secret_) {
364 DVLOG(1) << "Checkin to generate new MCS credentials."; 363 DVLOG(1) << "Checkin to generate new MCS credentials.";
365 CheckIn(); 364 CheckIn();
366 return; 365 return;
367 } 366 }
368 367
369 StartMCSLogin(); 368 StartMCSLogin();
370 } 369 }
371 370
372 void MCSProbe::UpdateCallback(bool success) { 371 void MCSProbe::UpdateCallback(bool success) {
373 } 372 }
374 373
375 void MCSProbe::InitializeNetworkState() { 374 void MCSProbe::InitializeNetworkState() {
376 base::ScopedFILE log_file; 375 base::ScopedFILE log_file;
377 if (command_line_.HasSwitch(kLogFileSwitch)) { 376 if (command_line_.HasSwitch(kLogFileSwitch)) {
378 base::FilePath log_path = command_line_.GetSwitchValuePath(kLogFileSwitch); 377 base::FilePath log_path = command_line_.GetSwitchValuePath(kLogFileSwitch);
379 #if defined(OS_WIN) 378 #if defined(OS_WIN)
380 log_file.reset(_wfopen(log_path.value().c_str(), L"w")); 379 log_file.reset(_wfopen(log_path.value().c_str(), L"w"));
381 #elif defined(OS_POSIX) 380 #elif defined(OS_POSIX)
382 log_file.reset(fopen(log_path.value().c_str(), "w")); 381 log_file.reset(fopen(log_path.value().c_str(), "w"));
383 #endif 382 #endif
384 } 383 }
385 if (log_file.get()) { 384 if (log_file.get()) {
386 logger_.reset(new net::WriteToFileNetLogObserver()); 385 logger_.reset(new net::WriteToFileNetLogObserver());
387 logger_->set_capture_mode( 386 logger_->set_capture_mode(
388 net::NetLogCaptureMode::IncludeCookiesAndCredentials()); 387 net::NetLogCaptureMode::IncludeCookiesAndCredentials());
389 logger_->StartObserving(&net_log_, log_file.Pass(), nullptr, nullptr); 388 logger_->StartObserving(&net_log_, std::move(log_file), nullptr, nullptr);
390 } 389 }
391 390
392 host_resolver_ = net::HostResolver::CreateDefaultResolver(&net_log_); 391 host_resolver_ = net::HostResolver::CreateDefaultResolver(&net_log_);
393 392
394 if (command_line_.HasSwitch(kIgnoreCertSwitch)) { 393 if (command_line_.HasSwitch(kIgnoreCertSwitch)) {
395 cert_verifier_.reset(new MyTestCertVerifier()); 394 cert_verifier_.reset(new MyTestCertVerifier());
396 } else { 395 } else {
397 cert_verifier_ = net::CertVerifier::CreateDefault(); 396 cert_verifier_ = net::CertVerifier::CreateDefault();
398 } 397 }
399 system_channel_id_service_.reset( 398 system_channel_id_service_.reset(
400 new net::ChannelIDService( 399 new net::ChannelIDService(
401 new net::DefaultChannelIDStore(NULL), 400 new net::DefaultChannelIDStore(NULL),
402 base::WorkerPool::GetTaskRunner(true))); 401 base::WorkerPool::GetTaskRunner(true)));
403 402
404 transport_security_state_.reset(new net::TransportSecurityState()); 403 transport_security_state_.reset(new net::TransportSecurityState());
405 http_auth_handler_factory_ = 404 http_auth_handler_factory_ = net::HttpAuthHandlerRegistryFactory::Create(
406 net::HttpAuthHandlerRegistryFactory::Create(&http_auth_preferences_, 405 &http_auth_preferences_, host_resolver_.get());
407 host_resolver_.get())
408 .Pass();
409 http_server_properties_.reset(new net::HttpServerPropertiesImpl()); 406 http_server_properties_.reset(new net::HttpServerPropertiesImpl());
410 host_mapping_rules_.reset(new net::HostMappingRules()); 407 host_mapping_rules_.reset(new net::HostMappingRules());
411 proxy_service_ = net::ProxyService::CreateDirectWithNetLog(&net_log_); 408 proxy_service_ = net::ProxyService::CreateDirectWithNetLog(&net_log_);
412 } 409 }
413 410
414 void MCSProbe::BuildNetworkSession() { 411 void MCSProbe::BuildNetworkSession() {
415 net::HttpNetworkSession::Params session_params; 412 net::HttpNetworkSession::Params session_params;
416 session_params.host_resolver = host_resolver_.get(); 413 session_params.host_resolver = host_resolver_.get();
417 session_params.cert_verifier = cert_verifier_.get(); 414 session_params.cert_verifier = cert_verifier_.get();
418 session_params.channel_id_service = system_channel_id_service_.get(); 415 session_params.channel_id_service = system_channel_id_service_.get();
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
516 513
517 return 0; 514 return 0;
518 } 515 }
519 516
520 } // namespace 517 } // namespace
521 } // namespace gcm 518 } // namespace gcm
522 519
523 int main(int argc, char* argv[]) { 520 int main(int argc, char* argv[]) {
524 return gcm::MCSProbeMain(argc, argv); 521 return gcm::MCSProbeMain(argc, argv);
525 } 522 }
OLDNEW
« no previous file with comments | « google_apis/gcm/engine/unregistration_request_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698