| 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 <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "android_webview/browser/net/android_stream_reader_url_request_job.h" | 9 #include "android_webview/browser/net/android_stream_reader_url_request_job.h" |
| 10 #include "android_webview/browser/net/aw_url_request_job_factory.h" | 10 #include "android_webview/browser/net/aw_url_request_job_factory.h" |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 105 // Protocol handler for content:// scheme requests. | 105 // Protocol handler for content:// scheme requests. |
| 106 class ContentSchemeRequestInterceptor : public AndroidRequestInterceptorBase { | 106 class ContentSchemeRequestInterceptor : public AndroidRequestInterceptorBase { |
| 107 public: | 107 public: |
| 108 ContentSchemeRequestInterceptor(); | 108 ContentSchemeRequestInterceptor(); |
| 109 bool ShouldHandleRequest(const net::URLRequest* request) const override; | 109 bool ShouldHandleRequest(const net::URLRequest* request) const override; |
| 110 }; | 110 }; |
| 111 | 111 |
| 112 static ScopedJavaLocalRef<jobject> GetResourceContext(JNIEnv* env) { | 112 static ScopedJavaLocalRef<jobject> GetResourceContext(JNIEnv* env) { |
| 113 if (g_resource_context) | 113 if (g_resource_context) |
| 114 return g_resource_context->get(env); | 114 return g_resource_context->get(env); |
| 115 ScopedJavaLocalRef<jobject> context; | 115 return ScopedJavaLocalRef<jobject>(base::android::GetApplicationContext()); |
| 116 // We have to reset as GetApplicationContext() returns a jobject with a | |
| 117 // global ref. The constructor that takes a jobject would expect a local ref | |
| 118 // and would assert. | |
| 119 context.Reset(env, base::android::GetApplicationContext()); | |
| 120 return context; | |
| 121 } | 116 } |
| 122 | 117 |
| 123 // AndroidStreamReaderURLRequestJobDelegateImpl ------------------------------- | 118 // AndroidStreamReaderURLRequestJobDelegateImpl ------------------------------- |
| 124 | 119 |
| 125 AndroidStreamReaderURLRequestJobDelegateImpl:: | 120 AndroidStreamReaderURLRequestJobDelegateImpl:: |
| 126 AndroidStreamReaderURLRequestJobDelegateImpl() {} | 121 AndroidStreamReaderURLRequestJobDelegateImpl() {} |
| 127 | 122 |
| 128 AndroidStreamReaderURLRequestJobDelegateImpl:: | 123 AndroidStreamReaderURLRequestJobDelegateImpl:: |
| 129 ~AndroidStreamReaderURLRequestJobDelegateImpl() { | 124 ~AndroidStreamReaderURLRequestJobDelegateImpl() { |
| 130 } | 125 } |
| (...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 293 return ConvertUTF8ToJavaString(env, android_webview::kAndroidAssetPath); | 288 return ConvertUTF8ToJavaString(env, android_webview::kAndroidAssetPath); |
| 294 } | 289 } |
| 295 | 290 |
| 296 static ScopedJavaLocalRef<jstring> GetAndroidResourcePath( | 291 static ScopedJavaLocalRef<jstring> GetAndroidResourcePath( |
| 297 JNIEnv* env, | 292 JNIEnv* env, |
| 298 const JavaParamRef<jclass>& /*clazz*/) { | 293 const JavaParamRef<jclass>& /*clazz*/) { |
| 299 return ConvertUTF8ToJavaString(env, android_webview::kAndroidResourcePath); | 294 return ConvertUTF8ToJavaString(env, android_webview::kAndroidResourcePath); |
| 300 } | 295 } |
| 301 | 296 |
| 302 } // namespace android_webview | 297 } // namespace android_webview |
| OLD | NEW |