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/native/android_protocol_handler.h" | 5 #include "android_webview/native/android_protocol_handler.h" |
6 | 6 |
7 #include "android_webview/browser/net/android_stream_reader_url_request_job.h" | 7 #include "android_webview/browser/net/android_stream_reader_url_request_job.h" |
8 #include "android_webview/browser/net/aw_url_request_job_factory.h" | 8 #include "android_webview/browser/net/aw_url_request_job_factory.h" |
9 #include "android_webview/common/url_constants.h" | 9 #include "android_webview/common/url_constants.h" |
10 #include "android_webview/native/input_stream_impl.h" | 10 #include "android_webview/native/input_stream_impl.h" |
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
265 new AssetFileRequestInterceptor()); | 265 new AssetFileRequestInterceptor()); |
266 } | 266 } |
267 | 267 |
268 // Set a context object to be used for resolving resource queries. This can | 268 // Set a context object to be used for resolving resource queries. This can |
269 // be used to override the default application context and redirect all | 269 // be used to override the default application context and redirect all |
270 // resource queries to a specific context object, e.g., for the purposes of | 270 // resource queries to a specific context object, e.g., for the purposes of |
271 // testing. | 271 // testing. |
272 // | 272 // |
273 // |context| should be a android.content.Context instance or NULL to enable | 273 // |context| should be a android.content.Context instance or NULL to enable |
274 // the use of the standard application context. | 274 // the use of the standard application context. |
275 static void SetResourceContextForTesting(JNIEnv* env, jclass /*clazz*/, | 275 static void SetResourceContextForTesting(JNIEnv* env, |
276 jobject context) { | 276 const JavaParamRef<jclass>& /*clazz*/, |
| 277 const JavaParamRef<jobject>& context) { |
277 if (context) { | 278 if (context) { |
278 ResetResourceContext(new JavaObjectWeakGlobalRef(env, context)); | 279 ResetResourceContext(new JavaObjectWeakGlobalRef(env, context)); |
279 } else { | 280 } else { |
280 ResetResourceContext(NULL); | 281 ResetResourceContext(NULL); |
281 } | 282 } |
282 } | 283 } |
283 | 284 |
284 static ScopedJavaLocalRef<jstring> GetAndroidAssetPath(JNIEnv* env, | 285 static ScopedJavaLocalRef<jstring> GetAndroidAssetPath( |
285 jclass /*clazz*/) { | 286 JNIEnv* env, |
| 287 const JavaParamRef<jclass>& /*clazz*/) { |
286 return ConvertUTF8ToJavaString(env, android_webview::kAndroidAssetPath); | 288 return ConvertUTF8ToJavaString(env, android_webview::kAndroidAssetPath); |
287 } | 289 } |
288 | 290 |
289 static ScopedJavaLocalRef<jstring> GetAndroidResourcePath(JNIEnv* env, | 291 static ScopedJavaLocalRef<jstring> GetAndroidResourcePath( |
290 jclass /*clazz*/) { | 292 JNIEnv* env, |
| 293 const JavaParamRef<jclass>& /*clazz*/) { |
291 return ConvertUTF8ToJavaString(env, android_webview::kAndroidResourcePath); | 294 return ConvertUTF8ToJavaString(env, android_webview::kAndroidResourcePath); |
292 } | 295 } |
293 | 296 |
294 } // namespace android_webview | 297 } // namespace android_webview |
OLD | NEW |