| 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 643 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 654 ScopedJavaLocalRef<jobject> ContentViewCoreImpl::GetContext() { | 654 ScopedJavaLocalRef<jobject> ContentViewCoreImpl::GetContext() { |
| 655 JNIEnv* env = AttachCurrentThread(); | 655 JNIEnv* env = AttachCurrentThread(); |
| 656 | 656 |
| 657 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); | 657 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); |
| 658 if (obj.is_null()) | 658 if (obj.is_null()) |
| 659 return ScopedJavaLocalRef<jobject>(); | 659 return ScopedJavaLocalRef<jobject>(); |
| 660 | 660 |
| 661 return Java_ContentViewCore_getContext(env, obj.obj()); | 661 return Java_ContentViewCore_getContext(env, obj.obj()); |
| 662 } | 662 } |
| 663 | 663 |
| 664 bool ContentViewCoreImpl::ShouldBlockMediaRequest(const GURL& url) { |
| 665 JNIEnv* env = AttachCurrentThread(); |
| 666 |
| 667 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); |
| 668 if (obj.is_null()) |
| 669 return true; |
| 670 ScopedJavaLocalRef<jstring> j_url = ConvertUTF8ToJavaString(env, url.spec()); |
| 671 return Java_ContentViewCore_shouldBlockMediaRequest(env, obj.obj(), |
| 672 j_url.obj()); |
| 673 } |
| 674 |
| 664 gfx::Size ContentViewCoreImpl::GetPhysicalBackingSize() const { | 675 gfx::Size ContentViewCoreImpl::GetPhysicalBackingSize() const { |
| 665 JNIEnv* env = AttachCurrentThread(); | 676 JNIEnv* env = AttachCurrentThread(); |
| 666 ScopedJavaLocalRef<jobject> j_obj = java_ref_.get(env); | 677 ScopedJavaLocalRef<jobject> j_obj = java_ref_.get(env); |
| 667 if (j_obj.is_null()) | 678 if (j_obj.is_null()) |
| 668 return gfx::Size(); | 679 return gfx::Size(); |
| 669 return gfx::Size( | 680 return gfx::Size( |
| 670 Java_ContentViewCore_getPhysicalBackingWidthPix(env, j_obj.obj()), | 681 Java_ContentViewCore_getPhysicalBackingWidthPix(env, j_obj.obj()), |
| 671 Java_ContentViewCore_getPhysicalBackingHeightPix(env, j_obj.obj())); | 682 Java_ContentViewCore_getPhysicalBackingHeightPix(env, j_obj.obj())); |
| 672 } | 683 } |
| 673 | 684 |
| (...skipping 968 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1642 reinterpret_cast<ui::ViewAndroid*>(view_android), | 1653 reinterpret_cast<ui::ViewAndroid*>(view_android), |
| 1643 reinterpret_cast<ui::WindowAndroid*>(window_android)); | 1654 reinterpret_cast<ui::WindowAndroid*>(window_android)); |
| 1644 return reinterpret_cast<jint>(view); | 1655 return reinterpret_cast<jint>(view); |
| 1645 } | 1656 } |
| 1646 | 1657 |
| 1647 bool RegisterContentViewCore(JNIEnv* env) { | 1658 bool RegisterContentViewCore(JNIEnv* env) { |
| 1648 return RegisterNativesImpl(env); | 1659 return RegisterNativesImpl(env); |
| 1649 } | 1660 } |
| 1650 | 1661 |
| 1651 } // namespace content | 1662 } // namespace content |
| OLD | NEW |