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_content_browser_client.h" | 10 #include "android_webview/browser/aw_content_browser_client.h" |
11 #include "android_webview/browser/aw_request_interceptor.h" | 11 #include "android_webview/browser/aw_request_interceptor.h" |
12 #include "android_webview/browser/net/aw_network_delegate.h" | 12 #include "android_webview/browser/net/aw_network_delegate.h" |
13 #include "android_webview/browser/net/aw_url_request_job_factory.h" | 13 #include "android_webview/browser/net/aw_url_request_job_factory.h" |
14 #include "android_webview/browser/net/init_native_callback.h" | 14 #include "android_webview/browser/net/init_native_callback.h" |
15 #include "android_webview/common/aw_switches.h" | 15 #include "android_webview/common/aw_switches.h" |
16 #include "base/command_line.h" | 16 #include "base/command_line.h" |
| 17 #include "base/threading/sequenced_worker_pool.h" |
17 #include "content/public/browser/browser_thread.h" | 18 #include "content/public/browser/browser_thread.h" |
18 #include "content/public/browser/content_browser_client.h" | 19 #include "content/public/browser/content_browser_client.h" |
19 #include "content/public/browser/cookie_store_factory.h" | 20 #include "content/public/browser/cookie_store_factory.h" |
20 #include "content/public/common/content_client.h" | 21 #include "content/public/common/content_client.h" |
21 #include "content/public/common/url_constants.h" | 22 #include "content/public/common/url_constants.h" |
22 #include "net/base/cache_type.h" | 23 #include "net/base/cache_type.h" |
23 #include "net/cookies/cookie_store.h" | 24 #include "net/cookies/cookie_store.h" |
24 #include "net/http/http_cache.h" | 25 #include "net/http/http_cache.h" |
25 #include "net/proxy/proxy_service.h" | 26 #include "net/proxy/proxy_service.h" |
26 #include "net/url_request/data_protocol_handler.h" | 27 #include "net/url_request/data_protocol_handler.h" |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
116 params->network_delegate = context->network_delegate(); | 117 params->network_delegate = context->network_delegate(); |
117 params->http_server_properties = context->http_server_properties(); | 118 params->http_server_properties = context->http_server_properties(); |
118 params->net_log = context->net_log(); | 119 params->net_log = context->net_log(); |
119 } | 120 } |
120 | 121 |
121 net::URLRequestContext* AwURLRequestContextGetter::GetURLRequestContext() { | 122 net::URLRequestContext* AwURLRequestContextGetter::GetURLRequestContext() { |
122 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 123 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
123 if (!job_factory_) { | 124 if (!job_factory_) { |
124 scoped_ptr<AwURLRequestJobFactory> job_factory(new AwURLRequestJobFactory); | 125 scoped_ptr<AwURLRequestJobFactory> job_factory(new AwURLRequestJobFactory); |
125 bool set_protocol = job_factory->SetProtocolHandler( | 126 bool set_protocol = job_factory->SetProtocolHandler( |
126 chrome::kFileScheme, new net::FileProtocolHandler()); | 127 chrome::kFileScheme, |
| 128 new net::FileProtocolHandler( |
| 129 content::BrowserThread::GetBlockingPool()-> |
| 130 GetTaskRunnerWithShutdownBehavior( |
| 131 base::SequencedWorkerPool::SKIP_ON_SHUTDOWN))); |
127 DCHECK(set_protocol); | 132 DCHECK(set_protocol); |
128 set_protocol = job_factory->SetProtocolHandler( | 133 set_protocol = job_factory->SetProtocolHandler( |
129 chrome::kDataScheme, new net::DataProtocolHandler()); | 134 chrome::kDataScheme, new net::DataProtocolHandler()); |
130 DCHECK(set_protocol); | 135 DCHECK(set_protocol); |
131 set_protocol = job_factory->SetProtocolHandler( | 136 set_protocol = job_factory->SetProtocolHandler( |
132 chrome::kBlobScheme, protocol_handlers_[chrome::kBlobScheme].release()); | 137 chrome::kBlobScheme, protocol_handlers_[chrome::kBlobScheme].release()); |
133 DCHECK(set_protocol); | 138 DCHECK(set_protocol); |
134 set_protocol = job_factory->SetProtocolHandler( | 139 set_protocol = job_factory->SetProtocolHandler( |
135 chrome::kFileSystemScheme, | 140 chrome::kFileSystemScheme, |
136 protocol_handlers_[chrome::kFileSystemScheme].release()); | 141 protocol_handlers_[chrome::kFileSystemScheme].release()); |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
189 AwURLRequestContextGetter::GetNetworkTaskRunner() const { | 194 AwURLRequestContextGetter::GetNetworkTaskRunner() const { |
190 return BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO); | 195 return BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO); |
191 } | 196 } |
192 | 197 |
193 void AwURLRequestContextGetter::SetProtocolHandlers( | 198 void AwURLRequestContextGetter::SetProtocolHandlers( |
194 content::ProtocolHandlerMap* protocol_handlers) { | 199 content::ProtocolHandlerMap* protocol_handlers) { |
195 std::swap(protocol_handlers_, *protocol_handlers); | 200 std::swap(protocol_handlers_, *protocol_handlers); |
196 } | 201 } |
197 | 202 |
198 } // namespace android_webview | 203 } // namespace android_webview |
OLD | NEW |