Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(362)

Side by Side Diff: android_webview/native/aw_contents.cc

Issue 974483002: [WebView] Remove onFailure from VisualStateCallback. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 1021 matching lines...) Expand 10 before | Expand all | Expand 10 after
1032 1032
1033 void AwContents::EnableOnNewPicture(JNIEnv* env, 1033 void AwContents::EnableOnNewPicture(JNIEnv* env,
1034 jobject obj, 1034 jobject obj,
1035 jboolean enabled) { 1035 jboolean enabled) {
1036 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 1036 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
1037 browser_view_renderer_.EnableOnNewPicture(enabled); 1037 browser_view_renderer_.EnableOnNewPicture(enabled);
1038 } 1038 }
1039 1039
1040 namespace { 1040 namespace {
1041 void InvokeVisualStateCallback(const JavaObjectWeakGlobalRef& java_ref, 1041 void InvokeVisualStateCallback(const JavaObjectWeakGlobalRef& java_ref,
1042 long request_id, 1042 long request_id,
1043 ScopedJavaGlobalRef<jobject>* callback, 1043 ScopedJavaGlobalRef<jobject>* callback,
1044 bool result) { 1044 bool result) {
1045 JNIEnv* env = AttachCurrentThread(); 1045 JNIEnv* env = AttachCurrentThread();
1046 ScopedJavaLocalRef<jobject> obj = java_ref.get(env); 1046 ScopedJavaLocalRef<jobject> obj = java_ref.get(env);
1047 if (obj.is_null()) 1047 if (obj.is_null())
1048 return; 1048 return;
1049 Java_AwContents_invokeVisualStateCallback( 1049 Java_AwContents_invokeVisualStateCallback(
1050 env, obj.obj(), callback->obj(), request_id, result); 1050 env, obj.obj(), callback->obj(), request_id);
1051 } 1051 }
1052 } // namespace 1052 } // namespace
1053 1053
1054 void AwContents::InsertVisualStateCallback( 1054 void AwContents::InsertVisualStateCallback(
1055 JNIEnv* env, jobject obj, long request_id, jobject callback) { 1055 JNIEnv* env, jobject obj, long request_id, jobject callback) {
1056 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 1056 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
1057 ScopedJavaGlobalRef<jobject>* j_callback = new ScopedJavaGlobalRef<jobject>(); 1057 ScopedJavaGlobalRef<jobject>* j_callback = new ScopedJavaGlobalRef<jobject>();
1058 j_callback->Reset(env, callback); 1058 j_callback->Reset(env, callback);
1059 web_contents_->GetMainFrame()->InsertVisualStateCallback( 1059 web_contents_->GetMainFrame()->InsertVisualStateCallback(
1060 base::Bind(&InvokeVisualStateCallback, java_ref_, request_id, 1060 base::Bind(&InvokeVisualStateCallback, java_ref_, request_id,
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
1142 1142
1143 AwMessagePortServiceImpl::GetInstance()->CreateMessageChannel(env, ports, 1143 AwMessagePortServiceImpl::GetInstance()->CreateMessageChannel(env, ports,
1144 GetMessagePortMessageFilter()); 1144 GetMessagePortMessageFilter());
1145 } 1145 }
1146 1146
1147 void SetShouldDownloadFavicons(JNIEnv* env, jclass jclazz) { 1147 void SetShouldDownloadFavicons(JNIEnv* env, jclass jclazz) {
1148 g_should_download_favicons = true; 1148 g_should_download_favicons = true;
1149 } 1149 }
1150 1150
1151 } // namespace android_webview 1151 } // namespace android_webview
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698