| 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/aw_resource.h" | 5 #include "android_webview/native/aw_resource.h" |
| 6 | 6 |
| 7 #include "base/android/jni_array.h" |
| 7 #include "base/android/jni_string.h" | 8 #include "base/android/jni_string.h" |
| 8 #include "base/android/scoped_java_ref.h" | 9 #include "base/android/scoped_java_ref.h" |
| 9 #include "jni/AwResource_jni.h" | 10 #include "jni/AwResource_jni.h" |
| 10 | 11 |
| 11 namespace android_webview { | 12 namespace android_webview { |
| 12 namespace AwResource { | 13 namespace AwResource { |
| 13 | 14 |
| 14 // These JNI functions are used by the Renderer but rely on Java data | 15 // These JNI functions are used by the Renderer but rely on Java data |
| 15 // structures that exist in the Browser. By virtue of the WebView running | 16 // structures that exist in the Browser. By virtue of the WebView running |
| 16 // in single process we can just reach over and use them. When WebView is | 17 // in single process we can just reach over and use them. When WebView is |
| 17 // multi-process capable, we'll need to rethink these. See crbug.com/156062. | 18 // multi-process capable, we'll need to rethink these. See crbug.com/156062. |
| 18 | 19 |
| 19 std::string GetLoadErrorPageContent() { | 20 std::string GetLoadErrorPageContent() { |
| 20 JNIEnv* env = base::android::AttachCurrentThread(); | 21 JNIEnv* env = base::android::AttachCurrentThread(); |
| 21 ScopedJavaLocalRef<jstring> content = | 22 ScopedJavaLocalRef<jstring> content = |
| 22 Java_AwResource_getLoadErrorPageContent(env); | 23 Java_AwResource_getLoadErrorPageContent(env); |
| 23 return base::android::ConvertJavaStringToUTF8(content); | 24 return base::android::ConvertJavaStringToUTF8(content); |
| 24 } | 25 } |
| 25 | 26 |
| 26 std::string GetNoDomainPageContent() { | 27 std::string GetNoDomainPageContent() { |
| 27 JNIEnv* env = base::android::AttachCurrentThread(); | 28 JNIEnv* env = base::android::AttachCurrentThread(); |
| 28 ScopedJavaLocalRef<jstring> content = | 29 ScopedJavaLocalRef<jstring> content = |
| 29 Java_AwResource_getNoDomainPageContent(env); | 30 Java_AwResource_getNoDomainPageContent(env); |
| 30 return base::android::ConvertJavaStringToUTF8(content); | 31 return base::android::ConvertJavaStringToUTF8(content); |
| 31 } | 32 } |
| 32 | 33 |
| 34 std::vector<std::string> GetConfigKeySystemUuidMapping() { |
| 35 JNIEnv* env = base::android::AttachCurrentThread(); |
| 36 std::vector<std::string> key_system_uuid_mappings; |
| 37 ScopedJavaLocalRef<jobjectArray> mappings = |
| 38 Java_AwResource_getConfigKeySystemUuidMapping(env); |
| 39 base::android::AppendJavaStringArrayToStringVector(env, mappings.obj(), |
| 40 &key_system_uuid_mappings); |
| 41 return key_system_uuid_mappings; |
| 42 } |
| 43 |
| 33 bool RegisterAwResource(JNIEnv* env) { | 44 bool RegisterAwResource(JNIEnv* env) { |
| 34 return RegisterNativesImpl(env); | 45 return RegisterNativesImpl(env); |
| 35 } | 46 } |
| 36 | 47 |
| 37 } // namespace AwResource | 48 } // namespace AwResource |
| 38 } // namespace android_webview | 49 } // namespace android_webview |
| OLD | NEW |