| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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/android/content_view_core_impl.h" | 5 #include "content/browser/android/content_view_core_impl.h" |
| 6 | 6 |
| 7 #include "base/android/jni_android.h" | 7 #include "base/android/jni_android.h" |
| 8 #include "base/android/jni_array.h" | 8 #include "base/android/jni_array.h" |
| 9 #include "base/android/jni_string.h" | 9 #include "base/android/jni_string.h" |
| 10 #include "base/android/scoped_java_ref.h" | 10 #include "base/android/scoped_java_ref.h" |
| (...skipping 1197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1208 jobject retained_object_set) { | 1208 jobject retained_object_set) { |
| 1209 ScopedJavaLocalRef<jobject> scoped_object(env, object); | 1209 ScopedJavaLocalRef<jobject> scoped_object(env, object); |
| 1210 ScopedJavaLocalRef<jclass> scoped_clazz(env, safe_annotation_clazz); | 1210 ScopedJavaLocalRef<jclass> scoped_clazz(env, safe_annotation_clazz); |
| 1211 JavaObjectWeakGlobalRef weak_retained_object_set(env, retained_object_set); | 1211 JavaObjectWeakGlobalRef weak_retained_object_set(env, retained_object_set); |
| 1212 | 1212 |
| 1213 // JavaBoundObject creates the NPObject with a ref count of 1, and | 1213 // JavaBoundObject creates the NPObject with a ref count of 1, and |
| 1214 // JavaBridgeDispatcherHostManager takes its own ref. | 1214 // JavaBridgeDispatcherHostManager takes its own ref. |
| 1215 JavaBridgeDispatcherHostManager* java_bridge = | 1215 JavaBridgeDispatcherHostManager* java_bridge = |
| 1216 web_contents_->java_bridge_dispatcher_host_manager(); | 1216 web_contents_->java_bridge_dispatcher_host_manager(); |
| 1217 java_bridge->SetRetainedObjectSet(weak_retained_object_set); | 1217 java_bridge->SetRetainedObjectSet(weak_retained_object_set); |
| 1218 NPObject* bound_object = JavaBoundObject::Create(scoped_object, scoped_clazz, | 1218 NPObject* bound_object = JavaBoundObject::Create( |
| 1219 java_bridge->AsWeakPtr()); | 1219 java_bridge->object_owner_id(), scoped_object, scoped_clazz, |
| 1220 java_bridge->AsWeakPtr()); |
| 1220 java_bridge->AddNamedObject(ConvertJavaStringToUTF16(env, name), | 1221 java_bridge->AddNamedObject(ConvertJavaStringToUTF16(env, name), |
| 1221 bound_object); | 1222 bound_object); |
| 1222 WebKit::WebBindings::releaseObject(bound_object); | 1223 WebKit::WebBindings::releaseObject(bound_object); |
| 1223 } | 1224 } |
| 1224 | 1225 |
| 1225 void ContentViewCoreImpl::RemoveJavascriptInterface(JNIEnv* env, | 1226 void ContentViewCoreImpl::RemoveJavascriptInterface(JNIEnv* env, |
| 1226 jobject /* obj */, | 1227 jobject /* obj */, |
| 1227 jstring name) { | 1228 jstring name) { |
| 1228 web_contents_->java_bridge_dispatcher_host_manager()->RemoveNamedObject( | 1229 web_contents_->java_bridge_dispatcher_host_manager()->RemoveNamedObject( |
| 1229 ConvertJavaStringToUTF16(env, name)); | 1230 ConvertJavaStringToUTF16(env, name)); |
| (...skipping 373 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1603 reinterpret_cast<ui::ViewAndroid*>(view_android), | 1604 reinterpret_cast<ui::ViewAndroid*>(view_android), |
| 1604 reinterpret_cast<ui::WindowAndroid*>(window_android)); | 1605 reinterpret_cast<ui::WindowAndroid*>(window_android)); |
| 1605 return reinterpret_cast<jint>(view); | 1606 return reinterpret_cast<jint>(view); |
| 1606 } | 1607 } |
| 1607 | 1608 |
| 1608 bool RegisterContentViewCore(JNIEnv* env) { | 1609 bool RegisterContentViewCore(JNIEnv* env) { |
| 1609 return RegisterNativesImpl(env); | 1610 return RegisterNativesImpl(env); |
| 1610 } | 1611 } |
| 1611 | 1612 |
| 1612 } // namespace content | 1613 } // namespace content |
| OLD | NEW |