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_content_browser_client.h" | 9 #include "android_webview/browser/aw_content_browser_client.h" |
10 #include "android_webview/browser/aw_request_interceptor.h" | 10 #include "android_webview/browser/aw_request_interceptor.h" |
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
195 cache_type = net::CACHE_BACKEND_BLOCKFILE; | 195 cache_type = net::CACHE_BACKEND_BLOCKFILE; |
196 } | 196 } |
197 PopulateNetworkSessionParams(url_request_context_.get(), | 197 PopulateNetworkSessionParams(url_request_context_.get(), |
198 &network_session_params); | 198 &network_session_params); |
199 net::HttpCache* main_cache = new net::HttpCache( | 199 net::HttpCache* main_cache = new net::HttpCache( |
200 network_session_params, | 200 network_session_params, |
201 new net::HttpCache::DefaultBackend( | 201 new net::HttpCache::DefaultBackend( |
202 net::DISK_CACHE, | 202 net::DISK_CACHE, |
203 cache_type, | 203 cache_type, |
204 partition_path_.Append(FILE_PATH_LITERAL("Cache")), | 204 partition_path_.Append(FILE_PATH_LITERAL("Cache")), |
205 10 * 1024 * 1024, // 10M | 205 20 * 1024 * 1024, // 20M |
206 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::CACHE))); | 206 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::CACHE))); |
207 main_http_factory_.reset(main_cache); | 207 main_http_factory_.reset(main_cache); |
208 url_request_context_->set_http_transaction_factory(main_cache); | 208 url_request_context_->set_http_transaction_factory(main_cache); |
209 url_request_context_->set_cookie_store(cookie_store_); | 209 url_request_context_->set_cookie_store(cookie_store_); |
210 | 210 |
211 job_factory_ = CreateJobFactory(&protocol_handlers_); | 211 job_factory_ = CreateJobFactory(&protocol_handlers_); |
212 url_request_context_->set_job_factory(job_factory_.get()); | 212 url_request_context_->set_job_factory(job_factory_.get()); |
213 } | 213 } |
214 | 214 |
215 net::URLRequestContext* AwURLRequestContextGetter::GetURLRequestContext() { | 215 net::URLRequestContext* AwURLRequestContextGetter::GetURLRequestContext() { |
216 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 216 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
217 if (!url_request_context_) | 217 if (!url_request_context_) |
218 InitializeURLRequestContext(); | 218 InitializeURLRequestContext(); |
219 | 219 |
220 return url_request_context_.get(); | 220 return url_request_context_.get(); |
221 } | 221 } |
222 | 222 |
223 scoped_refptr<base::SingleThreadTaskRunner> | 223 scoped_refptr<base::SingleThreadTaskRunner> |
224 AwURLRequestContextGetter::GetNetworkTaskRunner() const { | 224 AwURLRequestContextGetter::GetNetworkTaskRunner() const { |
225 return BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO); | 225 return BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO); |
226 } | 226 } |
227 | 227 |
228 void AwURLRequestContextGetter::SetProtocolHandlers( | 228 void AwURLRequestContextGetter::SetProtocolHandlers( |
229 content::ProtocolHandlerMap* protocol_handlers) { | 229 content::ProtocolHandlerMap* protocol_handlers) { |
230 std::swap(protocol_handlers_, *protocol_handlers); | 230 std::swap(protocol_handlers_, *protocol_handlers); |
231 } | 231 } |
232 | 232 |
233 } // namespace android_webview | 233 } // namespace android_webview |
OLD | NEW |