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

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

Issue 24228003: Upstream ShouldOverrideUrlLoading changes (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: changed a non-related line to keep chrome bots happy Created 7 years 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 (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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_client_bridge.h" 5 #include "android_webview/native/aw_contents_client_bridge.h"
6 6
7 #include "base/android/jni_android.h" 7 #include "base/android/jni_android.h"
8 #include "base/android/jni_array.h" 8 #include "base/android/jni_array.h"
9 #include "base/android/jni_string.h" 9 #include "base/android/jni_string.h"
10 #include "base/callback.h" 10 #include "base/callback.h"
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
147 new content::JavaScriptDialogManager::DialogClosedCallback(callback)); 147 new content::JavaScriptDialogManager::DialogClosedCallback(callback));
148 ScopedJavaLocalRef<jstring> jurl( 148 ScopedJavaLocalRef<jstring> jurl(
149 ConvertUTF8ToJavaString(env, origin_url.spec())); 149 ConvertUTF8ToJavaString(env, origin_url.spec()));
150 ScopedJavaLocalRef<jstring> jmessage( 150 ScopedJavaLocalRef<jstring> jmessage(
151 ConvertUTF16ToJavaString(env, message_text)); 151 ConvertUTF16ToJavaString(env, message_text));
152 152
153 Java_AwContentsClientBridge_handleJsBeforeUnload( 153 Java_AwContentsClientBridge_handleJsBeforeUnload(
154 env, obj.obj(), jurl.obj(), jmessage.obj(), callback_id); 154 env, obj.obj(), jurl.obj(), jmessage.obj(), callback_id);
155 } 155 }
156 156
157 bool AwContentsClientBridge::ShouldOverrideUrlLoading(
158 const base::string16& url) {
159 JNIEnv* env = AttachCurrentThread();
160 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env);
161 if (obj.is_null())
162 return false;
163 ScopedJavaLocalRef<jstring> jurl = ConvertUTF16ToJavaString(env, url);
164 return Java_AwContentsClientBridge_shouldOverrideUrlLoading(
165 env, obj.obj(),
166 jurl.obj());
167 }
168
157 void AwContentsClientBridge::ConfirmJsResult(JNIEnv* env, 169 void AwContentsClientBridge::ConfirmJsResult(JNIEnv* env,
158 jobject, 170 jobject,
159 int id, 171 int id,
160 jstring prompt) { 172 jstring prompt) {
161 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 173 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
162 content::JavaScriptDialogManager::DialogClosedCallback* callback = 174 content::JavaScriptDialogManager::DialogClosedCallback* callback =
163 pending_js_dialog_callbacks_.Lookup(id); 175 pending_js_dialog_callbacks_.Lookup(id);
164 if (!callback) { 176 if (!callback) {
165 LOG(WARNING) << "Unexpected JS dialog confirm. " << id; 177 LOG(WARNING) << "Unexpected JS dialog confirm. " << id;
166 return; 178 return;
(...skipping 16 matching lines...) Expand all
183 } 195 }
184 callback->Run(false, string16()); 196 callback->Run(false, string16());
185 pending_js_dialog_callbacks_.Remove(id); 197 pending_js_dialog_callbacks_.Remove(id);
186 } 198 }
187 199
188 bool RegisterAwContentsClientBridge(JNIEnv* env) { 200 bool RegisterAwContentsClientBridge(JNIEnv* env) {
189 return RegisterNativesImpl(env) >= 0; 201 return RegisterNativesImpl(env) >= 0;
190 } 202 }
191 203
192 } // namespace android_webview 204 } // namespace android_webview
OLDNEW
« no previous file with comments | « android_webview/native/aw_contents_client_bridge.h ('k') | android_webview/native/aw_web_contents_delegate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698