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 "android_webview/native/aw_contents.h" | 5 #include "android_webview/native/aw_contents.h" |
6 | 6 |
7 #include <limits> | 7 #include <limits> |
8 | 8 |
9 #include "android_webview/browser/aw_browser_context.h" | 9 #include "android_webview/browser/aw_browser_context.h" |
10 #include "android_webview/browser/aw_browser_main_parts.h" | 10 #include "android_webview/browser/aw_browser_main_parts.h" |
(...skipping 1089 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1100 | 1100 |
1101 void AwContents::EnableOnNewPicture(JNIEnv* env, | 1101 void AwContents::EnableOnNewPicture(JNIEnv* env, |
1102 jobject obj, | 1102 jobject obj, |
1103 jboolean enabled) { | 1103 jboolean enabled) { |
1104 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 1104 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
1105 browser_view_renderer_.EnableOnNewPicture(enabled); | 1105 browser_view_renderer_.EnableOnNewPicture(enabled); |
1106 } | 1106 } |
1107 | 1107 |
1108 namespace { | 1108 namespace { |
1109 void InvokeVisualStateCallback(const JavaObjectWeakGlobalRef& java_ref, | 1109 void InvokeVisualStateCallback(const JavaObjectWeakGlobalRef& java_ref, |
1110 long request_id, | 1110 jlong request_id, |
1111 ScopedJavaGlobalRef<jobject>* callback, | 1111 ScopedJavaGlobalRef<jobject>* callback, |
1112 bool result) { | 1112 bool result) { |
1113 JNIEnv* env = AttachCurrentThread(); | 1113 JNIEnv* env = AttachCurrentThread(); |
1114 ScopedJavaLocalRef<jobject> obj = java_ref.get(env); | 1114 ScopedJavaLocalRef<jobject> obj = java_ref.get(env); |
1115 if (obj.is_null()) | 1115 if (obj.is_null()) |
1116 return; | 1116 return; |
1117 Java_AwContents_invokeVisualStateCallback( | 1117 Java_AwContents_invokeVisualStateCallback( |
1118 env, obj.obj(), callback->obj(), request_id); | 1118 env, obj.obj(), callback->obj(), request_id); |
1119 } | 1119 } |
1120 } // namespace | 1120 } // namespace |
1121 | 1121 |
1122 void AwContents::InsertVisualStateCallback( | 1122 void AwContents::InsertVisualStateCallback( |
1123 JNIEnv* env, jobject obj, long request_id, jobject callback) { | 1123 JNIEnv* env, jobject obj, jlong request_id, jobject callback) { |
1124 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 1124 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
1125 ScopedJavaGlobalRef<jobject>* j_callback = new ScopedJavaGlobalRef<jobject>(); | 1125 ScopedJavaGlobalRef<jobject>* j_callback = new ScopedJavaGlobalRef<jobject>(); |
1126 j_callback->Reset(env, callback); | 1126 j_callback->Reset(env, callback); |
1127 web_contents_->GetMainFrame()->InsertVisualStateCallback( | 1127 web_contents_->GetMainFrame()->InsertVisualStateCallback( |
1128 base::Bind(&InvokeVisualStateCallback, java_ref_, request_id, | 1128 base::Bind(&InvokeVisualStateCallback, java_ref_, request_id, |
1129 base::Owned(j_callback))); | 1129 base::Owned(j_callback))); |
1130 } | 1130 } |
1131 | 1131 |
1132 void AwContents::ClearView(JNIEnv* env, jobject obj) { | 1132 void AwContents::ClearView(JNIEnv* env, jobject obj) { |
1133 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 1133 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1216 content::ChildProcessSecurityPolicy::GetInstance()->GrantScheme( | 1216 content::ChildProcessSecurityPolicy::GetInstance()->GrantScheme( |
1217 web_contents_->GetRenderProcessHost()->GetID(), url::kFileScheme); | 1217 web_contents_->GetRenderProcessHost()->GetID(), url::kFileScheme); |
1218 } | 1218 } |
1219 | 1219 |
1220 void SetShouldDownloadFavicons(JNIEnv* env, | 1220 void SetShouldDownloadFavicons(JNIEnv* env, |
1221 const JavaParamRef<jclass>& jclazz) { | 1221 const JavaParamRef<jclass>& jclazz) { |
1222 g_should_download_favicons = true; | 1222 g_should_download_favicons = true; |
1223 } | 1223 } |
1224 | 1224 |
1225 } // namespace android_webview | 1225 } // namespace android_webview |
OLD | NEW |