| 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 1650 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1661 const base::string16& result) { | 1661 const base::string16& result) { |
| 1662 JNIEnv* env = AttachCurrentThread(); | 1662 JNIEnv* env = AttachCurrentThread(); |
| 1663 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); | 1663 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); |
| 1664 if (obj.is_null()) | 1664 if (obj.is_null()) |
| 1665 return; | 1665 return; |
| 1666 ScopedJavaLocalRef<jstring> jresult = ConvertUTF16ToJavaString(env, result); | 1666 ScopedJavaLocalRef<jstring> jresult = ConvertUTF16ToJavaString(env, result); |
| 1667 Java_ContentViewCore_onSmartClipDataExtracted( | 1667 Java_ContentViewCore_onSmartClipDataExtracted( |
| 1668 env, obj.obj(), jresult.obj()); | 1668 env, obj.obj(), jresult.obj()); |
| 1669 } | 1669 } |
| 1670 | 1670 |
| 1671 void ContentViewCoreImpl::WebContentsDestroyed(WebContents* web_contents) { | 1671 void ContentViewCoreImpl::WebContentsDestroyed() { |
| 1672 WebContentsViewAndroid* wcva = static_cast<WebContentsViewAndroid*>( | 1672 WebContentsViewAndroid* wcva = static_cast<WebContentsViewAndroid*>( |
| 1673 static_cast<WebContentsImpl*>(web_contents)->GetView()); | 1673 static_cast<WebContentsImpl*>(web_contents())->GetView()); |
| 1674 DCHECK(wcva); | 1674 DCHECK(wcva); |
| 1675 wcva->SetContentViewCore(NULL); | 1675 wcva->SetContentViewCore(NULL); |
| 1676 } | 1676 } |
| 1677 | 1677 |
| 1678 // This is called for each ContentView. | 1678 // This is called for each ContentView. |
| 1679 jlong Init(JNIEnv* env, | 1679 jlong Init(JNIEnv* env, |
| 1680 jobject obj, | 1680 jobject obj, |
| 1681 jlong native_web_contents, | 1681 jlong native_web_contents, |
| 1682 jlong view_android, | 1682 jlong view_android, |
| 1683 jlong window_android, | 1683 jlong window_android, |
| 1684 jobject retained_objects_set) { | 1684 jobject retained_objects_set) { |
| 1685 ContentViewCoreImpl* view = new ContentViewCoreImpl( | 1685 ContentViewCoreImpl* view = new ContentViewCoreImpl( |
| 1686 env, obj, | 1686 env, obj, |
| 1687 reinterpret_cast<WebContents*>(native_web_contents), | 1687 reinterpret_cast<WebContents*>(native_web_contents), |
| 1688 reinterpret_cast<ui::ViewAndroid*>(view_android), | 1688 reinterpret_cast<ui::ViewAndroid*>(view_android), |
| 1689 reinterpret_cast<ui::WindowAndroid*>(window_android), | 1689 reinterpret_cast<ui::WindowAndroid*>(window_android), |
| 1690 retained_objects_set); | 1690 retained_objects_set); |
| 1691 return reinterpret_cast<intptr_t>(view); | 1691 return reinterpret_cast<intptr_t>(view); |
| 1692 } | 1692 } |
| 1693 | 1693 |
| 1694 bool RegisterContentViewCore(JNIEnv* env) { | 1694 bool RegisterContentViewCore(JNIEnv* env) { |
| 1695 return RegisterNativesImpl(env); | 1695 return RegisterNativesImpl(env); |
| 1696 } | 1696 } |
| 1697 | 1697 |
| 1698 } // namespace content | 1698 } // namespace content |
| OLD | NEW |