OLD | NEW |
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 <utility> | 7 #include <utility> |
8 | 8 |
9 #include "android_webview/common/devtools_instrumentation.h" | 9 #include "android_webview/common/devtools_instrumentation.h" |
10 #include "android_webview/native/aw_contents.h" | 10 #include "android_webview/native/aw_contents.h" |
(...skipping 370 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
381 ScopedJavaLocalRef<jstring> jstring_content_disposition = | 381 ScopedJavaLocalRef<jstring> jstring_content_disposition = |
382 ConvertUTF8ToJavaString(env, content_disposition); | 382 ConvertUTF8ToJavaString(env, content_disposition); |
383 ScopedJavaLocalRef<jstring> jstring_mime_type = | 383 ScopedJavaLocalRef<jstring> jstring_mime_type = |
384 ConvertUTF8ToJavaString(env, mime_type); | 384 ConvertUTF8ToJavaString(env, mime_type); |
385 | 385 |
386 Java_AwContentsClientBridge_newDownload( | 386 Java_AwContentsClientBridge_newDownload( |
387 env, obj, jstring_url, jstring_user_agent, jstring_content_disposition, | 387 env, obj, jstring_url, jstring_user_agent, jstring_content_disposition, |
388 jstring_mime_type, content_length); | 388 jstring_mime_type, content_length); |
389 } | 389 } |
390 | 390 |
| 391 void AwContentsClientBridge::NewLoginRequest(const std::string& realm, |
| 392 const std::string& account, |
| 393 const std::string& args) { |
| 394 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 395 JNIEnv* env = AttachCurrentThread(); |
| 396 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); |
| 397 if (obj.is_null()) |
| 398 return; |
| 399 |
| 400 ScopedJavaLocalRef<jstring> jrealm = ConvertUTF8ToJavaString(env, realm); |
| 401 ScopedJavaLocalRef<jstring> jargs = ConvertUTF8ToJavaString(env, args); |
| 402 |
| 403 ScopedJavaLocalRef<jstring> jaccount; |
| 404 if (!account.empty()) |
| 405 jaccount = ConvertUTF8ToJavaString(env, account); |
| 406 |
| 407 Java_AwContentsClientBridge_newLoginRequest(env, obj, jrealm, jaccount, |
| 408 jargs); |
| 409 } |
| 410 |
391 void AwContentsClientBridge::ConfirmJsResult(JNIEnv* env, | 411 void AwContentsClientBridge::ConfirmJsResult(JNIEnv* env, |
392 const JavaRef<jobject>&, | 412 const JavaRef<jobject>&, |
393 int id, | 413 int id, |
394 const JavaRef<jstring>& prompt) { | 414 const JavaRef<jstring>& prompt) { |
395 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 415 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
396 content::JavaScriptDialogManager::DialogClosedCallback* callback = | 416 content::JavaScriptDialogManager::DialogClosedCallback* callback = |
397 pending_js_dialog_callbacks_.Lookup(id); | 417 pending_js_dialog_callbacks_.Lookup(id); |
398 if (!callback) { | 418 if (!callback) { |
399 LOG(WARNING) << "Unexpected JS dialog confirm. " << id; | 419 LOG(WARNING) << "Unexpected JS dialog confirm. " << id; |
400 return; | 420 return; |
(...skipping 28 matching lines...) Expand all Loading... |
429 pending_client_cert_request_delegates_.Remove(request_id); | 449 pending_client_cert_request_delegates_.Remove(request_id); |
430 | 450 |
431 delete delegate; | 451 delete delegate; |
432 } | 452 } |
433 | 453 |
434 bool RegisterAwContentsClientBridge(JNIEnv* env) { | 454 bool RegisterAwContentsClientBridge(JNIEnv* env) { |
435 return RegisterNativesImpl(env); | 455 return RegisterNativesImpl(env); |
436 } | 456 } |
437 | 457 |
438 } // namespace android_webview | 458 } // namespace android_webview |
OLD | NEW |