OLD | NEW |
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_request_interceptor.h" | 10 #include "android_webview/browser/aw_request_interceptor.h" |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 | 51 |
52 net::URLRequestContextBuilder builder; | 52 net::URLRequestContextBuilder builder; |
53 builder.set_user_agent(content::GetUserAgent(GURL())); | 53 builder.set_user_agent(content::GetUserAgent(GURL())); |
54 builder.set_network_delegate(new AwNetworkDelegate()); | 54 builder.set_network_delegate(new AwNetworkDelegate()); |
55 builder.set_ftp_enabled(false); // Android WebView does not support ftp yet. | 55 builder.set_ftp_enabled(false); // Android WebView does not support ftp yet. |
56 builder.set_proxy_config_service(proxy_config_service_.release()); | 56 builder.set_proxy_config_service(proxy_config_service_.release()); |
57 builder.set_accept_language(net::HttpUtil::GenerateAcceptLanguageHeader( | 57 builder.set_accept_language(net::HttpUtil::GenerateAcceptLanguageHeader( |
58 content::GetContentClient()->browser()->GetAcceptLangs( | 58 content::GetContentClient()->browser()->GetAcceptLangs( |
59 browser_context_))); | 59 browser_context_))); |
60 | 60 |
61 builder.set_accept_charset( | |
62 net::HttpUtil::GenerateAcceptCharsetHeader("utf-8")); | |
63 | |
64 url_request_context_.reset(builder.Build()); | 61 url_request_context_.reset(builder.Build()); |
65 | 62 |
66 // TODO(mnaganov): Fix URLRequestContextBuilder to use proper threads. | 63 // TODO(mnaganov): Fix URLRequestContextBuilder to use proper threads. |
67 net::HttpNetworkSession::Params network_session_params; | 64 net::HttpNetworkSession::Params network_session_params; |
68 PopulateNetworkSessionParams(&network_session_params); | 65 PopulateNetworkSessionParams(&network_session_params); |
69 net::HttpCache* main_cache = new net::HttpCache( | 66 net::HttpCache* main_cache = new net::HttpCache( |
70 network_session_params, | 67 network_session_params, |
71 new net::HttpCache::DefaultBackend( | 68 new net::HttpCache::DefaultBackend( |
72 net::DISK_CACHE, | 69 net::DISK_CACHE, |
73 browser_context_->GetPath().Append(FILE_PATH_LITERAL("Cache")), | 70 browser_context_->GetPath().Append(FILE_PATH_LITERAL("Cache")), |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
169 AwURLRequestContextGetter::GetNetworkTaskRunner() const { | 166 AwURLRequestContextGetter::GetNetworkTaskRunner() const { |
170 return BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO); | 167 return BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO); |
171 } | 168 } |
172 | 169 |
173 void AwURLRequestContextGetter::SetProtocolHandlers( | 170 void AwURLRequestContextGetter::SetProtocolHandlers( |
174 content::ProtocolHandlerMap* protocol_handlers) { | 171 content::ProtocolHandlerMap* protocol_handlers) { |
175 std::swap(protocol_handlers_, *protocol_handlers); | 172 std::swap(protocol_handlers_, *protocol_handlers); |
176 } | 173 } |
177 | 174 |
178 } // namespace android_webview | 175 } // namespace android_webview |
OLD | NEW |