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