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

Side by Side Diff: components/cronet/android/url_request_context_adapter.cc

Issue 1085903002: Enable Sdch in Cronet (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: constants Created 5 years, 7 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 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 <limits> 7 #include <limits>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/files/file_util.h" 10 #include "base/files/file_util.h"
11 #include "base/files/scoped_file.h" 11 #include "base/files/scoped_file.h"
12 #include "base/message_loop/message_loop.h" 12 #include "base/message_loop/message_loop.h"
13 #include "base/single_thread_task_runner.h" 13 #include "base/single_thread_task_runner.h"
14 #include "components/cronet/url_request_context_config.h" 14 #include "components/cronet/url_request_context_config.h"
15 #include "net/android/network_change_notifier_factory_android.h" 15 #include "net/android/network_change_notifier_factory_android.h"
16 #include "net/base/net_errors.h" 16 #include "net/base/net_errors.h"
17 #include "net/base/net_util.h" 17 #include "net/base/net_util.h"
18 #include "net/base/network_change_notifier.h" 18 #include "net/base/network_change_notifier.h"
19 #include "net/base/network_delegate_impl.h" 19 #include "net/base/network_delegate_impl.h"
20 #include "net/cert/cert_verifier.h" 20 #include "net/cert/cert_verifier.h"
21 #include "net/http/http_auth_handler_factory.h" 21 #include "net/http/http_auth_handler_factory.h"
22 #include "net/http/http_network_layer.h" 22 #include "net/http/http_network_layer.h"
23 #include "net/http/http_server_properties.h" 23 #include "net/http/http_server_properties.h"
24 #include "net/log/write_to_file_net_log_observer.h" 24 #include "net/log/write_to_file_net_log_observer.h"
25 #include "net/proxy/proxy_service.h" 25 #include "net/proxy/proxy_service.h"
26 #include "net/sdch/sdch_owner.h"
26 #include "net/ssl/ssl_config_service_defaults.h" 27 #include "net/ssl/ssl_config_service_defaults.h"
27 #include "net/url_request/static_http_user_agent_settings.h" 28 #include "net/url_request/static_http_user_agent_settings.h"
28 #include "net/url_request/url_request_context_builder.h" 29 #include "net/url_request/url_request_context_builder.h"
29 #include "net/url_request/url_request_context_storage.h" 30 #include "net/url_request/url_request_context_storage.h"
30 #include "net/url_request/url_request_job_factory_impl.h" 31 #include "net/url_request/url_request_job_factory_impl.h"
31 32
32 namespace { 33 namespace {
33 34
34 class BasicNetworkDelegate : public net::NetworkDelegateImpl { 35 class BasicNetworkDelegate : public net::NetworkDelegateImpl {
35 public: 36 public:
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
144 DCHECK(GetNetworkTaskRunner()->BelongsToCurrentThread()); 145 DCHECK(GetNetworkTaskRunner()->BelongsToCurrentThread());
145 DCHECK(config_); 146 DCHECK(config_);
146 // TODO(mmenke): Add method to have the builder enable SPDY. 147 // TODO(mmenke): Add method to have the builder enable SPDY.
147 net::URLRequestContextBuilder context_builder; 148 net::URLRequestContextBuilder context_builder;
148 context_builder.set_network_delegate(new BasicNetworkDelegate()); 149 context_builder.set_network_delegate(new BasicNetworkDelegate());
149 context_builder.set_proxy_config_service(proxy_config_service_.get()); 150 context_builder.set_proxy_config_service(proxy_config_service_.get());
150 config_->ConfigureURLRequestContextBuilder(&context_builder); 151 config_->ConfigureURLRequestContextBuilder(&context_builder);
151 152
152 context_.reset(context_builder.Build()); 153 context_.reset(context_builder.Build());
153 154
155 if (config_->enable_sdch) {
156 DCHECK(context_->sdch_manager());
157 sdch_owner_.reset(
158 new net::SdchOwner(context_->sdch_manager(), context_.get()));
159 }
160
154 // Currently (circa M39) enabling QUIC requires setting probability threshold. 161 // Currently (circa M39) enabling QUIC requires setting probability threshold.
155 if (config_->enable_quic) { 162 if (config_->enable_quic) {
156 context_->http_server_properties() 163 context_->http_server_properties()
157 ->SetAlternativeServiceProbabilityThreshold(0.0f); 164 ->SetAlternativeServiceProbabilityThreshold(0.0f);
158 for (size_t hint = 0; hint < config_->quic_hints.size(); ++hint) { 165 for (size_t hint = 0; hint < config_->quic_hints.size(); ++hint) {
159 const URLRequestContextConfig::QuicHint& quic_hint = 166 const URLRequestContextConfig::QuicHint& quic_hint =
160 *config_->quic_hints[hint]; 167 *config_->quic_hints[hint];
161 if (quic_hint.host.empty()) { 168 if (quic_hint.host.empty()) {
162 LOG(ERROR) << "Empty QUIC hint host: " << quic_hint.host; 169 LOG(ERROR) << "Empty QUIC hint host: " << quic_hint.host;
163 continue; 170 continue;
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
298 write_to_file_observer_.reset(); 305 write_to_file_observer_.reset();
299 } 306 }
300 } 307 }
301 308
302 void NetLogObserver::OnAddEntry(const net::NetLog::Entry& entry) { 309 void NetLogObserver::OnAddEntry(const net::NetLog::Entry& entry) {
303 VLOG(2) << "Net log entry: type=" << entry.type() 310 VLOG(2) << "Net log entry: type=" << entry.type()
304 << ", source=" << entry.source().type << ", phase=" << entry.phase(); 311 << ", source=" << entry.source().type << ", phase=" << entry.phase();
305 } 312 }
306 313
307 } // namespace cronet 314 } // namespace cronet
OLDNEW
« no previous file with comments | « components/cronet/android/url_request_context_adapter.h ('k') | components/cronet/url_request_context_config.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698