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 658 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
669 | 669 |
670 ScopedJavaLocalRef<jobject> ContentViewCoreImpl::CreateTouchEventSynthesizer() { | 670 ScopedJavaLocalRef<jobject> ContentViewCoreImpl::CreateTouchEventSynthesizer() { |
671 JNIEnv* env = AttachCurrentThread(); | 671 JNIEnv* env = AttachCurrentThread(); |
672 | 672 |
673 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); | 673 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); |
674 if (obj.is_null()) | 674 if (obj.is_null()) |
675 return ScopedJavaLocalRef<jobject>(); | 675 return ScopedJavaLocalRef<jobject>(); |
676 return Java_ContentViewCore_createTouchEventSynthesizer(env, obj.obj()); | 676 return Java_ContentViewCore_createTouchEventSynthesizer(env, obj.obj()); |
677 } | 677 } |
678 | 678 |
679 ScopedJavaLocalRef<jobject> ContentViewCoreImpl::GetContentVideoViewClient() { | |
680 JNIEnv* env = AttachCurrentThread(); | |
681 | |
682 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); | |
683 if (obj.is_null()) | |
684 return ScopedJavaLocalRef<jobject>(); | |
685 | |
686 return Java_ContentViewCore_getContentVideoViewClient(env, obj.obj()); | |
687 } | |
688 | |
689 ScopedJavaLocalRef<jobject> ContentViewCoreImpl::GetContext() { | |
690 JNIEnv* env = AttachCurrentThread(); | |
691 | |
692 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); | |
693 if (obj.is_null()) | |
694 return ScopedJavaLocalRef<jobject>(); | |
695 | |
696 return Java_ContentViewCore_getContext(env, obj.obj()); | |
697 } | |
698 | |
699 bool ContentViewCoreImpl::ShouldBlockMediaRequest(const GURL& url) { | 679 bool ContentViewCoreImpl::ShouldBlockMediaRequest(const GURL& url) { |
700 JNIEnv* env = AttachCurrentThread(); | 680 JNIEnv* env = AttachCurrentThread(); |
701 | 681 |
702 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); | 682 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); |
703 if (obj.is_null()) | 683 if (obj.is_null()) |
704 return true; | 684 return true; |
705 ScopedJavaLocalRef<jstring> j_url = ConvertUTF8ToJavaString(env, url.spec()); | 685 ScopedJavaLocalRef<jstring> j_url = ConvertUTF8ToJavaString(env, url.spec()); |
706 return Java_ContentViewCore_shouldBlockMediaRequest(env, obj.obj(), | 686 return Java_ContentViewCore_shouldBlockMediaRequest(env, obj.obj(), |
707 j_url.obj()); | 687 j_url.obj()); |
708 } | 688 } |
(...skipping 505 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1214 | 1194 |
1215 bool ContentViewCoreImpl::IsFullscreenRequiredForOrientationLock() const { | 1195 bool ContentViewCoreImpl::IsFullscreenRequiredForOrientationLock() const { |
1216 JNIEnv* env = AttachCurrentThread(); | 1196 JNIEnv* env = AttachCurrentThread(); |
1217 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); | 1197 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); |
1218 if (obj.is_null()) | 1198 if (obj.is_null()) |
1219 return true; | 1199 return true; |
1220 return Java_ContentViewCore_isFullscreenRequiredForOrientationLock(env, | 1200 return Java_ContentViewCore_isFullscreenRequiredForOrientationLock(env, |
1221 obj.obj()); | 1201 obj.obj()); |
1222 } | 1202 } |
1223 | 1203 |
| 1204 void ContentViewCoreImpl::OnDidEnterFullscreen() { |
| 1205 JNIEnv* env = AttachCurrentThread(); |
| 1206 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); |
| 1207 if (obj.is_null()) |
| 1208 return; |
| 1209 Java_ContentViewCore_onDidEnterFullscreen(env, obj.obj()); |
| 1210 } |
| 1211 |
| 1212 void ContentViewCoreImpl::OnDidExitFullscreen() { |
| 1213 JNIEnv* env = AttachCurrentThread(); |
| 1214 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); |
| 1215 if (obj.is_null()) |
| 1216 return; |
| 1217 Java_ContentViewCore_onDidExitFullscreen(env, obj.obj()); |
| 1218 } |
| 1219 |
1224 void ContentViewCoreImpl::SetAccessibilityEnabledInternal(bool enabled) { | 1220 void ContentViewCoreImpl::SetAccessibilityEnabledInternal(bool enabled) { |
1225 accessibility_enabled_ = enabled; | 1221 accessibility_enabled_ = enabled; |
1226 BrowserAccessibilityStateImpl* accessibility_state = | 1222 BrowserAccessibilityStateImpl* accessibility_state = |
1227 BrowserAccessibilityStateImpl::GetInstance(); | 1223 BrowserAccessibilityStateImpl::GetInstance(); |
1228 if (enabled) { | 1224 if (enabled) { |
1229 // This enables accessibility globally unless it was explicitly disallowed | 1225 // This enables accessibility globally unless it was explicitly disallowed |
1230 // by a command-line flag. | 1226 // by a command-line flag. |
1231 accessibility_state->OnScreenReaderDetected(); | 1227 accessibility_state->OnScreenReaderDetected(); |
1232 // If it was actually enabled globally, enable it for this RenderWidget now. | 1228 // If it was actually enabled globally, enable it for this RenderWidget now. |
1233 if (accessibility_state->IsAccessibleBrowser() && web_contents_) | 1229 if (accessibility_state->IsAccessibleBrowser() && web_contents_) |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1331 reinterpret_cast<ui::WindowAndroid*>(window_android), | 1327 reinterpret_cast<ui::WindowAndroid*>(window_android), |
1332 retained_objects_set); | 1328 retained_objects_set); |
1333 return reinterpret_cast<intptr_t>(view); | 1329 return reinterpret_cast<intptr_t>(view); |
1334 } | 1330 } |
1335 | 1331 |
1336 bool RegisterContentViewCore(JNIEnv* env) { | 1332 bool RegisterContentViewCore(JNIEnv* env) { |
1337 return RegisterNativesImpl(env); | 1333 return RegisterNativesImpl(env); |
1338 } | 1334 } |
1339 | 1335 |
1340 } // namespace content | 1336 } // namespace content |
OLD | NEW |