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