Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(68)

Side by Side Diff: content/browser/android/content_view_core_impl.cc

Issue 52463004: Block media loading when AwSettings.setBlockNetworkLoads is true. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: disable failed test Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « content/browser/android/content_view_core_impl.h ('k') | content/browser/media/android/browser_media_player_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698