| 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 1083 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1094 | 1094 |
| 1095 void AwContents::EnableOnNewPicture(JNIEnv* env, | 1095 void AwContents::EnableOnNewPicture(JNIEnv* env, |
| 1096 jobject obj, | 1096 jobject obj, |
| 1097 jboolean enabled) { | 1097 jboolean enabled) { |
| 1098 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 1098 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 1099 browser_view_renderer_.EnableOnNewPicture(enabled); | 1099 browser_view_renderer_.EnableOnNewPicture(enabled); |
| 1100 } | 1100 } |
| 1101 | 1101 |
| 1102 namespace { | 1102 namespace { |
| 1103 void InvokeVisualStateCallback(const JavaObjectWeakGlobalRef& java_ref, | 1103 void InvokeVisualStateCallback(const JavaObjectWeakGlobalRef& java_ref, |
| 1104 long request_id, | 1104 jlong request_id, |
| 1105 ScopedJavaGlobalRef<jobject>* callback, | 1105 ScopedJavaGlobalRef<jobject>* callback, |
| 1106 bool result) { | 1106 bool result) { |
| 1107 JNIEnv* env = AttachCurrentThread(); | 1107 JNIEnv* env = AttachCurrentThread(); |
| 1108 ScopedJavaLocalRef<jobject> obj = java_ref.get(env); | 1108 ScopedJavaLocalRef<jobject> obj = java_ref.get(env); |
| 1109 if (obj.is_null()) | 1109 if (obj.is_null()) |
| 1110 return; | 1110 return; |
| 1111 Java_AwContents_invokeVisualStateCallback( | 1111 Java_AwContents_invokeVisualStateCallback( |
| 1112 env, obj.obj(), callback->obj(), request_id); | 1112 env, obj.obj(), callback->obj(), request_id); |
| 1113 } | 1113 } |
| 1114 } // namespace | 1114 } // namespace |
| 1115 | 1115 |
| 1116 void AwContents::InsertVisualStateCallback( | 1116 void AwContents::InsertVisualStateCallback( |
| 1117 JNIEnv* env, jobject obj, long request_id, jobject callback) { | 1117 JNIEnv* env, jobject obj, jlong request_id, jobject callback) { |
| 1118 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 1118 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 1119 ScopedJavaGlobalRef<jobject>* j_callback = new ScopedJavaGlobalRef<jobject>(); | 1119 ScopedJavaGlobalRef<jobject>* j_callback = new ScopedJavaGlobalRef<jobject>(); |
| 1120 j_callback->Reset(env, callback); | 1120 j_callback->Reset(env, callback); |
| 1121 web_contents_->GetMainFrame()->InsertVisualStateCallback( | 1121 web_contents_->GetMainFrame()->InsertVisualStateCallback( |
| 1122 base::Bind(&InvokeVisualStateCallback, java_ref_, request_id, | 1122 base::Bind(&InvokeVisualStateCallback, java_ref_, request_id, |
| 1123 base::Owned(j_callback))); | 1123 base::Owned(j_callback))); |
| 1124 } | 1124 } |
| 1125 | 1125 |
| 1126 void AwContents::ClearView(JNIEnv* env, jobject obj) { | 1126 void AwContents::ClearView(JNIEnv* env, jobject obj) { |
| 1127 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 1127 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1209 void AwContents::GrantFileSchemeAccesstoChildProcess(JNIEnv* env, jobject obj) { | 1209 void AwContents::GrantFileSchemeAccesstoChildProcess(JNIEnv* env, jobject obj) { |
| 1210 content::ChildProcessSecurityPolicy::GetInstance()->GrantScheme( | 1210 content::ChildProcessSecurityPolicy::GetInstance()->GrantScheme( |
| 1211 web_contents_->GetRenderProcessHost()->GetID(), url::kFileScheme); | 1211 web_contents_->GetRenderProcessHost()->GetID(), url::kFileScheme); |
| 1212 } | 1212 } |
| 1213 | 1213 |
| 1214 void SetShouldDownloadFavicons(JNIEnv* env, jclass jclazz) { | 1214 void SetShouldDownloadFavicons(JNIEnv* env, jclass jclazz) { |
| 1215 g_should_download_favicons = true; | 1215 g_should_download_favicons = true; |
| 1216 } | 1216 } |
| 1217 | 1217 |
| 1218 } // namespace android_webview | 1218 } // namespace android_webview |
| OLD | NEW |