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 1628 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1639 JNIEnv* env = AttachCurrentThread(); | 1639 JNIEnv* env = AttachCurrentThread(); |
1640 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); | 1640 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); |
1641 if (obj.is_null()) | 1641 if (obj.is_null()) |
1642 return false; | 1642 return false; |
1643 | 1643 |
1644 return Java_ContentViewCore_willHandleDeferAfterResponseStarted(env, | 1644 return Java_ContentViewCore_willHandleDeferAfterResponseStarted(env, |
1645 obj.obj()); | 1645 obj.obj()); |
1646 } | 1646 } |
1647 | 1647 |
1648 void ContentViewCoreImpl::OnSmartClipDataExtracted( | 1648 void ContentViewCoreImpl::OnSmartClipDataExtracted( |
| 1649 const gfx::Rect& clip_rect, |
1649 const base::string16& result) { | 1650 const base::string16& result) { |
1650 JNIEnv* env = AttachCurrentThread(); | 1651 JNIEnv* env = AttachCurrentThread(); |
1651 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); | 1652 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); |
1652 if (obj.is_null()) | 1653 if (obj.is_null()) |
1653 return; | 1654 return; |
| 1655 ScopedJavaLocalRef<jobject> clip_rect_object(CreateJavaRect(env, clip_rect)); |
1654 ScopedJavaLocalRef<jstring> jresult = ConvertUTF16ToJavaString(env, result); | 1656 ScopedJavaLocalRef<jstring> jresult = ConvertUTF16ToJavaString(env, result); |
1655 Java_ContentViewCore_onSmartClipDataExtracted( | 1657 Java_ContentViewCore_onSmartClipDataExtracted( |
1656 env, obj.obj(), jresult.obj()); | 1658 env, obj.obj(), jresult.obj(), clip_rect_object.obj()); |
1657 } | 1659 } |
1658 | 1660 |
1659 void ContentViewCoreImpl::WebContentsDestroyed() { | 1661 void ContentViewCoreImpl::WebContentsDestroyed() { |
1660 WebContentsViewAndroid* wcva = static_cast<WebContentsViewAndroid*>( | 1662 WebContentsViewAndroid* wcva = static_cast<WebContentsViewAndroid*>( |
1661 static_cast<WebContentsImpl*>(web_contents())->GetView()); | 1663 static_cast<WebContentsImpl*>(web_contents())->GetView()); |
1662 DCHECK(wcva); | 1664 DCHECK(wcva); |
1663 wcva->SetContentViewCore(NULL); | 1665 wcva->SetContentViewCore(NULL); |
1664 } | 1666 } |
1665 | 1667 |
1666 // This is called for each ContentView. | 1668 // This is called for each ContentView. |
(...skipping 10 matching lines...) Expand all Loading... |
1677 reinterpret_cast<ui::WindowAndroid*>(window_android), | 1679 reinterpret_cast<ui::WindowAndroid*>(window_android), |
1678 retained_objects_set); | 1680 retained_objects_set); |
1679 return reinterpret_cast<intptr_t>(view); | 1681 return reinterpret_cast<intptr_t>(view); |
1680 } | 1682 } |
1681 | 1683 |
1682 bool RegisterContentViewCore(JNIEnv* env) { | 1684 bool RegisterContentViewCore(JNIEnv* env) { |
1683 return RegisterNativesImpl(env); | 1685 return RegisterNativesImpl(env); |
1684 } | 1686 } |
1685 | 1687 |
1686 } // namespace content | 1688 } // namespace content |
OLD | NEW |