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 1028 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1039 new AwPicture(browser_view_renderer_.CapturePicture(width, height))); | 1039 new AwPicture(browser_view_renderer_.CapturePicture(width, height))); |
1040 } | 1040 } |
1041 | 1041 |
1042 void AwContents::EnableOnNewPicture(JNIEnv* env, | 1042 void AwContents::EnableOnNewPicture(JNIEnv* env, |
1043 jobject obj, | 1043 jobject obj, |
1044 jboolean enabled) { | 1044 jboolean enabled) { |
1045 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 1045 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
1046 browser_view_renderer_.EnableOnNewPicture(enabled); | 1046 browser_view_renderer_.EnableOnNewPicture(enabled); |
1047 } | 1047 } |
1048 | 1048 |
1049 namespace { | |
1050 void FlushVisualStateCallback(ScopedJavaGlobalRef<jobject>* callback, | |
1051 bool result) { | |
1052 JNIEnv* env = AttachCurrentThread(); | |
1053 Java_AwContents_flushVisualStateCallback( | |
mkosiba (inactive)
2015/01/14 18:17:12
this doesn't look like valid formatting. did you r
Ignacio Solla
2015/01/16 16:02:07
Done.
| |
1054 env, | |
1055 callback->obj(), | |
1056 !result); | |
1057 } | |
1058 } // namespace | |
1059 | |
1060 void AwContents::FlushVisualState(JNIEnv* env, jobject obj, jobject callback) { | |
1061 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | |
1062 ScopedJavaGlobalRef<jobject>* j_callback = new ScopedJavaGlobalRef<jobject>(); | |
1063 j_callback->Reset(env, callback); | |
1064 web_contents_->GetMainFrame()->FlushVisualState( | |
1065 base::Bind(&FlushVisualStateCallback, base::Owned(j_callback))); | |
1066 } | |
1067 | |
1049 void AwContents::ClearView(JNIEnv* env, jobject obj) { | 1068 void AwContents::ClearView(JNIEnv* env, jobject obj) { |
1050 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 1069 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
1051 browser_view_renderer_.ClearView(); | 1070 browser_view_renderer_.ClearView(); |
1052 } | 1071 } |
1053 | 1072 |
1054 void AwContents::SetExtraHeadersForUrl(JNIEnv* env, jobject obj, | 1073 void AwContents::SetExtraHeadersForUrl(JNIEnv* env, jobject obj, |
1055 jstring url, jstring jextra_headers) { | 1074 jstring url, jstring jextra_headers) { |
1056 std::string extra_headers; | 1075 std::string extra_headers; |
1057 if (jextra_headers) | 1076 if (jextra_headers) |
1058 extra_headers = ConvertJavaStringToUTF8(env, jextra_headers); | 1077 extra_headers = ConvertJavaStringToUTF8(env, jextra_headers); |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1125 base::Owned(port1), | 1144 base::Owned(port1), |
1126 base::Owned(port2))); | 1145 base::Owned(port2))); |
1127 } | 1146 } |
1128 | 1147 |
1129 | 1148 |
1130 void SetShouldDownloadFavicons(JNIEnv* env, jclass jclazz) { | 1149 void SetShouldDownloadFavicons(JNIEnv* env, jclass jclazz) { |
1131 g_should_download_favicons = true; | 1150 g_should_download_favicons = true; |
1132 } | 1151 } |
1133 | 1152 |
1134 } // namespace android_webview | 1153 } // namespace android_webview |
OLD | NEW |