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 <jni.h> | 5 #include <jni.h> |
6 | 6 |
7 #include "base/android/jni_android.h" | 7 #include "base/android/jni_android.h" |
8 #include "base/android/jni_string.h" | 8 #include "base/android/jni_string.h" |
9 #include "base/android/scoped_java_ref.h" | 9 #include "base/android/scoped_java_ref.h" |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
11 #include "base/logging.h" | 11 #include "base/logging.h" |
12 #include "content/browser/android/content_view_statics.h" | 12 #include "content/browser/android/content_view_statics.h" |
13 #include "content/common/android/address_parser.h" | 13 #include "content/common/android/address_parser.h" |
14 #include "jni/content_view_statics_jni.h" | 14 #include "jni/ContentViewStatics_jni.h" |
15 | 15 |
16 using base::android::ConvertJavaStringToUTF16; | 16 using base::android::ConvertJavaStringToUTF16; |
17 using base::android::ConvertUTF16ToJavaString; | 17 using base::android::ConvertUTF16ToJavaString; |
18 using base::android::ScopedJavaLocalRef; | 18 using base::android::ScopedJavaLocalRef; |
19 | 19 |
20 | 20 |
21 // Return the first substring consisting of the address of a physical location. | 21 // Return the first substring consisting of the address of a physical location. |
22 static jstring FindAddress(JNIEnv* env, jclass clazz, jstring addr) { | 22 static jstring FindAddress(JNIEnv* env, jclass clazz, jstring addr) { |
23 string16 content_16 = ConvertJavaStringToUTF16(env, addr); | 23 string16 content_16 = ConvertJavaStringToUTF16(env, addr); |
24 string16 result_16; | 24 string16 result_16; |
25 if (content::address_parser::FindAddress(content_16, &result_16)) | 25 if (content::address_parser::FindAddress(content_16, &result_16)) |
26 return ConvertUTF16ToJavaString(env, result_16).Release(); | 26 return ConvertUTF16ToJavaString(env, result_16).Release(); |
27 return NULL; | 27 return NULL; |
28 } | 28 } |
29 | 29 |
30 namespace content { | 30 namespace content { |
31 | 31 |
32 bool RegisterWebViewStatics(JNIEnv* env) { | 32 bool RegisterWebViewStatics(JNIEnv* env) { |
33 return RegisterNativesImpl(env) >= 0; | 33 return RegisterNativesImpl(env) >= 0; |
34 } | 34 } |
35 | 35 |
36 } // namespace content | 36 } // namespace content |
OLD | NEW |