| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "components/cronet/android/url_request_context_adapter.h" | 5 #include "components/cronet/android/url_request_context_adapter.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <limits> | 10 #include <limits> |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 #include "net/http/http_network_layer.h" | 29 #include "net/http/http_network_layer.h" |
| 30 #include "net/http/http_server_properties.h" | 30 #include "net/http/http_server_properties.h" |
| 31 #include "net/log/write_to_file_net_log_observer.h" | 31 #include "net/log/write_to_file_net_log_observer.h" |
| 32 #include "net/proxy/proxy_service.h" | 32 #include "net/proxy/proxy_service.h" |
| 33 #include "net/sdch/sdch_owner.h" | 33 #include "net/sdch/sdch_owner.h" |
| 34 #include "net/ssl/ssl_config_service_defaults.h" | 34 #include "net/ssl/ssl_config_service_defaults.h" |
| 35 #include "net/url_request/static_http_user_agent_settings.h" | 35 #include "net/url_request/static_http_user_agent_settings.h" |
| 36 #include "net/url_request/url_request_context_builder.h" | 36 #include "net/url_request/url_request_context_builder.h" |
| 37 #include "net/url_request/url_request_context_storage.h" | 37 #include "net/url_request/url_request_context_storage.h" |
| 38 #include "net/url_request/url_request_job_factory_impl.h" | 38 #include "net/url_request/url_request_job_factory_impl.h" |
| 39 #include "url/scheme_host_port.h" |
| 39 | 40 |
| 40 namespace { | 41 namespace { |
| 41 | 42 |
| 42 class BasicNetworkDelegate : public net::NetworkDelegateImpl { | 43 class BasicNetworkDelegate : public net::NetworkDelegateImpl { |
| 43 public: | 44 public: |
| 44 BasicNetworkDelegate() {} | 45 BasicNetworkDelegate() {} |
| 45 ~BasicNetworkDelegate() override {} | 46 ~BasicNetworkDelegate() override {} |
| 46 | 47 |
| 47 private: | 48 private: |
| 48 // net::NetworkDelegate implementation. | 49 // net::NetworkDelegate implementation. |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 191 continue; | 192 continue; |
| 192 } | 193 } |
| 193 | 194 |
| 194 if (quic_hint.alternate_port <= std::numeric_limits<uint16_t>::min() || | 195 if (quic_hint.alternate_port <= std::numeric_limits<uint16_t>::min() || |
| 195 quic_hint.alternate_port > std::numeric_limits<uint16_t>::max()) { | 196 quic_hint.alternate_port > std::numeric_limits<uint16_t>::max()) { |
| 196 LOG(ERROR) << "Invalid QUIC hint alternate port: " | 197 LOG(ERROR) << "Invalid QUIC hint alternate port: " |
| 197 << quic_hint.alternate_port; | 198 << quic_hint.alternate_port; |
| 198 continue; | 199 continue; |
| 199 } | 200 } |
| 200 | 201 |
| 201 net::HostPortPair quic_hint_host_port_pair(canon_host, | 202 url::SchemeHostPort quic_server("https", canon_host, quic_hint.port); |
| 202 quic_hint.port); | |
| 203 net::AlternativeService alternative_service( | 203 net::AlternativeService alternative_service( |
| 204 net::AlternateProtocol::QUIC, "", | 204 net::AlternateProtocol::QUIC, "", |
| 205 static_cast<uint16_t>(quic_hint.alternate_port)); | 205 static_cast<uint16_t>(quic_hint.alternate_port)); |
| 206 context_->http_server_properties()->SetAlternativeService( | 206 context_->http_server_properties()->SetAlternativeService( |
| 207 quic_hint_host_port_pair, alternative_service, base::Time::Max()); | 207 quic_server, alternative_service, base::Time::Max()); |
| 208 } | 208 } |
| 209 } | 209 } |
| 210 load_disable_cache_ = config_->load_disable_cache; | 210 load_disable_cache_ = config_->load_disable_cache; |
| 211 config_.reset(NULL); | 211 config_.reset(NULL); |
| 212 | 212 |
| 213 if (VLOG_IS_ON(2)) { | 213 if (VLOG_IS_ON(2)) { |
| 214 net_log_observer_.reset(new NetLogObserver()); | 214 net_log_observer_.reset(new NetLogObserver()); |
| 215 context_->net_log()->DeprecatedAddObserver( | 215 context_->net_log()->DeprecatedAddObserver( |
| 216 net_log_observer_.get(), | 216 net_log_observer_.get(), |
| 217 net::NetLogCaptureMode::IncludeCookiesAndCredentials()); | 217 net::NetLogCaptureMode::IncludeCookiesAndCredentials()); |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 316 write_to_file_observer_.reset(); | 316 write_to_file_observer_.reset(); |
| 317 } | 317 } |
| 318 } | 318 } |
| 319 | 319 |
| 320 void NetLogObserver::OnAddEntry(const net::NetLog::Entry& entry) { | 320 void NetLogObserver::OnAddEntry(const net::NetLog::Entry& entry) { |
| 321 VLOG(2) << "Net log entry: type=" << entry.type() | 321 VLOG(2) << "Net log entry: type=" << entry.type() |
| 322 << ", source=" << entry.source().type << ", phase=" << entry.phase(); | 322 << ", source=" << entry.source().type << ", phase=" << entry.phase(); |
| 323 } | 323 } |
| 324 | 324 |
| 325 } // namespace cronet | 325 } // namespace cronet |
| OLD | NEW |