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 1019 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1030 void AwContents::EnableOnNewPicture(JNIEnv* env, | 1030 void AwContents::EnableOnNewPicture(JNIEnv* env, |
1031 jobject obj, | 1031 jobject obj, |
1032 jboolean enabled) { | 1032 jboolean enabled) { |
1033 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 1033 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
1034 browser_view_renderer_.EnableOnNewPicture(enabled); | 1034 browser_view_renderer_.EnableOnNewPicture(enabled); |
1035 } | 1035 } |
1036 | 1036 |
1037 namespace { | 1037 namespace { |
1038 void InvokeVisualStateCallback(const JavaObjectWeakGlobalRef& java_ref, | 1038 void InvokeVisualStateCallback(const JavaObjectWeakGlobalRef& java_ref, |
1039 long request_id, | 1039 long request_id, |
1040 ScopedJavaGlobalRef<jobject>* callback, | 1040 ScopedJavaGlobalRef<jobject>* callback) { |
1041 bool result) { | |
1042 JNIEnv* env = AttachCurrentThread(); | 1041 JNIEnv* env = AttachCurrentThread(); |
1043 ScopedJavaLocalRef<jobject> obj = java_ref.get(env); | 1042 ScopedJavaLocalRef<jobject> obj = java_ref.get(env); |
1044 if (obj.is_null()) | 1043 if (obj.is_null()) |
1045 return; | 1044 return; |
1046 Java_AwContents_invokeVisualStateCallback( | 1045 Java_AwContents_invokeVisualStateCallback( |
1047 env, obj.obj(), callback->obj(), request_id, result); | 1046 env, obj.obj(), callback->obj(), request_id); |
1048 } | 1047 } |
1049 } // namespace | 1048 } // namespace |
1050 | 1049 |
1051 void AwContents::InsertVisualStateCallback( | 1050 void AwContents::InsertVisualStateCallback( |
1052 JNIEnv* env, jobject obj, long request_id, jobject callback) { | 1051 JNIEnv* env, jobject obj, long request_id, jobject callback) { |
1053 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 1052 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
1054 ScopedJavaGlobalRef<jobject>* j_callback = new ScopedJavaGlobalRef<jobject>(); | 1053 ScopedJavaGlobalRef<jobject>* j_callback = new ScopedJavaGlobalRef<jobject>(); |
1055 j_callback->Reset(env, callback); | 1054 j_callback->Reset(env, callback); |
1056 web_contents_->GetMainFrame()->InsertVisualStateCallback( | 1055 web_contents_->GetMainFrame()->InsertVisualStateCallback( |
1057 base::Bind(&InvokeVisualStateCallback, java_ref_, request_id, | 1056 base::Bind(&InvokeVisualStateCallback, java_ref_, request_id, |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1136 | 1135 |
1137 AwMessagePortServiceImpl::GetInstance()->CreateMessageChannel(env, ports, | 1136 AwMessagePortServiceImpl::GetInstance()->CreateMessageChannel(env, ports, |
1138 GetMessagePortMessageFilter()); | 1137 GetMessagePortMessageFilter()); |
1139 } | 1138 } |
1140 | 1139 |
1141 void SetShouldDownloadFavicons(JNIEnv* env, jclass jclazz) { | 1140 void SetShouldDownloadFavicons(JNIEnv* env, jclass jclazz) { |
1142 g_should_download_favicons = true; | 1141 g_should_download_favicons = true; |
1143 } | 1142 } |
1144 | 1143 |
1145 } // namespace android_webview | 1144 } // namespace android_webview |
OLD | NEW |