| 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" |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 114 scoped_ptr<AwURLRequestJobFactory> aw_job_factory(new AwURLRequestJobFactory); | 114 scoped_ptr<AwURLRequestJobFactory> aw_job_factory(new AwURLRequestJobFactory); |
| 115 bool set_protocol = aw_job_factory->SetProtocolHandler( | 115 bool set_protocol = aw_job_factory->SetProtocolHandler( |
| 116 url::kFileScheme, | 116 url::kFileScheme, |
| 117 new net::FileProtocolHandler( | 117 new net::FileProtocolHandler( |
| 118 content::BrowserThread::GetBlockingPool()-> | 118 content::BrowserThread::GetBlockingPool()-> |
| 119 GetTaskRunnerWithShutdownBehavior( | 119 GetTaskRunnerWithShutdownBehavior( |
| 120 base::SequencedWorkerPool::SKIP_ON_SHUTDOWN))); | 120 base::SequencedWorkerPool::SKIP_ON_SHUTDOWN))); |
| 121 DCHECK(set_protocol); | 121 DCHECK(set_protocol); |
| 122 set_protocol = aw_job_factory->SetProtocolHandler( | 122 set_protocol = aw_job_factory->SetProtocolHandler( |
| 123 url::kDataScheme, new net::DataProtocolHandler()); | 123 url::kDataScheme, new net::DataProtocolHandler()); |
| 124 DCHECK(set_protocol); | 124 static const char* protocol_handlers_to_copy[] = { |
| 125 set_protocol = aw_job_factory->SetProtocolHandler( | |
| 126 url::kBlobScheme, | 125 url::kBlobScheme, |
| 127 (*protocol_handlers)[url::kBlobScheme].release()); | |
| 128 DCHECK(set_protocol); | |
| 129 set_protocol = aw_job_factory->SetProtocolHandler( | |
| 130 url::kFileSystemScheme, | 126 url::kFileSystemScheme, |
| 131 (*protocol_handlers)[url::kFileSystemScheme].release()); | |
| 132 DCHECK(set_protocol); | |
| 133 set_protocol = aw_job_factory->SetProtocolHandler( | |
| 134 content::kChromeUIScheme, | 127 content::kChromeUIScheme, |
| 135 (*protocol_handlers)[content::kChromeUIScheme].release()); | |
| 136 DCHECK(set_protocol); | |
| 137 set_protocol = aw_job_factory->SetProtocolHandler( | |
| 138 content::kChromeDevToolsScheme, | 128 content::kChromeDevToolsScheme, |
| 139 (*protocol_handlers)[content::kChromeDevToolsScheme].release()); | 129 content::kResourceScheme, |
| 140 DCHECK(set_protocol); | 130 }; |
| 131 for (const char* scheme : protocol_handlers_to_copy) { |
| 132 set_protocol = aw_job_factory->SetProtocolHandler( |
| 133 scheme, (*protocol_handlers)[scheme].release()); |
| 134 DCHECK(set_protocol); |
| 135 } |
| 141 protocol_handlers->clear(); | 136 protocol_handlers->clear(); |
| 142 | 137 |
| 143 // Note that even though the content:// scheme handler is created here, | 138 // Note that even though the content:// scheme handler is created here, |
| 144 // it cannot be used by child processes until access to it is granted via | 139 // it cannot be used by child processes until access to it is granted via |
| 145 // ChildProcessSecurityPolicy::GrantScheme(). This is done in | 140 // ChildProcessSecurityPolicy::GrantScheme(). This is done in |
| 146 // AwContentBrowserClient. | 141 // AwContentBrowserClient. |
| 147 request_interceptors.push_back( | 142 request_interceptors.push_back( |
| 148 CreateAndroidContentRequestInterceptor().release()); | 143 CreateAndroidContentRequestInterceptor().release()); |
| 149 request_interceptors.push_back( | 144 request_interceptors.push_back( |
| 150 CreateAndroidAssetFileRequestInterceptor().release()); | 145 CreateAndroidAssetFileRequestInterceptor().release()); |
| (...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 290 net::NetLog* AwURLRequestContextGetter::GetNetLog() { | 285 net::NetLog* AwURLRequestContextGetter::GetNetLog() { |
| 291 return net_log_.get(); | 286 return net_log_.get(); |
| 292 } | 287 } |
| 293 | 288 |
| 294 void AwURLRequestContextGetter::SetKeyOnIO(const std::string& key) { | 289 void AwURLRequestContextGetter::SetKeyOnIO(const std::string& key) { |
| 295 DCHECK(data_reduction_proxy_auth_request_handler_); | 290 DCHECK(data_reduction_proxy_auth_request_handler_); |
| 296 data_reduction_proxy_auth_request_handler_->InitAuthentication(key); | 291 data_reduction_proxy_auth_request_handler_->InitAuthentication(key); |
| 297 } | 292 } |
| 298 | 293 |
| 299 } // namespace android_webview | 294 } // namespace android_webview |
| OLD | NEW |