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

Side by Side Diff: android_webview/browser/net/aw_url_request_context_getter.cc

Issue 286013002: Added alternative configuration for the data reduction proxy (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: DCHECK fix Created 6 years, 6 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "android_webview/browser/net/aw_url_request_context_getter.h" 5 #include "android_webview/browser/net/aw_url_request_context_getter.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "android_webview/browser/aw_browser_context.h" 9 #include "android_webview/browser/aw_browser_context.h"
10 #include "android_webview/browser/aw_content_browser_client.h" 10 #include "android_webview/browser/aw_content_browser_client.h"
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after
193 builder.set_user_agent(GetUserAgent()); 193 builder.set_user_agent(GetUserAgent());
194 builder.set_network_delegate(new AwNetworkDelegate()); 194 builder.set_network_delegate(new AwNetworkDelegate());
195 #if !defined(DISABLE_FTP_SUPPORT) 195 #if !defined(DISABLE_FTP_SUPPORT)
196 builder.set_ftp_enabled(false); // Android WebView does not support ftp yet. 196 builder.set_ftp_enabled(false); // Android WebView does not support ftp yet.
197 #endif 197 #endif
198 builder.set_proxy_config_service(proxy_config_service_.release()); 198 builder.set_proxy_config_service(proxy_config_service_.release());
199 builder.set_accept_language(net::HttpUtil::GenerateAcceptLanguageHeader( 199 builder.set_accept_language(net::HttpUtil::GenerateAcceptLanguageHeader(
200 AwContentBrowserClient::GetAcceptLangsImpl())); 200 AwContentBrowserClient::GetAcceptLangsImpl()));
201 ApplyCmdlineOverridesToURLRequestContextBuilder(&builder); 201 ApplyCmdlineOverridesToURLRequestContextBuilder(&builder);
202 202
203 203 #if defined(SPDY_PROXY_AUTH_ORIGIN)
204 data_reduction_proxy::DataReductionProxyParams drp_params(
205 data_reduction_proxy::DataReductionProxyParams::kAllowed);
204 builder.add_http_auth_handler_factory( 206 builder.add_http_auth_handler_factory(
205 data_reduction_proxy::HttpAuthHandlerDataReductionProxy::Scheme(), 207 data_reduction_proxy::HttpAuthHandlerDataReductionProxy::Scheme(),
206 new data_reduction_proxy::HttpAuthHandlerDataReductionProxy::Factory( 208 new data_reduction_proxy::HttpAuthHandlerDataReductionProxy::Factory(
207 DataReductionProxySettings::GetDataReductionProxies())); 209 drp_params.GetAllowedProxies()));
210 #endif
208 211
209 url_request_context_.reset(builder.Build()); 212 url_request_context_.reset(builder.Build());
210 // TODO(mnaganov): Fix URLRequestContextBuilder to use proper threads. 213 // TODO(mnaganov): Fix URLRequestContextBuilder to use proper threads.
211 net::HttpNetworkSession::Params network_session_params; 214 net::HttpNetworkSession::Params network_session_params;
212 215
213 PopulateNetworkSessionParams(url_request_context_.get(), 216 PopulateNetworkSessionParams(url_request_context_.get(),
214 &network_session_params); 217 &network_session_params);
215 218
216 net::HttpCache* main_cache = new net::HttpCache( 219 net::HttpCache* main_cache = new net::HttpCache(
217 network_session_params, 220 network_session_params,
218 new net::HttpCache::DefaultBackend( 221 new net::HttpCache::DefaultBackend(
219 net::DISK_CACHE, 222 net::DISK_CACHE,
220 net::CACHE_BACKEND_SIMPLE, 223 net::CACHE_BACKEND_SIMPLE,
221 partition_path_.Append(FILE_PATH_LITERAL("Cache")), 224 partition_path_.Append(FILE_PATH_LITERAL("Cache")),
222 20 * 1024 * 1024, // 20M 225 20 * 1024 * 1024, // 20M
223 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::CACHE))); 226 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::CACHE)));
224 227
228 #if defined(SPDY_PROXY_AUTH_ORIGIN)
225 AwBrowserContext* browser_context = AwBrowserContext::GetDefault(); 229 AwBrowserContext* browser_context = AwBrowserContext::GetDefault();
226 DCHECK(browser_context); 230 DCHECK(browser_context);
227 DataReductionProxySettings* drp_settings = 231 DataReductionProxySettings* drp_settings =
228 browser_context->GetDataReductionProxySettings(); 232 browser_context->GetDataReductionProxySettings();
229 DCHECK(drp_settings); 233 if (drp_settings) {
230 std::string drp_key = drp_settings->key(); 234 std::string drp_key = drp_settings->params()->key();
231 // Only precache credentials if a key is available at URLRequestContext 235 // Only precache credentials if a key is available at URLRequestContext
232 // initialization. 236 // initialization.
233 if (!drp_key.empty()) { 237 if (!drp_key.empty()) {
234 DataReductionProxySettings::InitDataReductionProxySession( 238 DataReductionProxySettings::InitDataReductionProxySession(
235 main_cache->GetSession(), drp_settings->key()); 239 main_cache->GetSession(), &drp_params);
240 }
236 } 241 }
242 #endif
237 243
238 main_http_factory_.reset(main_cache); 244 main_http_factory_.reset(main_cache);
239 url_request_context_->set_http_transaction_factory(main_cache); 245 url_request_context_->set_http_transaction_factory(main_cache);
240 url_request_context_->set_cookie_store(cookie_store_); 246 url_request_context_->set_cookie_store(cookie_store_);
241 247
242 job_factory_ = CreateJobFactory(&protocol_handlers_); 248 job_factory_ = CreateJobFactory(&protocol_handlers_);
243 url_request_context_->set_job_factory(job_factory_.get()); 249 url_request_context_->set_job_factory(job_factory_.get());
244 } 250 }
245 251
246 net::URLRequestContext* AwURLRequestContextGetter::GetURLRequestContext() { 252 net::URLRequestContext* AwURLRequestContextGetter::GetURLRequestContext() {
(...skipping 14 matching lines...) Expand all
261 std::swap(protocol_handlers_, *protocol_handlers); 267 std::swap(protocol_handlers_, *protocol_handlers);
262 } 268 }
263 269
264 DataReductionProxyConfigService* 270 DataReductionProxyConfigService*
265 AwURLRequestContextGetter::proxy_config_service() { 271 AwURLRequestContextGetter::proxy_config_service() {
266 // TODO(bengr): return system config if data reduction proxy is disabled. 272 // TODO(bengr): return system config if data reduction proxy is disabled.
267 return proxy_config_service_.get(); 273 return proxy_config_service_.get();
268 } 274 }
269 275
270 } // namespace android_webview 276 } // namespace android_webview
OLDNEW
« no previous file with comments | « android_webview/browser/aw_browser_context.cc ('k') | android_webview/native/aw_contents_statics.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698