| 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 1631 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1642 const base::string16& result) { | 1642 const base::string16& result) { |
| 1643 JNIEnv* env = AttachCurrentThread(); | 1643 JNIEnv* env = AttachCurrentThread(); |
| 1644 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); | 1644 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); |
| 1645 if (obj.is_null()) | 1645 if (obj.is_null()) |
| 1646 return; | 1646 return; |
| 1647 ScopedJavaLocalRef<jstring> jresult = ConvertUTF16ToJavaString(env, result); | 1647 ScopedJavaLocalRef<jstring> jresult = ConvertUTF16ToJavaString(env, result); |
| 1648 Java_ContentViewCore_onSmartClipDataExtracted( | 1648 Java_ContentViewCore_onSmartClipDataExtracted( |
| 1649 env, obj.obj(), jresult.obj()); | 1649 env, obj.obj(), jresult.obj()); |
| 1650 } | 1650 } |
| 1651 | 1651 |
| 1652 void ContentViewCoreImpl::WebContentsDestroyed(WebContents* web_contents) { | 1652 void ContentViewCoreImpl::WebContentsDestroyed() { |
| 1653 WebContentsViewAndroid* wcva = static_cast<WebContentsViewAndroid*>( | 1653 WebContentsViewAndroid* wcva = static_cast<WebContentsViewAndroid*>( |
| 1654 static_cast<WebContentsImpl*>(web_contents)->GetView()); | 1654 static_cast<WebContentsImpl*>(web_contents())->GetView()); |
| 1655 DCHECK(wcva); | 1655 DCHECK(wcva); |
| 1656 wcva->SetContentViewCore(NULL); | 1656 wcva->SetContentViewCore(NULL); |
| 1657 } | 1657 } |
| 1658 | 1658 |
| 1659 // This is called for each ContentView. | 1659 // This is called for each ContentView. |
| 1660 jlong Init(JNIEnv* env, | 1660 jlong Init(JNIEnv* env, |
| 1661 jobject obj, | 1661 jobject obj, |
| 1662 jlong native_web_contents, | 1662 jlong native_web_contents, |
| 1663 jlong view_android, | 1663 jlong view_android, |
| 1664 jlong window_android) { | 1664 jlong window_android) { |
| 1665 ContentViewCoreImpl* view = new ContentViewCoreImpl( | 1665 ContentViewCoreImpl* view = new ContentViewCoreImpl( |
| 1666 env, obj, | 1666 env, obj, |
| 1667 reinterpret_cast<WebContents*>(native_web_contents), | 1667 reinterpret_cast<WebContents*>(native_web_contents), |
| 1668 reinterpret_cast<ui::ViewAndroid*>(view_android), | 1668 reinterpret_cast<ui::ViewAndroid*>(view_android), |
| 1669 reinterpret_cast<ui::WindowAndroid*>(window_android)); | 1669 reinterpret_cast<ui::WindowAndroid*>(window_android)); |
| 1670 return reinterpret_cast<intptr_t>(view); | 1670 return reinterpret_cast<intptr_t>(view); |
| 1671 } | 1671 } |
| 1672 | 1672 |
| 1673 bool RegisterContentViewCore(JNIEnv* env) { | 1673 bool RegisterContentViewCore(JNIEnv* env) { |
| 1674 return RegisterNativesImpl(env); | 1674 return RegisterNativesImpl(env); |
| 1675 } | 1675 } |
| 1676 | 1676 |
| 1677 } // namespace content | 1677 } // namespace content |
| OLD | NEW |