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/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 360 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
371 web_contents_->SetDelegate(client.get()); | 371 web_contents_->SetDelegate(client.get()); |
372 | 372 |
373 content_view_client_.swap(client); | 373 content_view_client_.swap(client); |
374 } | 374 } |
375 | 375 |
376 void ContentViewCoreImpl::AddJavascriptInterface( | 376 void ContentViewCoreImpl::AddJavascriptInterface( |
377 JNIEnv* env, | 377 JNIEnv* env, |
378 jobject /* obj */, | 378 jobject /* obj */, |
379 jobject object, | 379 jobject object, |
380 jstring name, | 380 jstring name, |
381 jboolean allow_inherited_methods) { | 381 jboolean require_annotation) { |
382 ScopedJavaLocalRef<jobject> scoped_object(env, object); | 382 ScopedJavaLocalRef<jobject> scoped_object(env, object); |
383 // JavaBoundObject creates the NPObject with a ref count of 1, and | 383 // JavaBoundObject creates the NPObject with a ref count of 1, and |
384 // JavaBridgeDispatcherHostManager takes its own ref. | 384 // JavaBridgeDispatcherHostManager takes its own ref. |
385 NPObject* bound_object = JavaBoundObject::Create(scoped_object, | 385 NPObject* bound_object = JavaBoundObject::Create(scoped_object, |
386 allow_inherited_methods); | 386 require_annotation); |
387 web_contents_->java_bridge_dispatcher_host_manager()->AddNamedObject( | 387 web_contents_->java_bridge_dispatcher_host_manager()->AddNamedObject( |
388 ConvertJavaStringToUTF16(env, name), bound_object); | 388 ConvertJavaStringToUTF16(env, name), bound_object); |
389 WebKit::WebBindings::releaseObject(bound_object); | 389 WebKit::WebBindings::releaseObject(bound_object); |
390 } | 390 } |
391 | 391 |
392 void ContentViewCoreImpl::RemoveJavascriptInterface(JNIEnv* env, | 392 void ContentViewCoreImpl::RemoveJavascriptInterface(JNIEnv* env, |
393 jobject /* obj */, | 393 jobject /* obj */, |
394 jstring name) { | 394 jstring name) { |
395 web_contents_->java_bridge_dispatcher_host_manager()->RemoveNamedObject( | 395 web_contents_->java_bridge_dispatcher_host_manager()->RemoveNamedObject( |
396 ConvertJavaStringToUTF16(env, name)); | 396 ConvertJavaStringToUTF16(env, name)); |
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
586 if (!HasField(env, clazz, "mNativeContentViewCore", "I")) { | 586 if (!HasField(env, clazz, "mNativeContentViewCore", "I")) { |
587 DLOG(ERROR) << "Unable to find ContentView.mNativeContentViewCore!"; | 587 DLOG(ERROR) << "Unable to find ContentView.mNativeContentViewCore!"; |
588 return false; | 588 return false; |
589 } | 589 } |
590 g_native_content_view = GetFieldID(env, clazz, "mNativeContentViewCore", "I"); | 590 g_native_content_view = GetFieldID(env, clazz, "mNativeContentViewCore", "I"); |
591 | 591 |
592 return RegisterNativesImpl(env) >= 0; | 592 return RegisterNativesImpl(env) >= 0; |
593 } | 593 } |
594 | 594 |
595 } // namespace content | 595 } // namespace content |
OLD | NEW |