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

Unified Diff: google_apis/gcm/engine/connection_factory_impl.cc

Issue 375663002: Leverage profile's http network session's HttpAuthCache to support proxy auth. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix test Created 6 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 side-by-side diff with in-line comments
Download patch
Index: google_apis/gcm/engine/connection_factory_impl.cc
diff --git a/google_apis/gcm/engine/connection_factory_impl.cc b/google_apis/gcm/engine/connection_factory_impl.cc
index 0ff3175cb2b51394f4e1286ecf3be73204e128fd..f7cd669063f554088fd406b8752ffceacd7436b3 100644
--- a/google_apis/gcm/engine/connection_factory_impl.cc
+++ b/google_apis/gcm/engine/connection_factory_impl.cc
@@ -45,14 +45,16 @@ bool ShouldRestorePreviousBackoff(const base::TimeTicks& login_time,
ConnectionFactoryImpl::ConnectionFactoryImpl(
const std::vector<GURL>& mcs_endpoints,
const net::BackoffEntry::Policy& backoff_policy,
- scoped_refptr<net::HttpNetworkSession> network_session,
+ const scoped_refptr<net::HttpNetworkSession>& gcm_network_session,
+ const scoped_refptr<net::HttpNetworkSession>& http_network_session,
net::NetLog* net_log,
GCMStatsRecorder* recorder)
: mcs_endpoints_(mcs_endpoints),
next_endpoint_(0),
last_successful_endpoint_(0),
backoff_policy_(backoff_policy),
- network_session_(network_session),
+ gcm_network_session_(gcm_network_session),
+ http_network_session_(http_network_session),
bound_net_log_(
net::BoundNetLog::Make(net_log, net::NetLog::SOURCE_SOCKET)),
pac_request_(NULL),
@@ -64,13 +66,15 @@ ConnectionFactoryImpl::ConnectionFactoryImpl(
listener_(NULL),
weak_ptr_factory_(this) {
DCHECK_GE(mcs_endpoints_.size(), 1U);
+ DCHECK(!http_network_session_.get() ||
+ (gcm_network_session_.get() != http_network_session_.get()));
}
ConnectionFactoryImpl::~ConnectionFactoryImpl() {
CloseSocket();
net::NetworkChangeNotifier::RemoveNetworkChangeObserver(this);
if (pac_request_) {
- network_session_->proxy_service()->CancelPacRequest(pac_request_);
+ gcm_network_session_->proxy_service()->CancelPacRequest(pac_request_);
pac_request_ = NULL;
}
}
@@ -280,7 +284,8 @@ void ConnectionFactoryImpl::ConnectImpl() {
connecting_ = true;
GURL current_endpoint = GetCurrentEndpoint();
recorder_->RecordConnectionInitiated(current_endpoint.host());
- int status = network_session_->proxy_service()->ResolveProxy(
+ RebuildNetworkSessionAuthCache();
+ int status = gcm_network_session_->proxy_service()->ResolveProxy(
current_endpoint,
net::LOAD_NORMAL,
&proxy_info_,
@@ -425,10 +430,10 @@ void ConnectionFactoryImpl::OnProxyResolveDone(int status) {
DVLOG(1) << "Resolved proxy with PAC:" << proxy_info_.ToPacString();
net::SSLConfig ssl_config;
- network_session_->ssl_config_service()->GetSSLConfig(&ssl_config);
+ gcm_network_session_->ssl_config_service()->GetSSLConfig(&ssl_config);
status = net::InitSocketHandleForTlsConnect(
net::HostPortPair::FromURL(GetCurrentEndpoint()),
- network_session_.get(),
+ gcm_network_session_.get(),
proxy_info_,
ssl_config,
ssl_config,
@@ -494,13 +499,13 @@ int ConnectionFactoryImpl::ReconsiderProxyAfterError(int error) {
}
net::SSLConfig ssl_config;
- network_session_->ssl_config_service()->GetSSLConfig(&ssl_config);
+ gcm_network_session_->ssl_config_service()->GetSSLConfig(&ssl_config);
if (proxy_info_.is_https() && ssl_config.send_client_cert) {
- network_session_->ssl_client_auth_cache()->Remove(
+ gcm_network_session_->ssl_client_auth_cache()->Remove(
proxy_info_.proxy_server().host_port_pair());
}
- int status = network_session_->proxy_service()->ReconsiderProxyAfterError(
+ int status = gcm_network_session_->proxy_service()->ReconsiderProxyAfterError(
GetCurrentEndpoint(), net::LOAD_NORMAL, error, &proxy_info_,
base::Bind(&ConnectionFactoryImpl::OnProxyResolveDone,
weak_ptr_factory_.GetWeakPtr()),
@@ -529,8 +534,8 @@ int ConnectionFactoryImpl::ReconsiderProxyAfterError(int error) {
}
void ConnectionFactoryImpl::ReportSuccessfulProxyConnection() {
- if (network_session_ && network_session_->proxy_service())
- network_session_->proxy_service()->ReportSuccess(proxy_info_);
+ if (gcm_network_session_ && gcm_network_session_->proxy_service())
+ gcm_network_session_->proxy_service()->ReportSuccess(proxy_info_);
}
void ConnectionFactoryImpl::CloseSocket() {
@@ -544,4 +549,12 @@ void ConnectionFactoryImpl::CloseSocket() {
socket_handle_.Reset();
}
+void ConnectionFactoryImpl::RebuildNetworkSessionAuthCache() {
+ if (!http_network_session_ || !http_network_session_->http_auth_cache())
+ return;
+
+ gcm_network_session_->http_auth_cache()->UpdateAllFrom(
+ *http_network_session_->http_auth_cache());
+}
+
} // namespace gcm
« no previous file with comments | « google_apis/gcm/engine/connection_factory_impl.h ('k') | google_apis/gcm/engine/connection_factory_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698