| 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 // URL request job for reading from resources and assets. | 5 // URL request job for reading from resources and assets. |
| 6 | 6 |
| 7 #include "android_webview/native/android_protocol_handler.h" | 7 #include "android_webview/native/android_protocol_handler.h" |
| 8 | 8 |
| 9 #include "android_webview/common/url_constants.h" | 9 #include "android_webview/common/url_constants.h" |
| 10 #include "android_webview/native/android_stream_reader_url_request_job.h" | 10 #include "android_webview/native/android_stream_reader_url_request_job.h" |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 115 bool RegisterAndroidProtocolHandler(JNIEnv* env) { | 115 bool RegisterAndroidProtocolHandler(JNIEnv* env) { |
| 116 return RegisterNativesImpl(env); | 116 return RegisterNativesImpl(env); |
| 117 } | 117 } |
| 118 | 118 |
| 119 // static | 119 // static |
| 120 void AndroidProtocolHandler::RegisterProtocols( | 120 void AndroidProtocolHandler::RegisterProtocols( |
| 121 net::URLRequestContextGetter* context_getter) { | 121 net::URLRequestContextGetter* context_getter) { |
| 122 // Register content://. Note that even though a scheme is | 122 // Register content://. Note that even though a scheme is |
| 123 // registered here, it cannot be used by child processes until access to it is | 123 // registered here, it cannot be used by child processes until access to it is |
| 124 // granted via ChildProcessSecurityPolicy::GrantScheme(). This is done in | 124 // granted via ChildProcessSecurityPolicy::GrantScheme(). This is done in |
| 125 // RenderViewHost. | 125 // AwContentBrowserClient. |
| 126 // TODO(mnaganov): Convert into a ProtocolHandler. | 126 // TODO(mnaganov): Convert into a ProtocolHandler. |
| 127 net::URLRequestJobManager* job_manager = | 127 net::URLRequestJobManager* job_manager = |
| 128 net::URLRequestJobManager::GetInstance(); | 128 net::URLRequestJobManager::GetInstance(); |
| 129 job_manager->RegisterProtocolFactory(android_webview::kContentScheme, | 129 job_manager->RegisterProtocolFactory(android_webview::kContentScheme, |
| 130 &AndroidProtocolHandler::Factory); | 130 &AndroidProtocolHandler::Factory); |
| 131 | 131 |
| 132 // Register a file: scheme interceptor for application assets. | 132 // Register a file: scheme interceptor for application assets. |
| 133 context_getter->GetNetworkTaskRunner()->PostTask( | 133 context_getter->GetNetworkTaskRunner()->PostTask( |
| 134 FROM_HERE, | 134 FROM_HERE, |
| 135 base::Bind(&AddFileSchemeInterceptorOnIOThread, | 135 base::Bind(&AddFileSchemeInterceptorOnIOThread, |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 276 net::URLRequest* request, | 276 net::URLRequest* request, |
| 277 net::NetworkDelegate* network_delegate) const { | 277 net::NetworkDelegate* network_delegate) const { |
| 278 return NULL; | 278 return NULL; |
| 279 } | 279 } |
| 280 | 280 |
| 281 net::URLRequestJob* AssetFileProtocolInterceptor::MaybeInterceptResponse( | 281 net::URLRequestJob* AssetFileProtocolInterceptor::MaybeInterceptResponse( |
| 282 net::URLRequest* request, | 282 net::URLRequest* request, |
| 283 net::NetworkDelegate* network_delegate) const { | 283 net::NetworkDelegate* network_delegate) const { |
| 284 return NULL; | 284 return NULL; |
| 285 } | 285 } |
| OLD | NEW |