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