OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 #include "google_apis/gcm/engine/connection_factory_impl.h" | 5 #include "google_apis/gcm/engine/connection_factory_impl.h" |
6 | 6 |
| 7 #include <string> |
| 8 |
7 #include "base/location.h" | 9 #include "base/location.h" |
8 #include "base/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
9 #include "base/metrics/sparse_histogram.h" | 11 #include "base/metrics/sparse_histogram.h" |
10 #include "base/profiler/scoped_tracker.h" | 12 #include "base/profiler/scoped_tracker.h" |
11 #include "base/thread_task_runner_handle.h" | 13 #include "base/thread_task_runner_handle.h" |
12 #include "google_apis/gcm/engine/connection_handler_impl.h" | 14 #include "google_apis/gcm/engine/connection_handler_impl.h" |
13 #include "google_apis/gcm/monitoring/gcm_stats_recorder.h" | 15 #include "google_apis/gcm/monitoring/gcm_stats_recorder.h" |
14 #include "google_apis/gcm/protocol/mcs.pb.h" | 16 #include "google_apis/gcm/protocol/mcs.pb.h" |
15 #include "net/base/load_flags.h" | 17 #include "net/base/load_flags.h" |
16 #include "net/base/net_errors.h" | 18 #include "net/base/net_errors.h" |
(...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
300 | 302 |
301 // TODO(zea): if the network is offline, don't attempt to connect. | 303 // TODO(zea): if the network is offline, don't attempt to connect. |
302 // See crbug.com/396687 | 304 // See crbug.com/396687 |
303 | 305 |
304 connecting_ = true; | 306 connecting_ = true; |
305 GURL current_endpoint = GetCurrentEndpoint(); | 307 GURL current_endpoint = GetCurrentEndpoint(); |
306 recorder_->RecordConnectionInitiated(current_endpoint.host()); | 308 recorder_->RecordConnectionInitiated(current_endpoint.host()); |
307 RebuildNetworkSessionAuthCache(); | 309 RebuildNetworkSessionAuthCache(); |
308 int status = gcm_network_session_->proxy_service()->ResolveProxy( | 310 int status = gcm_network_session_->proxy_service()->ResolveProxy( |
309 current_endpoint, | 311 current_endpoint, |
| 312 std::string(), |
310 net::LOAD_NORMAL, | 313 net::LOAD_NORMAL, |
311 &proxy_info_, | 314 &proxy_info_, |
312 base::Bind(&ConnectionFactoryImpl::OnProxyResolveDone, | 315 base::Bind(&ConnectionFactoryImpl::OnProxyResolveDone, |
313 weak_ptr_factory_.GetWeakPtr()), | 316 weak_ptr_factory_.GetWeakPtr()), |
314 &pac_request_, | 317 &pac_request_, |
315 NULL, | 318 NULL, |
316 bound_net_log_); | 319 bound_net_log_); |
317 if (status != net::ERR_IO_PENDING) | 320 if (status != net::ERR_IO_PENDING) |
318 OnProxyResolveDone(status); | 321 OnProxyResolveDone(status); |
319 } | 322 } |
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
523 } | 526 } |
524 | 527 |
525 net::SSLConfig ssl_config; | 528 net::SSLConfig ssl_config; |
526 gcm_network_session_->ssl_config_service()->GetSSLConfig(&ssl_config); | 529 gcm_network_session_->ssl_config_service()->GetSSLConfig(&ssl_config); |
527 if (proxy_info_.is_https() && ssl_config.send_client_cert) { | 530 if (proxy_info_.is_https() && ssl_config.send_client_cert) { |
528 gcm_network_session_->ssl_client_auth_cache()->Remove( | 531 gcm_network_session_->ssl_client_auth_cache()->Remove( |
529 proxy_info_.proxy_server().host_port_pair()); | 532 proxy_info_.proxy_server().host_port_pair()); |
530 } | 533 } |
531 | 534 |
532 int status = gcm_network_session_->proxy_service()->ReconsiderProxyAfterError( | 535 int status = gcm_network_session_->proxy_service()->ReconsiderProxyAfterError( |
533 GetCurrentEndpoint(), net::LOAD_NORMAL, error, &proxy_info_, | 536 GetCurrentEndpoint(), |
| 537 std::string(), net::LOAD_NORMAL, error, &proxy_info_, |
534 base::Bind(&ConnectionFactoryImpl::OnProxyResolveDone, | 538 base::Bind(&ConnectionFactoryImpl::OnProxyResolveDone, |
535 weak_ptr_factory_.GetWeakPtr()), | 539 weak_ptr_factory_.GetWeakPtr()), |
536 &pac_request_, | 540 &pac_request_, |
537 NULL, | 541 NULL, |
538 bound_net_log_); | 542 bound_net_log_); |
539 if (status == net::OK || status == net::ERR_IO_PENDING) { | 543 if (status == net::OK || status == net::ERR_IO_PENDING) { |
540 CloseSocket(); | 544 CloseSocket(); |
541 } else { | 545 } else { |
542 // If ReconsiderProxyAfterError() failed synchronously, it means | 546 // If ReconsiderProxyAfterError() failed synchronously, it means |
543 // there was nothing left to fall-back to, so fail the transaction | 547 // there was nothing left to fall-back to, so fail the transaction |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
575 | 579 |
576 void ConnectionFactoryImpl::RebuildNetworkSessionAuthCache() { | 580 void ConnectionFactoryImpl::RebuildNetworkSessionAuthCache() { |
577 if (!http_network_session_ || !http_network_session_->http_auth_cache()) | 581 if (!http_network_session_ || !http_network_session_->http_auth_cache()) |
578 return; | 582 return; |
579 | 583 |
580 gcm_network_session_->http_auth_cache()->UpdateAllFrom( | 584 gcm_network_session_->http_auth_cache()->UpdateAllFrom( |
581 *http_network_session_->http_auth_cache()); | 585 *http_network_session_->http_auth_cache()); |
582 } | 586 } |
583 | 587 |
584 } // namespace gcm | 588 } // namespace gcm |
OLD | NEW |