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 436 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
459 } | 458 } |
460 | 459 |
461 void ContentViewCoreImpl::ClearHistory(JNIEnv* env, jobject obj) { | 460 void ContentViewCoreImpl::ClearHistory(JNIEnv* env, jobject obj) { |
462 web_contents_->GetController().PruneAllButActive(); | 461 web_contents_->GetController().PruneAllButActive(); |
463 } | 462 } |
464 | 463 |
465 jboolean ContentViewCoreImpl::NeedsReload(JNIEnv* env, jobject obj) { | 464 jboolean ContentViewCoreImpl::NeedsReload(JNIEnv* env, jobject obj) { |
466 return web_contents_->GetController().NeedsReload(); | 465 return web_contents_->GetController().NeedsReload(); |
467 } | 466 } |
468 | 467 |
469 void ContentViewCoreImpl::SetClient(JNIEnv* env, jobject obj, jobject jclient) { | |
470 scoped_ptr<ContentViewClient> client( | |
471 ContentViewClient::CreateNativeContentViewClient(env, jclient)); | |
472 | |
473 content_view_client_.swap(client); | |
474 } | |
475 | |
476 void ContentViewCoreImpl::AddJavascriptInterface( | 468 void ContentViewCoreImpl::AddJavascriptInterface( |
477 JNIEnv* env, | 469 JNIEnv* env, |
478 jobject /* obj */, | 470 jobject /* obj */, |
479 jobject object, | 471 jobject object, |
480 jstring name, | 472 jstring name, |
481 jboolean require_annotation) { | 473 jboolean require_annotation) { |
482 ScopedJavaLocalRef<jobject> scoped_object(env, object); | 474 ScopedJavaLocalRef<jobject> scoped_object(env, object); |
483 // JavaBoundObject creates the NPObject with a ref count of 1, and | 475 // JavaBoundObject creates the NPObject with a ref count of 1, and |
484 // JavaBridgeDispatcherHostManager takes its own ref. | 476 // JavaBridgeDispatcherHostManager takes its own ref. |
485 NPObject* bound_object = JavaBoundObject::Create(scoped_object, | 477 NPObject* bound_object = JavaBoundObject::Create(scoped_object, |
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
732 if (!HasField(env, clazz, "mNativeContentViewCore", "I")) { | 724 if (!HasField(env, clazz, "mNativeContentViewCore", "I")) { |
733 DLOG(ERROR) << "Unable to find ContentView.mNativeContentViewCore!"; | 725 DLOG(ERROR) << "Unable to find ContentView.mNativeContentViewCore!"; |
734 return false; | 726 return false; |
735 } | 727 } |
736 g_native_content_view = GetFieldID(env, clazz, "mNativeContentViewCore", "I"); | 728 g_native_content_view = GetFieldID(env, clazz, "mNativeContentViewCore", "I"); |
737 | 729 |
738 return RegisterNativesImpl(env) >= 0; | 730 return RegisterNativesImpl(env) >= 0; |
739 } | 731 } |
740 | 732 |
741 } // namespace content | 733 } // namespace content |
OLD | NEW |