| 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 632 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 643 ScopedJavaLocalRef<jobject> ContentViewCoreImpl::GetContext() { | 643 ScopedJavaLocalRef<jobject> ContentViewCoreImpl::GetContext() { |
| 644 JNIEnv* env = AttachCurrentThread(); | 644 JNIEnv* env = AttachCurrentThread(); |
| 645 | 645 |
| 646 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); | 646 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); |
| 647 if (obj.is_null()) | 647 if (obj.is_null()) |
| 648 return ScopedJavaLocalRef<jobject>(); | 648 return ScopedJavaLocalRef<jobject>(); |
| 649 | 649 |
| 650 return Java_ContentViewCore_getContext(env, obj.obj()); | 650 return Java_ContentViewCore_getContext(env, obj.obj()); |
| 651 } | 651 } |
| 652 | 652 |
| 653 bool ContentViewCoreImpl::ShouldBlockMediaRequest(const GURL& url) { |
| 654 JNIEnv* env = AttachCurrentThread(); |
| 655 |
| 656 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); |
| 657 if (obj.is_null()) |
| 658 return true; |
| 659 ScopedJavaLocalRef<jstring> j_url = ConvertUTF8ToJavaString(env, url.spec()); |
| 660 return Java_ContentViewCore_shouldBlockMediaRequest(env, obj.obj(), |
| 661 j_url.obj()); |
| 662 } |
| 663 |
| 653 gfx::Size ContentViewCoreImpl::GetPhysicalBackingSize() const { | 664 gfx::Size ContentViewCoreImpl::GetPhysicalBackingSize() const { |
| 654 JNIEnv* env = AttachCurrentThread(); | 665 JNIEnv* env = AttachCurrentThread(); |
| 655 ScopedJavaLocalRef<jobject> j_obj = java_ref_.get(env); | 666 ScopedJavaLocalRef<jobject> j_obj = java_ref_.get(env); |
| 656 if (j_obj.is_null()) | 667 if (j_obj.is_null()) |
| 657 return gfx::Size(); | 668 return gfx::Size(); |
| 658 return gfx::Size( | 669 return gfx::Size( |
| 659 Java_ContentViewCore_getPhysicalBackingWidthPix(env, j_obj.obj()), | 670 Java_ContentViewCore_getPhysicalBackingWidthPix(env, j_obj.obj()), |
| 660 Java_ContentViewCore_getPhysicalBackingHeightPix(env, j_obj.obj())); | 671 Java_ContentViewCore_getPhysicalBackingHeightPix(env, j_obj.obj())); |
| 661 } | 672 } |
| 662 | 673 |
| (...skipping 986 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1649 reinterpret_cast<ui::ViewAndroid*>(view_android), | 1660 reinterpret_cast<ui::ViewAndroid*>(view_android), |
| 1650 reinterpret_cast<ui::WindowAndroid*>(window_android)); | 1661 reinterpret_cast<ui::WindowAndroid*>(window_android)); |
| 1651 return reinterpret_cast<jint>(view); | 1662 return reinterpret_cast<jint>(view); |
| 1652 } | 1663 } |
| 1653 | 1664 |
| 1654 bool RegisterContentViewCore(JNIEnv* env) { | 1665 bool RegisterContentViewCore(JNIEnv* env) { |
| 1655 return RegisterNativesImpl(env); | 1666 return RegisterNativesImpl(env); |
| 1656 } | 1667 } |
| 1657 | 1668 |
| 1658 } // namespace content | 1669 } // namespace content |
| OLD | NEW |