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 FlushVisualStateCallback(const JavaObjectWeakGlobalRef& java_ref, | 1038 void FlushVisualStateCallback(const JavaObjectWeakGlobalRef& java_ref, |
1039 ScopedJavaGlobalRef<jobject>* callback, | 1039 ScopedJavaGlobalRef<jobject>* callback, |
1040 int64 request_id, | |
1041 bool result) { | 1040 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_flushVisualStateCallback(env, obj.obj(), callback->obj(), | 1045 Java_AwContents_flushVisualStateCallback( |
1047 request_id, result); | 1046 env, obj.obj(), callback->obj(), result); |
1048 } | 1047 } |
1049 } // namespace | 1048 } // namespace |
1050 | 1049 |
1051 void AwContents::FlushVisualState(JNIEnv* env, | 1050 void AwContents::FlushVisualState(JNIEnv* env, jobject obj, jobject callback) { |
1052 jobject obj, | |
1053 jobject callback, | |
1054 int64 request_id) { | |
1055 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 1051 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
1056 ScopedJavaGlobalRef<jobject>* j_callback = new ScopedJavaGlobalRef<jobject>(); | 1052 ScopedJavaGlobalRef<jobject>* j_callback = new ScopedJavaGlobalRef<jobject>(); |
1057 j_callback->Reset(env, callback); | 1053 j_callback->Reset(env, callback); |
1058 web_contents_->GetMainFrame()->FlushVisualState( | 1054 web_contents_->GetMainFrame()->FlushVisualState(base::Bind( |
1059 base::Bind(&FlushVisualStateCallback, java_ref_, base::Owned(j_callback), | 1055 &FlushVisualStateCallback, java_ref_, base::Owned(j_callback))); |
1060 request_id)); | |
1061 } | 1056 } |
1062 | 1057 |
1063 void AwContents::ClearView(JNIEnv* env, jobject obj) { | 1058 void AwContents::ClearView(JNIEnv* env, jobject obj) { |
1064 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 1059 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
1065 browser_view_renderer_.ClearView(); | 1060 browser_view_renderer_.ClearView(); |
1066 } | 1061 } |
1067 | 1062 |
1068 void AwContents::SetExtraHeadersForUrl(JNIEnv* env, jobject obj, | 1063 void AwContents::SetExtraHeadersForUrl(JNIEnv* env, jobject obj, |
1069 jstring url, jstring jextra_headers) { | 1064 jstring url, jstring jextra_headers) { |
1070 std::string extra_headers; | 1065 std::string extra_headers; |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1138 | 1133 |
1139 AwMessagePortServiceImpl::GetInstance()->CreateMessageChannel(env, callback, | 1134 AwMessagePortServiceImpl::GetInstance()->CreateMessageChannel(env, callback, |
1140 GetMessagePortMessageFilter()); | 1135 GetMessagePortMessageFilter()); |
1141 } | 1136 } |
1142 | 1137 |
1143 void SetShouldDownloadFavicons(JNIEnv* env, jclass jclazz) { | 1138 void SetShouldDownloadFavicons(JNIEnv* env, jclass jclazz) { |
1144 g_should_download_favicons = true; | 1139 g_should_download_favicons = true; |
1145 } | 1140 } |
1146 | 1141 |
1147 } // namespace android_webview | 1142 } // namespace android_webview |
OLD | NEW |