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 "content/browser/renderer_host/java/java_bound_object.h" | 5 #include "content/browser/renderer_host/java/java_bound_object.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/memory/singleton.h" | 9 #include "base/memory/singleton.h" |
10 #include "base/string_number_conversions.h" | 10 #include "base/string_number_conversions.h" |
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
264 break; | 264 break; |
265 case JavaType::TypeObject: | 265 case JavaType::TypeObject: |
266 // LIVECONNECT_COMPLIANCE: Existing behavior is to convert to null. Spec | 266 // LIVECONNECT_COMPLIANCE: Existing behavior is to convert to null. Spec |
267 // requires handling object equivalents of primitive types. | 267 // requires handling object equivalents of primitive types. |
268 result.l = NULL; | 268 result.l = NULL; |
269 break; | 269 break; |
270 case JavaType::TypeString: | 270 case JavaType::TypeString: |
271 result.l = coerce_to_string ? | 271 result.l = coerce_to_string ? |
272 ConvertUTF8ToJavaString( | 272 ConvertUTF8ToJavaString( |
273 AttachCurrentThread(), | 273 AttachCurrentThread(), |
274 is_double ? StringPrintf("%.6lg", NPVARIANT_TO_DOUBLE(variant)) : | 274 is_double ? |
275 base::Int64ToString(NPVARIANT_TO_INT32(variant))). | 275 base::StringPrintf("%.6lg", NPVARIANT_TO_DOUBLE(variant)) : |
276 Release() : | 276 base::Int64ToString(NPVARIANT_TO_INT32(variant))).Release() : |
277 NULL; | 277 NULL; |
278 break; | 278 break; |
279 case JavaType::TypeBoolean: | 279 case JavaType::TypeBoolean: |
280 // LIVECONNECT_COMPLIANCE: Existing behavior is to convert to false. Spec | 280 // LIVECONNECT_COMPLIANCE: Existing behavior is to convert to false. Spec |
281 // requires converting to false for 0 or NaN, true otherwise. | 281 // requires converting to false for 0 or NaN, true otherwise. |
282 result.z = JNI_FALSE; | 282 result.z = JNI_FALSE; |
283 break; | 283 break; |
284 case JavaType::TypeArray: | 284 case JavaType::TypeArray: |
285 // LIVECONNECT_COMPLIANCE: Existing behavior is to convert to null. Spec | 285 // LIVECONNECT_COMPLIANCE: Existing behavior is to convert to null. Spec |
286 // requires raising a JavaScript exception. | 286 // requires raising a JavaScript exception. |
(...skipping 598 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
885 if (!safe) | 885 if (!safe) |
886 continue; | 886 continue; |
887 } | 887 } |
888 | 888 |
889 JavaMethod* method = new JavaMethod(java_method); | 889 JavaMethod* method = new JavaMethod(java_method); |
890 methods_.insert(std::make_pair(method->name(), method)); | 890 methods_.insert(std::make_pair(method->name(), method)); |
891 } | 891 } |
892 } | 892 } |
893 | 893 |
894 } // namespace content | 894 } // namespace content |
OLD | NEW |