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" |
11 #include "base/json/json_writer.h" | 11 #include "base/json/json_writer.h" |
| 12 #include "content/browser/android/content_view_client.h" |
12 #include "content/browser/android/load_url_params.h" | 13 #include "content/browser/android/load_url_params.h" |
13 #include "content/browser/android/touch_point.h" | 14 #include "content/browser/android/touch_point.h" |
14 #include "content/browser/renderer_host/java/java_bound_object.h" | 15 #include "content/browser/renderer_host/java/java_bound_object.h" |
15 #include "content/browser/renderer_host/java/java_bridge_dispatcher_host_manager
.h" | 16 #include "content/browser/renderer_host/java/java_bridge_dispatcher_host_manager
.h" |
16 #include "content/browser/renderer_host/render_view_host_impl.h" | 17 #include "content/browser/renderer_host/render_view_host_impl.h" |
17 #include "content/browser/renderer_host/render_widget_host_impl.h" | 18 #include "content/browser/renderer_host/render_widget_host_impl.h" |
18 #include "content/browser/renderer_host/render_widget_host_view_android.h" | 19 #include "content/browser/renderer_host/render_widget_host_view_android.h" |
19 #include "content/browser/web_contents/navigation_controller_impl.h" | 20 #include "content/browser/web_contents/navigation_controller_impl.h" |
20 #include "content/browser/web_contents/web_contents_view_android.h" | 21 #include "content/browser/web_contents/web_contents_view_android.h" |
21 #include "content/public/browser/browser_context.h" | 22 #include "content/public/browser/browser_context.h" |
(...skipping 434 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
456 } | 457 } |
457 | 458 |
458 void ContentViewCoreImpl::ClearHistory(JNIEnv* env, jobject obj) { | 459 void ContentViewCoreImpl::ClearHistory(JNIEnv* env, jobject obj) { |
459 web_contents_->GetController().PruneAllButActive(); | 460 web_contents_->GetController().PruneAllButActive(); |
460 } | 461 } |
461 | 462 |
462 jboolean ContentViewCoreImpl::NeedsReload(JNIEnv* env, jobject obj) { | 463 jboolean ContentViewCoreImpl::NeedsReload(JNIEnv* env, jobject obj) { |
463 return web_contents_->GetController().NeedsReload(); | 464 return web_contents_->GetController().NeedsReload(); |
464 } | 465 } |
465 | 466 |
| 467 void ContentViewCoreImpl::SetClient(JNIEnv* env, jobject obj, jobject jclient) { |
| 468 scoped_ptr<ContentViewClient> client( |
| 469 ContentViewClient::CreateNativeContentViewClient(env, jclient)); |
| 470 |
| 471 content_view_client_.swap(client); |
| 472 } |
| 473 |
466 void ContentViewCoreImpl::AddJavascriptInterface( | 474 void ContentViewCoreImpl::AddJavascriptInterface( |
467 JNIEnv* env, | 475 JNIEnv* env, |
468 jobject /* obj */, | 476 jobject /* obj */, |
469 jobject object, | 477 jobject object, |
470 jstring name, | 478 jstring name, |
471 jboolean require_annotation) { | 479 jboolean require_annotation) { |
472 ScopedJavaLocalRef<jobject> scoped_object(env, object); | 480 ScopedJavaLocalRef<jobject> scoped_object(env, object); |
473 // JavaBoundObject creates the NPObject with a ref count of 1, and | 481 // JavaBoundObject creates the NPObject with a ref count of 1, and |
474 // JavaBridgeDispatcherHostManager takes its own ref. | 482 // JavaBridgeDispatcherHostManager takes its own ref. |
475 NPObject* bound_object = JavaBoundObject::Create(scoped_object, | 483 NPObject* bound_object = JavaBoundObject::Create(scoped_object, |
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
721 if (!HasField(env, clazz, "mNativeContentViewCore", "I")) { | 729 if (!HasField(env, clazz, "mNativeContentViewCore", "I")) { |
722 DLOG(ERROR) << "Unable to find ContentView.mNativeContentViewCore!"; | 730 DLOG(ERROR) << "Unable to find ContentView.mNativeContentViewCore!"; |
723 return false; | 731 return false; |
724 } | 732 } |
725 g_native_content_view = GetFieldID(env, clazz, "mNativeContentViewCore", "I"); | 733 g_native_content_view = GetFieldID(env, clazz, "mNativeContentViewCore", "I"); |
726 | 734 |
727 return RegisterNativesImpl(env) >= 0; | 735 return RegisterNativesImpl(env) >= 0; |
728 } | 736 } |
729 | 737 |
730 } // namespace content | 738 } // namespace content |
OLD | NEW |