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 635 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
646 ScopedJavaLocalRef<jobject> ContentViewCoreImpl::GetContext() { | 646 ScopedJavaLocalRef<jobject> ContentViewCoreImpl::GetContext() { |
647 JNIEnv* env = AttachCurrentThread(); | 647 JNIEnv* env = AttachCurrentThread(); |
648 | 648 |
649 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); | 649 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); |
650 if (obj.is_null()) | 650 if (obj.is_null()) |
651 return ScopedJavaLocalRef<jobject>(); | 651 return ScopedJavaLocalRef<jobject>(); |
652 | 652 |
653 return Java_ContentViewCore_getContext(env, obj.obj()); | 653 return Java_ContentViewCore_getContext(env, obj.obj()); |
654 } | 654 } |
655 | 655 |
| 656 bool ContentViewCoreImpl::ShouldBlockMediaRequest(const GURL& url) { |
| 657 JNIEnv* env = AttachCurrentThread(); |
| 658 |
| 659 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); |
| 660 if (obj.is_null()) |
| 661 return true; |
| 662 ScopedJavaLocalRef<jstring> j_url = ConvertUTF8ToJavaString(env, url.spec()); |
| 663 return Java_ContentViewCore_shouldBlockMediaRequest(env, obj.obj(), |
| 664 j_url.obj()); |
| 665 } |
| 666 |
656 gfx::Size ContentViewCoreImpl::GetPhysicalBackingSize() const { | 667 gfx::Size ContentViewCoreImpl::GetPhysicalBackingSize() const { |
657 JNIEnv* env = AttachCurrentThread(); | 668 JNIEnv* env = AttachCurrentThread(); |
658 ScopedJavaLocalRef<jobject> j_obj = java_ref_.get(env); | 669 ScopedJavaLocalRef<jobject> j_obj = java_ref_.get(env); |
659 if (j_obj.is_null()) | 670 if (j_obj.is_null()) |
660 return gfx::Size(); | 671 return gfx::Size(); |
661 return gfx::Size( | 672 return gfx::Size( |
662 Java_ContentViewCore_getPhysicalBackingWidthPix(env, j_obj.obj()), | 673 Java_ContentViewCore_getPhysicalBackingWidthPix(env, j_obj.obj()), |
663 Java_ContentViewCore_getPhysicalBackingHeightPix(env, j_obj.obj())); | 674 Java_ContentViewCore_getPhysicalBackingHeightPix(env, j_obj.obj())); |
664 } | 675 } |
665 | 676 |
(...skipping 968 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1634 reinterpret_cast<ui::ViewAndroid*>(view_android), | 1645 reinterpret_cast<ui::ViewAndroid*>(view_android), |
1635 reinterpret_cast<ui::WindowAndroid*>(window_android)); | 1646 reinterpret_cast<ui::WindowAndroid*>(window_android)); |
1636 return reinterpret_cast<jint>(view); | 1647 return reinterpret_cast<jint>(view); |
1637 } | 1648 } |
1638 | 1649 |
1639 bool RegisterContentViewCore(JNIEnv* env) { | 1650 bool RegisterContentViewCore(JNIEnv* env) { |
1640 return RegisterNativesImpl(env); | 1651 return RegisterNativesImpl(env); |
1641 } | 1652 } |
1642 | 1653 |
1643 } // namespace content | 1654 } // namespace content |
OLD | NEW |