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

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

Issue 557733002: [Android WebView] Use NetLog for providing full request headers to DevTools (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 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 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
164 job_factory.Pass(), make_scoped_ptr(*i))); 164 job_factory.Pass(), make_scoped_ptr(*i)));
165 } 165 }
166 request_interceptors.weak_clear(); 166 request_interceptors.weak_clear();
167 167
168 return job_factory.Pass(); 168 return job_factory.Pass();
169 } 169 }
170 170
171 } // namespace 171 } // namespace
172 172
173 AwURLRequestContextGetter::AwURLRequestContextGetter( 173 AwURLRequestContextGetter::AwURLRequestContextGetter(
174 const base::FilePath& partition_path, net::CookieStore* cookie_store, 174 const base::FilePath& partition_path,
175 net::CookieStore* cookie_store,
175 scoped_ptr<data_reduction_proxy::DataReductionProxyConfigService> 176 scoped_ptr<data_reduction_proxy::DataReductionProxyConfigService>
176 config_service) 177 config_service,
178 net::NetLog* net_log)
177 : partition_path_(partition_path), 179 : partition_path_(partition_path),
178 cookie_store_(cookie_store) { 180 cookie_store_(cookie_store),
181 net_log_(net_log) {
179 data_reduction_proxy_config_service_ = config_service.Pass(); 182 data_reduction_proxy_config_service_ = config_service.Pass();
180 // CreateSystemProxyConfigService for Android must be called on main thread. 183 // CreateSystemProxyConfigService for Android must be called on main thread.
181 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 184 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
182 } 185 }
183 186
184 AwURLRequestContextGetter::~AwURLRequestContextGetter() { 187 AwURLRequestContextGetter::~AwURLRequestContextGetter() {
185 } 188 }
186 189
187 void AwURLRequestContextGetter::InitializeURLRequestContext() { 190 void AwURLRequestContextGetter::InitializeURLRequestContext() {
188 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 191 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
189 DCHECK(!url_request_context_); 192 DCHECK(!url_request_context_);
190 193
191 net::URLRequestContextBuilder builder; 194 net::URLRequestContextBuilder builder;
192 builder.set_user_agent(GetUserAgent()); 195 builder.set_user_agent(GetUserAgent());
193 AwNetworkDelegate* aw_network_delegate = new AwNetworkDelegate(); 196 AwNetworkDelegate* aw_network_delegate = new AwNetworkDelegate();
194 builder.set_network_delegate(aw_network_delegate); 197 builder.set_network_delegate(aw_network_delegate);
195 #if !defined(DISABLE_FTP_SUPPORT) 198 #if !defined(DISABLE_FTP_SUPPORT)
196 builder.set_ftp_enabled(false); // Android WebView does not support ftp yet. 199 builder.set_ftp_enabled(false); // Android WebView does not support ftp yet.
197 #endif 200 #endif
198 if (data_reduction_proxy_config_service_.get()) { 201 if (data_reduction_proxy_config_service_.get()) {
199 builder.set_proxy_config_service( 202 builder.set_proxy_config_service(
200 data_reduction_proxy_config_service_.release()); 203 data_reduction_proxy_config_service_.release());
201 } else { 204 } else {
202 builder.set_proxy_config_service( 205 builder.set_proxy_config_service(
203 net::ProxyService::CreateSystemProxyConfigService( 206 net::ProxyService::CreateSystemProxyConfigService(
204 GetNetworkTaskRunner(), NULL /* Ignored on Android */ )); 207 GetNetworkTaskRunner(), NULL /* Ignored on Android */ ));
205 } 208 }
206 builder.set_accept_language(net::HttpUtil::GenerateAcceptLanguageHeader( 209 builder.set_accept_language(net::HttpUtil::GenerateAcceptLanguageHeader(
207 AwContentBrowserClient::GetAcceptLangsImpl())); 210 AwContentBrowserClient::GetAcceptLangsImpl()));
211 builder.set_net_log(net_log_);
208 ApplyCmdlineOverridesToURLRequestContextBuilder(&builder); 212 ApplyCmdlineOverridesToURLRequestContextBuilder(&builder);
209 213
210 url_request_context_.reset(builder.Build()); 214 url_request_context_.reset(builder.Build());
211 // TODO(mnaganov): Fix URLRequestContextBuilder to use proper threads. 215 // TODO(mnaganov): Fix URLRequestContextBuilder to use proper threads.
212 net::HttpNetworkSession::Params network_session_params; 216 net::HttpNetworkSession::Params network_session_params;
213 217
214 PopulateNetworkSessionParams(url_request_context_.get(), 218 PopulateNetworkSessionParams(url_request_context_.get(),
215 &network_session_params); 219 &network_session_params);
216 220
217 net::HttpCache* main_cache = new net::HttpCache( 221 net::HttpCache* main_cache = new net::HttpCache(
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
270 std::swap(protocol_handlers_, *protocol_handlers); 274 std::swap(protocol_handlers_, *protocol_handlers);
271 request_interceptors_.swap(request_interceptors); 275 request_interceptors_.swap(request_interceptors);
272 } 276 }
273 277
274 data_reduction_proxy::DataReductionProxyAuthRequestHandler* 278 data_reduction_proxy::DataReductionProxyAuthRequestHandler*
275 AwURLRequestContextGetter::GetDataReductionProxyAuthRequestHandler() const { 279 AwURLRequestContextGetter::GetDataReductionProxyAuthRequestHandler() const {
276 return data_reduction_proxy_auth_request_handler_.get(); 280 return data_reduction_proxy_auth_request_handler_.get();
277 } 281 }
278 282
279 } // namespace android_webview 283 } // namespace android_webview
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698