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

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: Created 6 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 (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 176 matching lines...) Expand 10 before | Expand all | Expand 10 after
187 builder.set_user_agent(GetUserAgent()); 187 builder.set_user_agent(GetUserAgent());
188 builder.set_network_delegate(new AwNetworkDelegate()); 188 builder.set_network_delegate(new AwNetworkDelegate());
189 #if !defined(DISABLE_FTP_SUPPORT) 189 #if !defined(DISABLE_FTP_SUPPORT)
190 builder.set_ftp_enabled(false); // Android WebView does not support ftp yet. 190 builder.set_ftp_enabled(false); // Android WebView does not support ftp yet.
191 #endif 191 #endif
192 builder.set_proxy_config_service(proxy_config_service_.release()); 192 builder.set_proxy_config_service(proxy_config_service_.release());
193 builder.set_accept_language(net::HttpUtil::GenerateAcceptLanguageHeader( 193 builder.set_accept_language(net::HttpUtil::GenerateAcceptLanguageHeader(
194 AwContentBrowserClient::GetAcceptLangsImpl())); 194 AwContentBrowserClient::GetAcceptLangsImpl()));
195 ApplyCmdlineOverridesToURLRequestContextBuilder(&builder); 195 ApplyCmdlineOverridesToURLRequestContextBuilder(&builder);
196 196
197 197 data_reduction_proxy::DataReductionProxyParams drp_params(
198 true, false, false, false);
sgurun-gerrit only 2014/05/20 23:55:21 nit: same comment about the bool list.
198 builder.add_http_auth_handler_factory( 199 builder.add_http_auth_handler_factory(
199 data_reduction_proxy::HttpAuthHandlerDataReductionProxy::Scheme(), 200 data_reduction_proxy::HttpAuthHandlerDataReductionProxy::Scheme(),
200 new data_reduction_proxy::HttpAuthHandlerDataReductionProxy::Factory( 201 new data_reduction_proxy::HttpAuthHandlerDataReductionProxy::Factory(
201 DataReductionProxySettings::GetDataReductionProxies())); 202 drp_params.GetAllowedProxies()));
202 203
203 url_request_context_.reset(builder.Build()); 204 url_request_context_.reset(builder.Build());
204 // TODO(mnaganov): Fix URLRequestContextBuilder to use proper threads. 205 // TODO(mnaganov): Fix URLRequestContextBuilder to use proper threads.
205 net::HttpNetworkSession::Params network_session_params; 206 net::HttpNetworkSession::Params network_session_params;
206 207
207 PopulateNetworkSessionParams(url_request_context_.get(), 208 PopulateNetworkSessionParams(url_request_context_.get(),
208 &network_session_params); 209 &network_session_params);
209 210
210 net::HttpCache* main_cache = new net::HttpCache( 211 net::HttpCache* main_cache = new net::HttpCache(
211 network_session_params, 212 network_session_params,
212 new net::HttpCache::DefaultBackend( 213 new net::HttpCache::DefaultBackend(
213 net::DISK_CACHE, 214 net::DISK_CACHE,
214 net::CACHE_BACKEND_SIMPLE, 215 net::CACHE_BACKEND_SIMPLE,
215 partition_path_.Append(FILE_PATH_LITERAL("Cache")), 216 partition_path_.Append(FILE_PATH_LITERAL("Cache")),
216 20 * 1024 * 1024, // 20M 217 20 * 1024 * 1024, // 20M
217 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::CACHE))); 218 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::CACHE)));
218 219
219 AwBrowserContext* browser_context = AwBrowserContext::GetDefault(); 220 AwBrowserContext* browser_context = AwBrowserContext::GetDefault();
220 DCHECK(browser_context); 221 DCHECK(browser_context);
221 DataReductionProxySettings* drp_settings = 222 DataReductionProxySettings* drp_settings =
222 browser_context->GetDataReductionProxySettings(); 223 browser_context->GetDataReductionProxySettings();
223 DCHECK(drp_settings); 224 DCHECK(drp_settings);
224 std::string drp_key = drp_settings->key(); 225 std::string drp_key = drp_settings->params()->key();
225 // Only precache credentials if a key is available at URLRequestContext 226 // Only precache credentials if a key is available at URLRequestContext
226 // initialization. 227 // initialization.
227 if (!drp_key.empty()) { 228 if (!drp_key.empty()) {
228 DataReductionProxySettings::InitDataReductionProxySession( 229 DataReductionProxySettings::InitDataReductionProxySession(
229 main_cache->GetSession(), drp_settings->key()); 230 main_cache->GetSession(), &drp_params);
230 } 231 }
231 232
232 main_http_factory_.reset(main_cache); 233 main_http_factory_.reset(main_cache);
233 url_request_context_->set_http_transaction_factory(main_cache); 234 url_request_context_->set_http_transaction_factory(main_cache);
234 url_request_context_->set_cookie_store(cookie_store_); 235 url_request_context_->set_cookie_store(cookie_store_);
235 236
236 job_factory_ = CreateJobFactory(&protocol_handlers_); 237 job_factory_ = CreateJobFactory(&protocol_handlers_);
237 url_request_context_->set_job_factory(job_factory_.get()); 238 url_request_context_->set_job_factory(job_factory_.get());
238 239
239 // TODO(sgurun) remove once crbug.com/329681 is fixed. Should be 240 // TODO(sgurun) remove once crbug.com/329681 is fixed. Should be
(...skipping 19 matching lines...) Expand all
259 std::swap(protocol_handlers_, *protocol_handlers); 260 std::swap(protocol_handlers_, *protocol_handlers);
260 } 261 }
261 262
262 DataReductionProxyConfigService* 263 DataReductionProxyConfigService*
263 AwURLRequestContextGetter::proxy_config_service() { 264 AwURLRequestContextGetter::proxy_config_service() {
264 // TODO(bengr): return system config if data reduction proxy is disabled. 265 // TODO(bengr): return system config if data reduction proxy is disabled.
265 return proxy_config_service_.get(); 266 return proxy_config_service_.get();
266 } 267 }
267 268
268 } // namespace android_webview 269 } // namespace android_webview
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698