| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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 1661 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1672 const base::string16& result) { | 1672 const base::string16& result) { |
| 1673 JNIEnv* env = AttachCurrentThread(); | 1673 JNIEnv* env = AttachCurrentThread(); |
| 1674 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); | 1674 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); |
| 1675 if (obj.is_null()) | 1675 if (obj.is_null()) |
| 1676 return; | 1676 return; |
| 1677 ScopedJavaLocalRef<jstring> jresult = ConvertUTF16ToJavaString(env, result); | 1677 ScopedJavaLocalRef<jstring> jresult = ConvertUTF16ToJavaString(env, result); |
| 1678 Java_ContentViewCore_onSmartClipDataExtracted( | 1678 Java_ContentViewCore_onSmartClipDataExtracted( |
| 1679 env, obj.obj(), jresult.obj()); | 1679 env, obj.obj(), jresult.obj()); |
| 1680 } | 1680 } |
| 1681 | 1681 |
| 1682 void ContentViewCoreImpl::WebContentsDestroyed(WebContents* web_contents) { |
| 1683 WebContentsViewAndroid* wcva = |
| 1684 static_cast<WebContentsViewAndroid*>(web_contents->GetView()); |
| 1685 DCHECK(wcva); |
| 1686 wcva->SetContentViewCore(NULL); |
| 1687 } |
| 1688 |
| 1682 // This is called for each ContentView. | 1689 // This is called for each ContentView. |
| 1683 jlong Init(JNIEnv* env, jobject obj, | 1690 jlong Init(JNIEnv* env, jobject obj, |
| 1684 jboolean hardware_accelerated, | 1691 jboolean hardware_accelerated, |
| 1685 jlong native_web_contents, | 1692 jlong native_web_contents, |
| 1686 jlong view_android, | 1693 jlong view_android, |
| 1687 jlong window_android) { | 1694 jlong window_android) { |
| 1688 ContentViewCoreImpl* view = new ContentViewCoreImpl( | 1695 ContentViewCoreImpl* view = new ContentViewCoreImpl( |
| 1689 env, obj, hardware_accelerated, | 1696 env, obj, hardware_accelerated, |
| 1690 reinterpret_cast<WebContents*>(native_web_contents), | 1697 reinterpret_cast<WebContents*>(native_web_contents), |
| 1691 reinterpret_cast<ui::ViewAndroid*>(view_android), | 1698 reinterpret_cast<ui::ViewAndroid*>(view_android), |
| 1692 reinterpret_cast<ui::WindowAndroid*>(window_android)); | 1699 reinterpret_cast<ui::WindowAndroid*>(window_android)); |
| 1693 return reinterpret_cast<intptr_t>(view); | 1700 return reinterpret_cast<intptr_t>(view); |
| 1694 } | 1701 } |
| 1695 | 1702 |
| 1696 bool RegisterContentViewCore(JNIEnv* env) { | 1703 bool RegisterContentViewCore(JNIEnv* env) { |
| 1697 return RegisterNativesImpl(env); | 1704 return RegisterNativesImpl(env); |
| 1698 } | 1705 } |
| 1699 | 1706 |
| 1700 } // namespace content | 1707 } // namespace content |
| OLD | NEW |