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/public/browser/browser_context.h" | 20 #include "content/public/browser/browser_context.h" |
22 #include "content/public/browser/favicon_status.h" | 21 #include "content/public/browser/favicon_status.h" |
(...skipping 416 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
439 } | 438 } |
440 | 439 |
441 void ContentViewCoreImpl::ClearHistory(JNIEnv* env, jobject obj) { | 440 void ContentViewCoreImpl::ClearHistory(JNIEnv* env, jobject obj) { |
442 web_contents_->GetController().PruneAllButActive(); | 441 web_contents_->GetController().PruneAllButActive(); |
443 } | 442 } |
444 | 443 |
445 jboolean ContentViewCoreImpl::NeedsReload(JNIEnv* env, jobject obj) { | 444 jboolean ContentViewCoreImpl::NeedsReload(JNIEnv* env, jobject obj) { |
446 return web_contents_->GetController().NeedsReload(); | 445 return web_contents_->GetController().NeedsReload(); |
447 } | 446 } |
448 | 447 |
449 void ContentViewCoreImpl::SetClient(JNIEnv* env, jobject obj, jobject jclient) { | |
450 scoped_ptr<ContentViewClient> client( | |
451 ContentViewClient::CreateNativeContentViewClient(env, jclient)); | |
452 | |
453 content_view_client_.swap(client); | |
454 } | |
455 | |
456 void ContentViewCoreImpl::AddJavascriptInterface( | 448 void ContentViewCoreImpl::AddJavascriptInterface( |
457 JNIEnv* env, | 449 JNIEnv* env, |
458 jobject /* obj */, | 450 jobject /* obj */, |
459 jobject object, | 451 jobject object, |
460 jstring name, | 452 jstring name, |
461 jboolean require_annotation) { | 453 jboolean require_annotation) { |
462 ScopedJavaLocalRef<jobject> scoped_object(env, object); | 454 ScopedJavaLocalRef<jobject> scoped_object(env, object); |
463 // JavaBoundObject creates the NPObject with a ref count of 1, and | 455 // JavaBoundObject creates the NPObject with a ref count of 1, and |
464 // JavaBridgeDispatcherHostManager takes its own ref. | 456 // JavaBridgeDispatcherHostManager takes its own ref. |
465 NPObject* bound_object = JavaBoundObject::Create(scoped_object, | 457 NPObject* bound_object = JavaBoundObject::Create(scoped_object, |
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
706 if (!HasField(env, clazz, "mNativeContentViewCore", "I")) { | 698 if (!HasField(env, clazz, "mNativeContentViewCore", "I")) { |
707 DLOG(ERROR) << "Unable to find ContentView.mNativeContentViewCore!"; | 699 DLOG(ERROR) << "Unable to find ContentView.mNativeContentViewCore!"; |
708 return false; | 700 return false; |
709 } | 701 } |
710 g_native_content_view = GetFieldID(env, clazz, "mNativeContentViewCore", "I"); | 702 g_native_content_view = GetFieldID(env, clazz, "mNativeContentViewCore", "I"); |
711 | 703 |
712 return RegisterNativesImpl(env) >= 0; | 704 return RegisterNativesImpl(env) >= 0; |
713 } | 705 } |
714 | 706 |
715 } // namespace content | 707 } // namespace content |
OLD | NEW |