| 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> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/location.h" | 9 #include "base/location.h" |
| 10 #include "base/memory/ptr_util.h" | 10 #include "base/memory/ptr_util.h" |
| (...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 312 DCHECK(!IsEndpointReachable()); | 312 DCHECK(!IsEndpointReachable()); |
| 313 // TODO(zea): Make this a dcheck again. crbug.com/462319 | 313 // TODO(zea): Make this a dcheck again. crbug.com/462319 |
| 314 CHECK(!socket_handle_.socket()); | 314 CHECK(!socket_handle_.socket()); |
| 315 | 315 |
| 316 // TODO(zea): if the network is offline, don't attempt to connect. | 316 // TODO(zea): if the network is offline, don't attempt to connect. |
| 317 // See crbug.com/396687 | 317 // See crbug.com/396687 |
| 318 | 318 |
| 319 connecting_ = true; | 319 connecting_ = true; |
| 320 GURL current_endpoint = GetCurrentEndpoint(); | 320 GURL current_endpoint = GetCurrentEndpoint(); |
| 321 recorder_->RecordConnectionInitiated(current_endpoint.host()); | 321 recorder_->RecordConnectionInitiated(current_endpoint.host()); |
| 322 RebuildNetworkSessionAuthCache(); | 322 UpdateFromHttpNetworkSession(); |
| 323 int status = gcm_network_session_->proxy_service()->ResolveProxy( | 323 int status = gcm_network_session_->proxy_service()->ResolveProxy( |
| 324 current_endpoint, | 324 current_endpoint, |
| 325 std::string(), | 325 std::string(), |
| 326 &proxy_info_, | 326 &proxy_info_, |
| 327 base::Bind(&ConnectionFactoryImpl::OnProxyResolveDone, | 327 base::Bind(&ConnectionFactoryImpl::OnProxyResolveDone, |
| 328 weak_ptr_factory_.GetWeakPtr()), | 328 weak_ptr_factory_.GetWeakPtr()), |
| 329 &pac_request_, | 329 &pac_request_, |
| 330 NULL, | 330 NULL, |
| 331 net_log_); | 331 net_log_); |
| 332 if (status != net::ERR_IO_PENDING) | 332 if (status != net::ERR_IO_PENDING) |
| (...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 583 // The connection handler needs to be reset, else it'll attempt to keep using | 583 // The connection handler needs to be reset, else it'll attempt to keep using |
| 584 // the destroyed socket. | 584 // the destroyed socket. |
| 585 if (connection_handler_) | 585 if (connection_handler_) |
| 586 connection_handler_->Reset(); | 586 connection_handler_->Reset(); |
| 587 | 587 |
| 588 if (socket_handle_.socket() && socket_handle_.socket()->IsConnected()) | 588 if (socket_handle_.socket() && socket_handle_.socket()->IsConnected()) |
| 589 socket_handle_.socket()->Disconnect(); | 589 socket_handle_.socket()->Disconnect(); |
| 590 socket_handle_.Reset(); | 590 socket_handle_.Reset(); |
| 591 } | 591 } |
| 592 | 592 |
| 593 void ConnectionFactoryImpl::RebuildNetworkSessionAuthCache() { | 593 void ConnectionFactoryImpl::UpdateFromHttpNetworkSession() { |
| 594 if (!http_network_session_ || !http_network_session_->http_auth_cache()) | 594 if (!http_network_session_ || !http_network_session_->http_auth_cache()) |
| 595 return; | 595 return; |
| 596 | 596 |
| 597 gcm_network_session_->http_auth_cache()->UpdateAllFrom( | 597 gcm_network_session_->http_auth_cache()->UpdateAllFrom( |
| 598 *http_network_session_->http_auth_cache()); | 598 *http_network_session_->http_auth_cache()); |
| 599 |
| 600 if (!http_network_session_->IsQuicEnabled()) |
| 601 gcm_network_session_->DisableQuic(); |
| 599 } | 602 } |
| 600 | 603 |
| 601 } // namespace gcm | 604 } // namespace gcm |
| OLD | NEW |