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

Side by Side Diff: google_apis/gcm/engine/connection_factory_impl.cc

Issue 2110973002: Removing load_flags from ProxyService and ProxyDelegate (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 5 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 (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"
11 #include "base/metrics/histogram.h" 11 #include "base/metrics/histogram.h"
12 #include "base/metrics/sparse_histogram.h" 12 #include "base/metrics/sparse_histogram.h"
13 #include "base/profiler/scoped_tracker.h" 13 #include "base/profiler/scoped_tracker.h"
14 #include "base/threading/thread_task_runner_handle.h" 14 #include "base/threading/thread_task_runner_handle.h"
15 #include "google_apis/gcm/engine/connection_handler_impl.h" 15 #include "google_apis/gcm/engine/connection_handler_impl.h"
16 #include "google_apis/gcm/monitoring/gcm_stats_recorder.h" 16 #include "google_apis/gcm/monitoring/gcm_stats_recorder.h"
17 #include "google_apis/gcm/protocol/mcs.pb.h" 17 #include "google_apis/gcm/protocol/mcs.pb.h"
18 #include "net/base/load_flags.h"
19 #include "net/base/net_errors.h" 18 #include "net/base/net_errors.h"
20 #include "net/http/http_network_session.h" 19 #include "net/http/http_network_session.h"
21 #include "net/http/http_request_headers.h" 20 #include "net/http/http_request_headers.h"
22 #include "net/log/net_log.h" 21 #include "net/log/net_log.h"
23 #include "net/proxy/proxy_info.h" 22 #include "net/proxy/proxy_info.h"
24 #include "net/socket/client_socket_handle.h" 23 #include "net/socket/client_socket_handle.h"
25 #include "net/socket/client_socket_pool_manager.h" 24 #include "net/socket/client_socket_pool_manager.h"
26 #include "net/ssl/ssl_config_service.h" 25 #include "net/ssl/ssl_config_service.h"
27 26
28 namespace gcm { 27 namespace gcm {
(...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after
304 // 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.
305 // See crbug.com/396687 304 // See crbug.com/396687
306 305
307 connecting_ = true; 306 connecting_ = true;
308 GURL current_endpoint = GetCurrentEndpoint(); 307 GURL current_endpoint = GetCurrentEndpoint();
309 recorder_->RecordConnectionInitiated(current_endpoint.host()); 308 recorder_->RecordConnectionInitiated(current_endpoint.host());
310 RebuildNetworkSessionAuthCache(); 309 RebuildNetworkSessionAuthCache();
311 int status = gcm_network_session_->proxy_service()->ResolveProxy( 310 int status = gcm_network_session_->proxy_service()->ResolveProxy(
312 current_endpoint, 311 current_endpoint,
313 std::string(), 312 std::string(),
314 net::LOAD_NORMAL,
315 &proxy_info_, 313 &proxy_info_,
316 base::Bind(&ConnectionFactoryImpl::OnProxyResolveDone, 314 base::Bind(&ConnectionFactoryImpl::OnProxyResolveDone,
317 weak_ptr_factory_.GetWeakPtr()), 315 weak_ptr_factory_.GetWeakPtr()),
318 &pac_request_, 316 &pac_request_,
319 NULL, 317 NULL,
320 bound_net_log_); 318 bound_net_log_);
321 if (status != net::ERR_IO_PENDING) 319 if (status != net::ERR_IO_PENDING)
322 OnProxyResolveDone(status); 320 OnProxyResolveDone(status);
323 } 321 }
324 322
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after
525 } 523 }
526 524
527 net::SSLConfig ssl_config; 525 net::SSLConfig ssl_config;
528 gcm_network_session_->ssl_config_service()->GetSSLConfig(&ssl_config); 526 gcm_network_session_->ssl_config_service()->GetSSLConfig(&ssl_config);
529 if (proxy_info_.is_https() && ssl_config.send_client_cert) { 527 if (proxy_info_.is_https() && ssl_config.send_client_cert) {
530 gcm_network_session_->ssl_client_auth_cache()->Remove( 528 gcm_network_session_->ssl_client_auth_cache()->Remove(
531 proxy_info_.proxy_server().host_port_pair()); 529 proxy_info_.proxy_server().host_port_pair());
532 } 530 }
533 531
534 int status = gcm_network_session_->proxy_service()->ReconsiderProxyAfterError( 532 int status = gcm_network_session_->proxy_service()->ReconsiderProxyAfterError(
535 GetCurrentEndpoint(), 533 GetCurrentEndpoint(), std::string(), error, &proxy_info_,
536 std::string(), net::LOAD_NORMAL, error, &proxy_info_,
537 base::Bind(&ConnectionFactoryImpl::OnProxyResolveDone, 534 base::Bind(&ConnectionFactoryImpl::OnProxyResolveDone,
538 weak_ptr_factory_.GetWeakPtr()), 535 weak_ptr_factory_.GetWeakPtr()),
539 &pac_request_, 536 &pac_request_, NULL, bound_net_log_);
540 NULL,
541 bound_net_log_);
542 if (status == net::OK || status == net::ERR_IO_PENDING) { 537 if (status == net::OK || status == net::ERR_IO_PENDING) {
543 CloseSocket(); 538 CloseSocket();
544 } else { 539 } else {
545 // If ReconsiderProxyAfterError() failed synchronously, it means 540 // If ReconsiderProxyAfterError() failed synchronously, it means
546 // there was nothing left to fall-back to, so fail the transaction 541 // there was nothing left to fall-back to, so fail the transaction
547 // with the last connection error we got. 542 // with the last connection error we got.
548 status = error; 543 status = error;
549 } 544 }
550 545
551 // If there is new proxy info, post OnProxyResolveDone to retry it. Otherwise, 546 // If there is new proxy info, post OnProxyResolveDone to retry it. Otherwise,
(...skipping 26 matching lines...) Expand all
578 573
579 void ConnectionFactoryImpl::RebuildNetworkSessionAuthCache() { 574 void ConnectionFactoryImpl::RebuildNetworkSessionAuthCache() {
580 if (!http_network_session_ || !http_network_session_->http_auth_cache()) 575 if (!http_network_session_ || !http_network_session_->http_auth_cache())
581 return; 576 return;
582 577
583 gcm_network_session_->http_auth_cache()->UpdateAllFrom( 578 gcm_network_session_->http_auth_cache()->UpdateAllFrom(
584 *http_network_session_->http_auth_cache()); 579 *http_network_session_->http_auth_cache());
585 } 580 }
586 581
587 } // namespace gcm 582 } // namespace gcm
OLDNEW
« no previous file with comments | « content/browser/resolve_proxy_msg_helper.cc ('k') | jingle/glue/proxy_resolving_client_socket.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698